android单元测试Esspresso测试popupwindow,webview

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"

猜你喜欢

转载自blog.csdn.net/github_37610197/article/details/127885910
今日推荐