import {DeleteCookies} from '@serenity-js/protractor/lib/screenplay/interactions'
public class | source

DeleteCookies

Instructs the Actor to remove cookies from the browser.

Examples:

Removing a single cookie
 import { actorCalled } from '@serenity-js/core';
 import { BrowseTheWeb, Navigate, DeleteCookies } from '@serenity-js/protractor';
 import { protractor } from 'protractor';

 actorCalled('Sid')
     .whoCan(BrowseTheWeb.using(protractor.browser))
     .attemptsTo(
         Navigate.to('/login'),
         DeleteCookies.called('jwt_token'),
         Navigate.reloadPage(),
     );
Removing all cookies before each Jasmine test
 import 'jasmine';

 import { actorInTheSpotlight } from '@serenity-js/core';
 import { DeleteCookies } from '@serenity-js/protractor';

 before(() =>
     actorInTheSpotlight().attemptsTo(
         DeleteCookies.all(),
     ));
Removing all cookies before each Mocha test
 import 'mocha';

 import { actorInTheSpotlight } from '@serenity-js/core';
 import { DeleteCookies } from '@serenity-js/protractor';

 before(() =>
     actorInTheSpotlight().attemptsTo(
         DeleteCookies.all(),
     ));
Removing all cookies before each Cucumber scenario
 import { actorInTheSpotlight } from '@serenity-js/core';
 import { DeleteCookies } from '@serenity-js/protractor';
 import { Before } from 'cucumber';

 Before(() =>
     actorInTheSpotlight().attemptsTo(
         DeleteCookies.all(),
     ));

See also:

Static Method Summary

Static Public Methods
public static

Removes any cookies set.

public static

called(cookieName: Answerable<string>): Interaction

Removes a single cookie identified by cookieName.

Static Public Methods

public static all(): Interaction source

Removes any cookies set.

Returns:

Interaction

public static called(cookieName: Answerable<string>): Interaction source

Removes a single cookie identified by cookieName.

Params:

NameTypeAttributeDescription
cookieName Answerable<string>

The name of the cookie to be deleted

Returns:

Interaction