Add
The Add class is an action class in the Screenplay pattern designed for use with the @testla/screenplay library. This class allows actors to add cookies to the browser using the BrowseTheWeb ability provided by Testla.
Extends
This class extends the abstract Action class from Core.
Methods
performAs
public performAs(actor: Actor): Promise<any>;
- Description: Adds the cookies to the browser using the
BrowseTheWebability. - Parameters:
actor- The actor performing this action.
- Returns:
Promise<any>- Returns a promise that resolves after adding the cookies into the browser context.
cookies
public static cookies(cookies: Cookie[]): Add;
- Description: Creates a new instance of the
Addclass with the specified cookies. - Parameters:
cookies- The cookies to add.
- Returns:
Add- Returns a newAddinstance.
Methods inherited from Core Action
orSkipOnFail
Introduced in core: 0.5.0
public get orSkipOnFail(): Action;
- Description: Allows to skip an action on fail.
- Returns:
Action- Returns the current action.
Usage:
// Would skip the step on error without breaking the execution
await actor.attemptsTo(
Do.something().orSkipOnFail,
);
withAbilityAlias
Introduced in core: 0.3.0
public withAbilityAlias(alias: string): Action;
- Description: Defines the ability alias to be used during execution.
- Parameters:
alias- The alias.
- Returns:
Action- Returns the current action.
Usage:
await actor.attemptsTo(
Do.something().withAbilityAlias('myAlias'),
);