我想测试是否显示带有 imageViewTour 的imageView和包含 some_text 的标签。
我的测试:
onView(allOf(withId(R.id.imageViewTour), withTagValue(containsString("some_text")))).check(matches(isDisplayed()));
但我收到编译错误:
withTagValue (org.hamcrest.Matchers<java.lang.Object) in ViewMatchers cannot be applied to (org.hamcrest.Matcer<java.lang<String>)
答案 0 :(得分:2)
使用
onView(allOf(withId(R.id.imageViewTour), withTagValue(is((Object) "some_text")))).check(matches(isDisplayed()));