Skip to main content

Pause

The Pause class is an useful action for introducing delays in test scenarios, allowing for better synchronization with the system under test. This performs the action of pausing the test execution for the specified interval.

This Action does not rely on a specific Ability.

Extends

This class extends the abstract Action class from Core.

Methods

performAs

public async performAs(): Promise<void>;
  • Description: Pause the execution of further test steps for the specified interval in milliseconds.
  • Parameters: None
  • Returns: Promise<void> - A promise that resolves when the pause is complete.

for

Introduced in: 1.0.0

public static for(ms: number): Pause;
  • Description: Create a new instance of the Pause class with a specified duration.
  • Parameters:
    • ms - The interval in milliseconds for which the test execution will be paused.
  • Returns: Pause - A new instance of the Pause class.

Usage:

// Pause further execution for 5 seconds
await actor.attemptsTo(
Pause.for(5000),
);

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