Assertions and Test subjects

This part of user documentation is describing an obsolete version 2.5.* (or older) of Suitest JavaScript API and is meant only for users who have not yet switched to the version 3. If you are new to Suitest JavaScript API, please use the version 3 instead.

Suitest lets you inspect different objects inside the application and provides flexible ways to create assertions about the object's properties. This is done with the use of different test subjects combined with chain modifiers.

List of assertions and test subjects:


application() defines an Application subject. Needs to be combined with hasExited.

 * @returns {ChainablePromise.<void|boolean>}
async function application() {}

// Check if application has exited
const ApplicationHasExited = await suitest.application().hasExited();

cookie() defines a Cookie subject.

 * @param {string} name - cookie name
 * @returns {ChainablePromise.<void|boolean|string>}
async function cookie(name) {}

const cookieValue = await suitest.cookie('cookieName');


element() defines a View element subject.

The element apiId can be found in the element repository.

 * @param {string} apiId - Api ID of the element from Element Repository
async function element(apiId) {}

 * @param {string} [css] - CSS selector, e.g. ”#elementID > .child-element”
 * @param {string} [xpath] - XPath selector. Note that not all platforms support XPath
 * @param {number} [index] - which element should be taken when more then one match found
 * @param {string} [attributes] - select element by it's attributes
 * @param {string} [text] - select element by inner text
 * @param {string} [position] - select element by it's position
 * @param {string} [size] - select element by it's size
 * @param {string} [color] - select element by color
 * @param {boolean} [video] - select video element
 * @returns {ChainablePromise.<void|boolean|Object>}
async function element({css, xpath, index, attributes, text, position, size, color, video}) {}

// Look up element by API ID in Element Repository
const elementProps = await suitest.element('ElementApiID');

// Look up element by complex selector. All keys are optional, but at least one must exist
const elementProps = await suitest.element({
    css: 'css selector',
    xpath: 'xpath selector',
    index: 1,


jsExpression() defines a JavaScript expression subject.

 * @param {string|Function} expression - source to be executed on device
 * @returns {ChainablePromise.<void|boolean|string>}
async function jsExpression(expression) {}

// Parameter passed as string
const evaluationResult = await suitest.jsExpression('1+2');

// Parameter passed as JS function. Executed on device in a global scope
const evaluationResult = await suitest.jsExpression(function () {return 1 + 2;});


location() defines a Current location subject.

 * @returns {ChainablePromise.<void|boolean|string>}
async function location() {}

const currentLocation = await suitest.location();


networkRequest() defines a Network request subject. Used in conjunction with .wasMade(), .willBeMade(), requestMatches() and responseMatches chain modifiers.

 * @returns {ChainablePromise.<void|boolean>}
async function networkRequest(target, req, res, countPrevious) {}

// Find POST to with response status 200 only in new logs
const requestWillBeMade = await suitest.networkRequest()
    .requestMatches(suitest.NETWORK_PROP.METHOD, suitest.NETWORK_METHOD.POST)
    .responseMatches(suitest.NETWORK_PROP.STATUS, 200)


position() defines the position subject, takes coordinates as x and y axis for position on subject.

 * Define position subject
 * @param {number} x - horizontal position
 * @param {number} y - vertical position
 * @returns {ChainablePromise.<void|boolean>}
async function position(x, y) {}

// Click on position
await suitest.position(100, 200)


runTest() runs a test that is defined and saved inside of the normal Suitest Test editor. Test is ran based on test ID. The test ID can be found inside the Test editor.

Beware of the version change list

For interactive mode, the unapplied change list is included. However, in automated mode only applied changes are used.

// Run test once
await suitest.assert.runTest('test-id');

// Run test exactly 5x
await suitest.assert.runTest('test-id').repeat(5);

// Run test until ... max 5x
await suitest.assert.runTest('test-id').until(

// Run test only if ...
if (suitest.location.equals('')) {
    await suitest.assert.runTest('test-id');


video() defines a Video subject.

 * Look up video element
 * @returns {ChainablePromise.<void|boolean|Object>}
async function video() {}

// Look up video element
const elementProps = await;


window() defines the current window subject, needs to be combined with chain methods and test operation browser commands.

// Current browser window
async function window() {}

//for example - refresh the current browser window
await suitest.window().refresh();