QA/Mozmill Test Automation/Test Modules Refactor: Difference between revisions

Line 296: Line 296:
=== Idioms ===
=== Idioms ===
1. Use waitFor() as much as possible.  Only use sleep() when a waitFor() fails.
1. Use waitFor() as much as possible.  Only use sleep() when a waitFor() fails.
2. Always use a discrete int value for any DELAYs
3. Always use a global constant for any TIMEOUTs
<pre>
const TIMEOUT = 5000;
...
controller.waitFor(function() {
  return something == something;
} "Some message", TIMEOUT);
</pre>


== Refactoring  ==
== Refactoring  ==
Confirmed users
14,525

edits