Espresso in androidx : RecyclerViewActions.class not found, what to do?from the CommonsWare Community archives
At July 9, 2019, 5:57am, root-ansh asked:
I am trying testing with espresso for the first time. I wanted to learn more about how to test dynamic loading views like Recyclerview, Spinner or listview, but seems like my current project structure won’t allow it.
When i try writing the following code:
I get a red color on
RecyclerViewActions . On checking the refrences, I can see the RecyclerViewActions.class here in android support libs but not in androidx libs.
Currently am running AS 3.4.1 with sdk 29 which doesn’t even allow me to uncheck the “use androidx libraries” checkbox.
Is their a solution for this?
At July 9, 2019, 12:41pm, mmurphy replied:
There is a
RecyclerViewActions for AndroidX: https://developer.android.com/reference/androidx/test/espresso/contrib/RecyclerViewActions
Unfortunately, they are doing a really bad job of telling you what library the class is in (something I hope to address in the coming months). Try
androidx.test.espresso:espresso-contrib, given the package name for that class.
At July 9, 2019, 5:13pm, root-ansh replied:
Haha, you are awesome as always. Searched the google with that package name, and found that their are atleast 6
androidx.test.espressso.* dependencies that would be needed for complete usage of espresso. I was only using the package espresso-core, that comes by default when creating a new project and didn’t saw the Rexyclerviewactions api because of no espresso-contrib dependency.
Many many thanks again, you are a life saver, sir!