Auto-tools/Projects/Robocop/WritingTests: Difference between revisions

Line 123: Line 123:
=== Use waitForTest instead of sleep() ===
=== Use waitForTest instead of sleep() ===
If you cannot find an event to wait for and you are still tempted to sleep(), consider using waitForTest() instead. waitForTest() gives you a simple way to poll for a condition for a specified maximum amount of time, with short sleep()'s in between polls. This provides the advantage that the test can proceed as soon as the condition is met, reducing test time.
If you cannot find an event to wait for and you are still tempted to sleep(), consider using waitForTest() instead. waitForTest() gives you a simple way to poll for a condition for a specified maximum amount of time, with short sleep()'s in between polls. This provides the advantage that the test can proceed as soon as the condition is met, reducing test time.
=== Activities ===
Most tests will access UI views using FennecNativeDriver.findElement, which takes an activity as an argument. Some tests will only interact with one activity, but others may need to use multiple activities. For instance, when there are multiple tabs, there may be multiple awesome bar activities; use the wrong activity and you'll be accessing an unexpected element / view! See testNewTab for an example with multiple activities.


=== Logging ===
=== Logging ===
Confirmed users
1,759

edits