RobotiumTech/robotium

Scrolling down RecyclerView with GridLayoutManager

Opened this issue · 2 comments

Hello!

I am working on tests for an application that has a RecyclerView with possibility to switch between GridLayoutManager and LinearLayoutManager. I encountered a problem when trying to search for a certain text in the RecyclerView when it is in the GridLayoutManager and using

solo.searchText("myText");

What I expect Robotium to do is to scroll down until it finds this text, but instead what happens is that Robotium will scroll until the last row of elements is partially visible and stop scrolling there, leaving the actual text that is to be searched outside the visible screen.

The same thing happens if I try to call

solo.scrollRecyclerViewToBottom(1);

Robotium will scroll until last row of items is partially visible and stop there. Index 1 is given since there's another RecyclerView in another ViewPager that is also available,

Searching will be done correctly when trying to search the RecyclerView with a LinearLayoutManager.

renas commented

Thanks for reporting this. Would it be possible for you to share an apk that exhibits this issue?

Sure, it is available in here.

Grid/listView can be enabled from the overflow menu on top right corner.

If you have an use for it, here is also my test code, testGridView method.