Skip to main content

Wait

The Wait class provides a convenient way to wait for a batch job to finish.

Extends

This class extends the abstract Action class from Core.

Methods

performAs

public async performAs(actor: Actor): Promise<boolean>;
  • Description: Wait for batch job to finish.
  • Parameters:
    • actor - The actor performing the action.
  • Returns: Promise<boolean> - The response.

forJobFinished

Introduced in: 1.0.0

public static forJobFinished(jobId, options): Wait;
  • Description: Create a new instance of the Wait class with the specified job id and optional options. The default timeout is 30000 (30sec).
  • Parameters:
    • jobId - The job id.
    • options - The job status check options (optional)
  • Returns: Wait - A new instance of the Wait class.

Usage:

await actor.attemptsTo(
Wait.forJobFinished('myJobId', { timeout: 30000, delayBetweenRetries: 500 }),
);

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