Cookie - test subject¶
- Android - WebView apps
- Browsers
- HbbTV / Freeview Play
- LG webOS
- PlayStation 4/5
- Samsung Tizen
- Vizio SmartCast
- Xbox (One, Series X/S) - HTML apps
- Other Smart TVs and STBs - HTML apps
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:
In the Suitest JavaScript API use the cookie subject:
await suitest.assert.cookie('_ga').exists();
await suitest.assert.cookie('_gid').equals('12345');
Built-in cookie operations¶
Validating cookie existence¶
Validates if the cookie specified by a name currently exists.
In Test Editor:
In JavaScript API:
await suitest.assert.cookie('_ga').exists();
Validating cookie value¶
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');