I have method, where i click on position my recyclerView:
Espresso.onView(ViewMatchers.withId(R.id.recyclerView))
.perform(RecyclerViewActions.actionOnItemAtPosition<CurrencySelectorItemHolder>(1, ViewActions.click()))
But how i can just check on position my text for example?
Change "whatever" to the text you want :
Espresso.onView(withId(R.id.recyclerView))
.perform(RecyclerViewActions.actionOnItem(
hasDescendant(withText("whatever")), click()));
UPDATE : this code for checking text by position :
onView(withRecyclerView(R.id.recyclerView).atPosition(3))
.check(matches(hasDescendant(withText("whatever"))));
public static RecyclerViewMatcher withRecyclerView(final int recyclerViewId) {
return new RecyclerViewMatcher(recyclerViewId);
}
RecyclerViewMatcher.java
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With