Cookie - test subject

  • Android - WebView apps
  • Browsers
  • HbbTV / Freeview Play
  • LG webOS
  • NextGen TV / ATSC 3.0
  • PlayStation 4/5
  • Samsung Tizen
  • Sky
  • VIDAA
  • Vizio SmartCast
  • Xbox (One, Series X/S) - HTML apps
  • Xfinity / Xumo TV / XClass TV
  • Xumo (Entertainment OS)
  • 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:

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');

3rd party cookies

  • LG webOS - Lite
  • Samsung Tizen - Lite
  • Sky - Lite
  • VIDAA - Lite
  • Xfinity / Xumo TV / XClass TV - Lite
  • Xumo (Entertainment OS) - Lite

With the extensive features of our Lite solution, you can validate more details of cookies as well as check the 3rd party cookies.

For given platforms, Suitest supports the following properties:

  • value
  • domain
  • path
  • httpOnly flag
  • secure flag

In Test editor:

Asserting cookie properties

In the Suitest JavaScript API you can also validate values of defined properties:

// extended cookie validation
await suitest.cookie('cookieName').withProperties([
    {
        property: suitest.COOKIE_PROP.DOMAIN,
        val: 'the.suite.st',
        type: suitest.COMP.START,
    },
    {
        property: suitest.COOKIE_PROP.VALUE,
        val: 'tested value',
        type: suitest.COMP.END
    }
])

Validates if the cookie specified by a name currently exists.

In Test editor:

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');