androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
1.popupwindow 或者toast
ViewInteraction提供了inRoot()方法,指定查找的ViewInteraction的rootView,用于区别查找,eg:
onView(withId(R.id.pop_refresh))
.inRoot(withDecorView(not(is(activity.getWindow().getDecorView()))))
.check(matches(isDisplayed())).perform(click());
2.webview
androidTestImplementation 'androidx.test.espresso:espresso-web:3.1.1'
onWebView()
.withElement(findElement(Locator.PARTIAL_LINK_TEXT, "中国日报网"))
.check(webMatches(getText(), containsString("中国日报网")))
.perform(webClick());
3.recycleview
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:3.0.2"
本文介绍了如何使用Espresso测试框架进行Android应用的自动化测试,包括PopupWindow的定位与点击,WebView内的元素交互,以及RecyclerView的检查与操作。通过示例代码展示了具体的实现步骤,帮助开发者提升测试效率。
2203

被折叠的 条评论
为什么被折叠?



