I am using Espresso to write some tests for a RecyclerView. Well, I am trying to verify that some texts in my recycler view items are correctly shown.
After some research, I could verify that the recycler item has or not an certain descendant:
StatementInteractionRobot isExchangeHeaderCorrectlyShown(int position, Exchange exchange) {
onView(withRecyclerView(R.id.transactions_cards)
.atPosition(position))
.check(matches(allOf(
hasDescendant(withText(exchange.getToCurrency().getSymbol())),
[some more checks here...]
return this;
}
But the problem is: I need to to verify that they are displayed or not (using isDisplayed()), but I am not really sure about how to do this, I trying some approaches but no luck so far.
So: What do I need to change to verify that the view is displayed?
Any help is appreciated!