A RecyclerView can pose a bit of a challenge when automating. Luckily Google created a helpful class for us that makes all this a bit easier.
In the following blog post I will teach you what a RecyclerView is, and how to automate them:
Testing RecyclerViews with Espresso
A required dependency is mentioned at the end of the blog post. This dependency has already been added to the MailOrder Coffee project for you.
Then when you are ready, continue with the Exercise:
Exercise 3: Don’t Waste Time, Recycle with Espresso!
In this exercise you will automate a RecyclerView.
Prerequisites: Make sure you completed exercise 2.
Objective: Write a test where you:
- Go to the Beverage Menu screen
- Click a specific item in the RecyclerView: the “Con Panna” beverage
- Verify the beverage name on the Order Overview screen.
The solution can be found at GitHub:
Solution Exercise 3
Continue with part 5: White box automation: Using Code from the App