草庐IT

espresso

全部标签

android - Espresso Intent 测试失败

我正在学习使用espresso进行android仪器测试。我有一个应用程序,它有一个抽屉菜单,还有一个名为About的菜单。我正在测试单击该菜单项和Activity内容。测试功能:@TestpublicvoidtestNavigationDrawerAboutMenu(){onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());//opendraweronView(withText("About")).perform(click());onView(withId(R.id.aboutsptemail)).chec

android - Espresso Intent 测试失败

我正在学习使用espresso进行android仪器测试。我有一个应用程序,它有一个抽屉菜单,还有一个名为About的菜单。我正在测试单击该菜单项和Activity内容。测试功能:@TestpublicvoidtestNavigationDrawerAboutMenu(){onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());//opendraweronView(withText("About")).perform(click());onView(withId(R.id.aboutsptemail)).chec

android - 如何管理运行时权限 android marshmallow espresso 测试

我正在使用espresso进行测试,但有时我尝试从外部存储中获取图像,并且使用marshmallow我需要运行时权限,否则会出现异常崩溃并且测试将失败。androidTestCompile'com.android.support.test:runner:0.4'androidTestCompile'com.android.support.test:rules:0.4'androidTestCompile'com.android.support.test.espresso:espresso-core:2.2.1'androidTestCompile'com.android.support

android - 如何管理运行时权限 android marshmallow espresso 测试

我正在使用espresso进行测试,但有时我尝试从外部存储中获取图像,并且使用marshmallow我需要运行时权限,否则会出现异常崩溃并且测试将失败。androidTestCompile'com.android.support.test:runner:0.4'androidTestCompile'com.android.support.test:rules:0.4'androidTestCompile'com.android.support.test.espresso:espresso-core:2.2.1'androidTestCompile'com.android.support

android - 用 Espresso 测试 ViewPager。如何对 Item 的按钮执行操作?

我有一个ViewPager,其中的项目只包含一张图片和一个按钮。我无法与项目(页面)的UI成功交互,因为除了显示的图片,没有任何东西可以区分(从UI的角度)ViewPager的所有项目。我试图只选择一个有位置的项目:onData(is(instanceOf(ItemClass.class))).atPosition(0).onChildView(withId(R.id.button)).perform(click());原因:NoMatchingViewException:Noviewsinhierarchyfoundmatching:isassignablefromclass:cla

android - 用 Espresso 测试 ViewPager。如何对 Item 的按钮执行操作?

我有一个ViewPager,其中的项目只包含一张图片和一个按钮。我无法与项目(页面)的UI成功交互,因为除了显示的图片,没有任何东西可以区分(从UI的角度)ViewPager的所有项目。我试图只选择一个有位置的项目:onData(is(instanceOf(ItemClass.class))).atPosition(0).onChildView(withId(R.id.button)).perform(click());原因:NoMatchingViewException:Noviewsinhierarchyfoundmatching:isassignablefromclass:cla

android - 使用 Espresso 更新 EditText

我正在尝试更新EditText作为Espresso测试的一部分:onView(allOf(withClassName(endsWith("EditText")),withText(is("Test")))).perform(clearText()).perform(click()).perform(typeText("Anothertest"));但是我收到以下错误:com.google.android.apps.common.testing.ui.espresso.NoMatchingViewException:Noviewsinhierarchyfoundmatching:(wit

android - 使用 Espresso 更新 EditText

我正在尝试更新EditText作为Espresso测试的一部分:onView(allOf(withClassName(endsWith("EditText")),withText(is("Test")))).perform(clearText()).perform(click()).perform(typeText("Anothertest"));但是我收到以下错误:com.google.android.apps.common.testing.ui.espresso.NoMatchingViewException:Noviewsinhierarchyfoundmatching:(wit

android - Espresso,当 NestedScrollView 或 RecyclerView 在 CoordinatorLayout 中时滚动不起作用

看起来CoordinatorLayout破坏了Espresso操作的行为,例如scrollTo()或RecyclerViewActions.scrollToPosition()。NestedScrollView的问题对于这样的布局:......如果我尝试使用ViewActions.scrollTo()滚动到NestedScrollView内的任何View,我发现的第一个问题是我得到一个PerformException。这是因为这个Action只支持ScrollView而NestedScrollView不扩展它。解释了此问题的解决方法here,基本上我们可以复制scrollTo()中的代

android - Espresso,当 NestedScrollView 或 RecyclerView 在 CoordinatorLayout 中时滚动不起作用

看起来CoordinatorLayout破坏了Espresso操作的行为,例如scrollTo()或RecyclerViewActions.scrollToPosition()。NestedScrollView的问题对于这样的布局:......如果我尝试使用ViewActions.scrollTo()滚动到NestedScrollView内的任何View,我发现的第一个问题是我得到一个PerformException。这是因为这个Action只支持ScrollView而NestedScrollView不扩展它。解释了此问题的解决方法here,基本上我们可以复制scrollTo()中的代