来自espresso contrib的opendraw已弃用



Espresso contrib (com.android.support.test.espresso:espresso-contrib:2.2.1) openDrawer方法已弃用

那么我该怎么打开抽屉呢?

下面是如何使用新的openclose方法的示例:

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

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

openDrawer的文档建议使用具有正确资源id的open方法并执行ViewAction

在匹配视图后使用open()和perform。这个方法将是下一个版本删除。


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

你可以试试!这将从工具栏中获取菜单,并按一下

onView(allOf(withContentDescription("Menu"),
             withParent(withId(R.id.toolbar)),
             isDisplayed())).perform(click());

最新更新