Auto-tools/Projects/peptest: Difference between revisions

Line 164: Line 164:
== API Reference ==
== API Reference ==


There is a Peptest API that gets injected into the scope of every test. Each test can use the following methods:
There is a Peptest API that gets injected into the scope of every test under the 'pep' namespace. Each test can use the following methods:


=== General ===
=== General ===
==== performAction(name, function) ====
==== pep.performAction(name, function) ====
Performs an action during which responsiveness measurements are recorded
Performs an action during which responsiveness measurements are recorded
* name - the name of the action to run
* name - the name of the action to run
* function - a function pointer of the action to run
* function - a function pointer of the action to run


==== getWindow(type) ====
==== pep.getWindow(type) ====
Returns a reference to the current window
Returns a reference to the current window
* type - string representing the window type, defaults to "navigator:browser" (see [https://developer.mozilla.org/en/XUL/Attribute/windowtype windowType])
* type - string representing the window type, defaults to "navigator:browser" (see [https://developer.mozilla.org/en/XUL/Attribute/windowtype windowType])


==== sleep(milliseconds) ====
==== pep.sleep(milliseconds) ====
Unfortunately UI Automation is very dependent on timing and sometimes it is necessary to sleep, though you should avoid this method if you can
Unfortunately UI Automation is very dependent on timing and sometimes it is necessary to sleep, though you should avoid this method if you can
* milliseconds - the number of milliseconds to sleep for
* milliseconds - the number of milliseconds to sleep for
Line 185: Line 185:


Logging methods
Logging methods
==== log.debug(msg) ====
==== pep.log.debug(msg) ====
==== log.info(msg) ====
==== pep.log.info(msg) ====
==== log.warning(msg) ====
==== pep.log.warning(msg) ====
==== log.error(msg) ====
==== pep.log.error(msg) ====
Confirmed users
656

edits