RobotiumTech/robotium

Scrolling a navigation drawer when there is a list in main fragment aswell

Closed this issue · 6 comments

I'm building tests for an application that has a list in the navigation drawer that needs to be scrolled down, but there is also a scrollable list in the main fragment that is shown behind the nav drawer.

When I'm performing solo.search("something"), it seems Robotium will scroll the list behind the nav drawer instead of the nav drawer itself.

I can make an algorithm that will get all views with getView(), check if the view looked for is visible and if not, use scrollInList() to scroll down the nav drawer list and get all the views again, but this does not seem like a good way to do the search.

I'm wondering if there would be a better way to search in a navigation drawer, or am I stuck with the way I described?

renas commented

Thanks for reporting this. We have noticed this issue as well. For now the workaround you mention will work. We'll try to experiment on our side to see what we can do about this issue.

Allright, thanks

renas commented

@Domuska Can you please test if this issue is fixed with the attached Robobtium jar? Had to add ".zip" for Github to accept it.

robotium-solo-5.6.1-SNAPSHOT.jar.zip

@renas This version seems to fix the issue mostly. Thank you!

However, I did encounter a situation where I am using searchText() just to see if a text is present in the drawer. The text is also present in the fragment that is visible behind the drawer but I want to make sure the text is not visible in the drawer itself, and this will cause an issue even with the new library.

Robotium will find the text that is in the fragment behind the drawer and return true even though I'm expecting it to return false.

Problem is of course that the view that holds the text is also visible in uiautomatorviewer behind the navigation drawer, so I'm not sure if there is much to be done about it.

renas commented

Great. Thanks for letting me know! Yes due to the View also being shown behind the navigation drawer you will still get true back from searchText. A way you can deal with it is by using index. Index can be used with the click and search methods.

5.6.1 will be released shortly.

renas commented

The fix is included in 5.6.1. Thanks again for reporting it.