来自 espresso contrib 的 openDrawer 已弃用
openDrawer from espresso contrib is deprecated
Espresso contrib (com.android.support.test.espresso:espresso-contrib:2.2.1
) openDrawer 方法已弃用
那我应该怎么打开抽屉呢?
openDrawer
的文档建议使用具有正确资源 ID 的 open
方法并执行 ViewAction
。
Use open() with perform after matching a view. This method will be
removed in the next release.
以下是有关如何使用新的 open
和 close
方法的示例:
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
onView(withId(R.id.drawer_layout)).perform(DrawerActions.close());
你可以试试这个!这将从工具栏中获取菜单,然后单击他
onView(allOf(withContentDescription("Menu"),
withParent(withId(R.id.toolbar)),
isDisplayed())).perform(click());
Espresso contrib (com.android.support.test.espresso:espresso-contrib:2.2.1
) openDrawer 方法已弃用
那我应该怎么打开抽屉呢?
openDrawer
的文档建议使用具有正确资源 ID 的 open
方法并执行 ViewAction
。
Use open() with perform after matching a view. This method will be removed in the next release.
以下是有关如何使用新的 open
和 close
方法的示例:
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
onView(withId(R.id.drawer_layout)).perform(DrawerActions.close());
你可以试试这个!这将从工具栏中获取菜单,然后单击他
onView(allOf(withContentDescription("Menu"),
withParent(withId(R.id.toolbar)),
isDisplayed())).perform(click());