Cookie - test subject

The cookie test subject represents a web cookie that an application may consume.


Usage

With the cookie test subject you can validate the presence or value of a particular cookie. This subject is only available for HTML based platforms.

In Test Editor:

Check that the Google Analytics cookies have been set. Suitest will automatically fill in the value once you specify the cookie name.
Check that the Google Analytics cookies have been set. Suitest will automatically fill in the value once you specify the cookie name.

In the Suitest JavaScript API use the cookie subject:

await suitest.assert.cookie('_ga').exists();
await suitest.assert.cookie('_gid').equals('12345');

Validates if the cookie specified by a name currently exists.

In Test Editor:

Check that the Google Analytics cookies exists.
Check that the Google Analytics cookies exists.

In JavaScript API:

await suitest.assert.cookie('_ga').exists();

The following built-in methods are available:

  • is equal, is not equal - checks if the cookie value is strictly equal not equal to the expected value.

  • contains, does not contain, starts with, ends with - checks if the cookie value contains a specified type of a substring.

  • matches JS - runs a JavaScript function and passes in the cookie value as argument. The JavaScript function is executed on the connected device inside the running application.

Additionally, with JavaScript API you can collect the cookie value and process it further in your test.

await suitest.assert.cookie('_gid').equals('12345');