Issue
I have an Android application which has a RecyclerView with N elements, and when this RecyclerView reaches to end when scrolling, then more elements are added (so, it's an infinite list which loads data when scroll reached the bottom).
I would like to test this, but I haven't found a way to do this. I use RecyclerViewActions which have scrollToPosition but even if I put the last position, the end is not reached (because the height of each element is high).
Anybody know how could I do this?
Solution
I use the below to scroll to the bottom of my RecyclerView.
activity = mActivityTestRule.launchActivity(startingIntent);
onView(withId(R.id.recyclerView)).perform(
RecyclerViewActions.scrollToPosition<RecyclerView.ViewHolder>(
activity.recyclerView.getAdapter().getItemCount() - 1
)
);
You'll then have to use idling resources (or Thread.sleep()) to call this again when more data has loaded.
Answered By - Josh Laird
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.