Last active
August 29, 2015 14:21
-
-
Save quentin7b/9b51a3827c842417636b to your computer and use it in GitHub Desktop.
Robotium 5.3.1 (App compat API 21+) / Open navigation drawer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* As we use app compat it seems Solo#setNavigationDrawer is not doing well (drawer does not open, but the button is clicked) | |
* Same result for clickOnView(getView(android.R.id.home)) | |
* | |
* This code opens the navigation drawer on the main thread | |
* Be aware : you need to provide your DrawerLayout id (you can do it in params) | |
*/ | |
public void openCompatNavigationDrawer() { | |
getInstrumentation().runOnMainSync(new Runnable() { | |
@Override | |
public void run() { | |
// You need to replace with your DrawerLayout id, or set it in params | |
((DrawerLayout) mSolo.getView(R.id.drawer_layout)).openDrawer(Gravity.LEFT); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment