I'm trying to test a RecyclerView using Espresso's framework and currently hitting into the following issue -
Espresso's method
fun scrollToItemAndCheck() {
onView(withId(R.id.recycler_view))
.perform(scrollTo<RecyclerView.ViewHolder(hasDescendant(withText("item text"))))
}
RecyclerView -
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
Issue - scrollToItemAndCheck()
throws an AppNotIdleException.
Note - The same method starts working fine when I wrap the RecyclerView
inside a FrameLayout
<FrameLayout>
android:layout_width="match_parent"
android:layout_height="match_parent"
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</FrameLayout>
Any clue as to what's going on?