Confirmed users
1,759
edits
| Line 156: | Line 156: | ||
=== Be careful when relying on scrolling in waitForText === | === Be careful when relying on scrolling in waitForText === | ||
Solo.waitForText (and some other Robotium functions) will conveniently scroll down in a list to find text that is not displayed. But it will not scroll up again! Consider a test like this: | Solo.waitForText (and some other Robotium functions) will conveniently scroll down in a list to find text that is not displayed. But it will not scroll up again! Consider a test like this: | ||
<open a menu or display a list> | |||
mAsserter.ok(waitForText("Item 1"), ... | <open a menu or display a list> | ||
mAsserter.ok(waitForText("Item 2"), ... | mAsserter.ok(waitForText("Item 1"), ... | ||
If both Item 1 and Item 2 are visible, this test passes. | mAsserter.ok(waitForText("Item 2"), ... | ||
If Item 1 occurs first in the list, with Item 2 later, and Item 2 is off the bottom of the screen, then the first waitForText succeeds immediately, the second waitForText scrolls down, then succeeds, and the test passes. | |||
If Item 2 occurs first in the list, with Item 1 later, and Item 1 is off the bottom of the screen, then the first waitForText scrolls down to find Item 1. If that operation scrolls Item 2 off the top of the screen, then the second waitForText will fail! | ** If both Item 1 and Item 2 are visible, this test passes. | ||
** If Item 1 occurs first in the list, with Item 2 later, and Item 2 is off the bottom of the screen, then the first waitForText succeeds immediately, the second waitForText scrolls down, then succeeds, and the test passes. | |||
** If Item 2 occurs first in the list, with Item 1 later, and Item 1 is off the bottom of the screen, then the first waitForText scrolls down to find Item 1. If that operation scrolls Item 2 off the top of the screen, then the second waitForText will fail! | |||
= More Information = | = More Information = | ||