I have this line of Espresso test code:
rvWorkDaySchedule is shown in red in the editor of Android Studio because there is no such XML view id in the layouts - I create this RecyclerView programmatically.
So how do I detect views that have been inflated programmatically with Espresso?
First of all, Espresso allows you to use Hamcrest matchers in tests.
Hamcrest 1.3 Quick Reference.
The most useful for catching the programmatically added views are
To make it more clear, I would give a simple example from my app:
RecyclerView tests in Espresso use
onData methods instead
Espresso 2.1. Espresso Cheat Sheet Master
Another example from my app - using
Finally, check these great Googles repository for get more examples