Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android, Espresso: How check if tag value contains some string?

I want to test if imageView with id imageViewTour and tag that contains some_text is displayed.

My test:

onView(allOf(withId(R.id.imageViewTour), withTagValue(containsString("some_text")))).check(matches(isDisplayed()));

But I get compile error:

withTagValue (org.hamcrest.Matchers<java.lang.Object) in ViewMatchers cannot be applied to (org.hamcrest.Matcer<java.lang<String>)
like image 386
Alexei Avatar asked Oct 24 '25 17:10

Alexei


1 Answers

Use

 onView(allOf(withId(R.id.imageViewTour), withTagValue(is((Object) "some_text")))).check(matches(isDisplayed()));
like image 151
stamanuel Avatar answered Oct 26 '25 21:10

stamanuel