Reputation: 197
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?
Upvotes: 5
Views: 1726
Reputation: 4888
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);
}
Upvotes: 6