UtilsAPI

The UtilsAPI offers various helper functions for any other API which is not already covered by another shared module.

Class overview

Class Name      Description
appInfo Wrapper class which provides information about the host application (see nsIXULAppInfo)

Method overview

assertElementVisible(in MozMillController controller, in ElemBase element, in boolean visibility)
assertLoadedUrlEqual(in MozMillController controller, in string targetUrl)
checkSearchField(in MozMillController controller, in ElemBase searchField, in string searchTerm,
                 in ElemBase submitButton, number timeout)
closeContentAreaContextMenu(in MozMillController controller)
nsIURI createURI(in string spec, in string originCharset, in string baseURI)
formatUrlPref(in string prefName)
string getEntity(in string [urls], in string entityId)
string getProperty(in string url, in string prefName)

Methods

assertElementVisible()

Assert if the visibility state of the element is equal with the expected state.

assertElementVisible(
  in MozmillController controller,
  in ElemBase element,
  in boolean visibility
); 
Parameters
controller
MozMillController of the window to operate on.
element
Element which visibility has to be checked.
visibility
Expected visibility state of the element.

assertLoadedUrlEqual()

Assert if the current URL is identical to the expected URL. This function loads the target URL first to also test for redirects.

assertLoadedUrlEqual(
  in MozmillController controller,
  in string targetUrl
);
Parameters
controller
MozMillController of the window to operate on.
targetUrl
URL which should be open.

checkSearchField()

Run tests against the given search form. An Exception will be thrown if entering the search term or clicking the search button fails.

checkSearchField(
  in MozmillController controller,
  in ElemBase searchField,
  in string searchTerm,
  [in ElemBase submitButton],
  [in number timeout]
);
Parameters
controller
MozMillController of the window to operate on.
searchField
The HTML input form element to test.
searchTerm
The search term for the test.
submitButton
The form submit button.
timeout
The timeout value for the single tests.

closeContentAreaContextMenu()

Close the context menu inside the content area of the currently open tab.

closeContentAreaContextMenu(
  in MozmillController controller
);
Parameters
controller
MozMillController of the window to operate on.

createURI()

Creates a new nsIURI instance from the given URL which is often needed to run bookmark related tests.

nsIURI createURI(
  in string spec,
  in string originCharset,
  in string baseURI
); 
Parameters
spec
The URI string in UTF-8 encoding.
originCharset
The charset of the document from which this URI string originated.
baseURI

If null, spec must specify an absolute URI. Otherwise, spec may be resolved relative to baseURI, depending on the protocol.

formatUrlPref()

Format an URL which gets retrieved from a preference and contains placeholders for the product, version, and platform to a final URL.

formatUrlPref(
  in string prefName
);
Parameters
preference
Name of the preference which contains the URL with placeholders.

getEntity()

Get the value of an individual entity. This function can be used to retrieve localized values for ui elements which are located inside DTD files.

getProperty(
  in string [urls],
  in string entityId
);
Parameters
urls
Array of the URLs of the DTDs containing the entity as well as relevant external entities.
entityId
ID of the entity whose value is to be retrieved.

getProperty()

Get the value of an individual property. This function can be used to retrieve localized values for ui elements which are located inside property files.

getProperty(
  in string url,
  in string prefName
);
Parameters
url
URL of the string bundle.
prefName
Name of the property whose value is to be retrieved.

Document Tags and Contributors

 Contributors to this page: Sheppy, Adrianer, Whimboo, Ctalbert, fscholz
 Last updated by: Sheppy,