QA/TDAI/Gristmill/Gristmill API: Difference between revisions

From MozillaWiki
< QA‎ | TDAI‎ | Gristmill
Jump to navigation Jump to search
No edit summary
(Replacing page with 'All Mozmill (aka Gristmill in the early days) documentation is [http://quality.mozilla.org/mozmill-docs now on QMO].')
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
This explains the Gristmill APIs that you can use in your tests.
All Mozmill (aka Gristmill in the early days) documentation is [http://quality.mozilla.org/mozmill-docs now on QMO].
 
 
== Action APIs ==
===controller.open(url, elementToWaitFor)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|url
|A URL to open
|}
Open is a mechanism to open a the given URL in the currently focused tab/window of the window that is under control by the controller.
 
===controller.keypress(el, keycode)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the event will be targeted at
|-
|keycode
|The keycode that you wish to send to that element.
|}
Sends a single key event to the designated element object.
 
===controller.type(el, text)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the event will be targeted at
|-
|text
|The text to be typed into the given element object
|}
Fires type events (simulating both the keydown and keyup) at the given element object.  If the text is longer than the available length on the element object, the text will be truncated to fit.
 
===controller.click(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the event will be targeted at
|}
Sends a single mouse click to the element object
 
===controller.select(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the event will be targeted at
|}
Selects the specified option and triggers the relevant selection events on the given element object.  TODO: Determine if this code works.
 
===controller.mousedown(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the event will be targeted at
|}
Sends the "mousedown" (mouse button depressed) event to the element object.
 
===controller.mouseup(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the event will be targeted at
|}
Sends the "mouseup" (mouse button released) event to the element object.
 
===controller.mouseover(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the event will be targeted at
|}
Sends the "mouseover" (mouse drug over an element) event to the element object.
 
===controller.mouseout(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the event will be targeted at
|}
Sends the "mouseout" (mouse drug off an element) event to the element object.
 
===controller.check(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the event will be targeted at
|}
Causes the element to be "checked" if it is a checkbox.  If it is not a checkbox, it causes a click on the element.
 
===controller.radio(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the event will be targeted at
|}
Selects a radio button element. If the element is not a radio button entry, then it causes a generic click against that element.
 
===controller.doubleclick(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the event will be targeted at
|}
Causes a doubleclick event to be fired at the element object.
 
== Browser Shortcut Action APIs ==
===controller.goBack()===
Causes the browser to go back one step in history.
 
===controller.goForward()===
Causes the browser to go forward one step in history.
 
===controller.refresh()===
Causes the browser to refresh the current document.
 
== Wait APIs ==
 
== Assert APIs ==
Use these APIs to test see if certain properties are true on given elements.  Think of it as asserting that some statement about the page in question is true.
 
===controller.assertText(el, text)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the assert will verify
|-
|text
|The text that the element must have within it.
|}
Returns True if the text exists in the given element, false otherwise.
 
===controller.assertNode(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the assert will verify the existence of
|}
Returns true if the node in question exists, false otherwise.
 
===controller.assertValue(el, value)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the assert will verify the existence of
|-
|value
|The value that the element should have
|}
Returns true if the node in question contains the provided value. (i.e. checked, selected etc)
 
===controller.assertJS(js)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|js
|Assert
|}
Executes a piece of javascript.  The javascript must return true or false.  And this will return that value as the return of the assert.
 
===controller.assertNode(el, value)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|A select element (a drop down)
|-
|value
|The value that is selected in the drop down.
|}
Returns true if the currently selected item is equal to the given value
 
===controller.assertChecked(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An checkbox element
|}
Returns true if the node in question is checked, false otherwise.
 
===controller.assertProperty(el, attrib, value)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An element that the assert will work with
|-
|attrib
|The name of the attribute that we wish to check
|-
|value
|The value we expect that attribute to have
|}
Returns true if the element's "attrib" property has the specified value, false otherwise.
 
===controller.assertImageLoaded(el)===
{| class="standard-table"
|-
|class="header"|Parameters
|-
|el
|An image to check
|}
Returns true if the given image is loaded, false otherwise

Latest revision as of 05:44, 2 March 2009

All Mozmill (aka Gristmill in the early days) documentation is now on QMO.