I have this code in my Espresso test
onView(withId(R.id.src))
.perform(click());
onData(hasToString(startsWith(\"CCD\")))
.perform(click());
onView(w
For custom adapter i had yo create a custom matcher:
onView(withId(R.id.spinner)).perform(click());
onData(allOf(is(instanceOf(YourCustomClass.class)), withMyValue("Open"))).perform(click());
public static Matcher withMyValue(final String name) {
return new BaseMatcher() {
@Override
public boolean matches(Object item) {
return item.toString().equals(name);
}
@Override
public void describeTo(Description description) {
}
};
}
Then you must override toString() method on your custom class.