Skip to content Skip to sidebar Skip to footer

Nullpointerexception In Recyclerview Espresso Test On Hdpi Device

I have the following test written for RecyclerView @Test fun testHomeActivity_recyclerViewIndex0_configurationChange_displaysWelcomeMessageCorrectly() { launch(HomeActivi

Solution 1:

Ok I solved the issue. Basically, on orientation change recyclerview scrolls up a little bit so the view I am trying to find gets hidden. I added this line to scroll to that position, and then check the text. onView(withId(R.id.home_recycler_view)).perform(scrollToPosition<RecyclerView.ViewHolder>(0))


Post a Comment for "Nullpointerexception In Recyclerview Espresso Test On Hdpi Device"