Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openDrawer from espresso contrib is deprecated

Tags:

Espresso contrib (com.android.support.test.espresso:espresso-contrib:2.2.1) openDrawer method is deprecated

then how should I open a drawer?

like image 622
Daniel Gomez Rico Avatar asked Sep 18 '15 14:09

Daniel Gomez Rico


2 Answers

Here's an example on how to use the new open and close methods:

onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());

onView(withId(R.id.drawer_layout)).perform(DrawerActions.close());

like image 174
Androiderson Avatar answered Oct 14 '22 10:10

Androiderson


The documentation for openDrawer suggests using the open method with the correct resource id and perform ViewAction.

Use open() with perform after matching a view. This method will be removed in the next release.


http://developer.android.com/reference/android/support/test/espresso/contrib/DrawerActions.html#open(int)

like image 27
kevintcoughlin Avatar answered Oct 14 '22 10:10

kevintcoughlin