The old way of viewing the page source broke the current uiautomator session. A
lot of effort went into detecting a failed session and then restarting. It turns
out we can access the source from within a session.
Mobile find scroll no longer fails if nothing is scrollable on the page. Instead
if there's a match, then that match is returned even if we didn't have to
scroll.
Fix NPE in error reporting. The error message may be null.
Fix spacing
One thing to keep in mind: iOS and Android treat dialogs differently. iOS "system" dialogs can be triggered from the application under test as well as from external sources (the system). However, Android treats dialogs as any other window. So, to make this work, the bootstrap app looks for windows with the package name of "com.android.systemui". These are dialogs that the system has instantiated, but not the app.
So, for example, if we had the same application written on both platforms, and they both had a login screen, and you click on the login button without putting in a username. On iOS, you would be notified if they used a standard system dialog, and you would not be notified on Android. However, if the system put up a low battery dialog, it would be detected on both systems.
So... The main reason for implementing this is to stop failing tests from unintentional dialogs appearing during an overnight test.
Updated call signiture to instruments.
Fix#566
Example. Scroll to an element with text or name matching 'account'
text = 'account'
# scroll vertical ListView
args = 'scroll',
# textContains(text)
[ [3, text] ],
# descriptionContains(text)
[ [7, text] ]
mobile :find, args