I have this test and I want to assert that a specific item is being loaded by retrofit and displyed in the recyclerview.
I already debugged and I know that the web request response is successful and returns the list of movies as expected.
 @Test
    fun findItem_checkItsText() {
        val result = tmdbApi.getMovies(AppConstants.LANGUAGE, 1).execute()
        if(result.isSuccessful) {
            val movieTitle = result.body()?.results?.get(0)?.title
            onView(withText(movieTitle)).check(matches(isDisplayed()))
        } else {
            AssertionFailedError()
        }
    }
The test fails with androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with text: is "Hustlers" message (Hustlers is the title of the movie at position 0) and I don't know why. How can I check if data is loaded and displayed in recyclerview items?
 
    