Skip to main content

externalStage

Stage is the place where actors perform.

In more technical terms, the Stage is the main event bus propagating Serenity/JS domain events to actors it instantiates and stage crew members that have been registered with it.

It is unlikely that you'll ever need to interact with the Stage directly in your tests. Instead, you'll use functions like actorCalled and actorInTheSpotlight.

Learn more

Implements

Index

Constructors

externalconstructor

Properties

publicstaticexternalreadonlyunknownSceneId

unknownSceneId: CorrelationId = ...

Methods

externaltheActorCalled

  • theActorCalled(name: string): Actor

externalactor

  • actor(name: string): Actor
  • Instantiates a new Actor or fetches an existing one identified by their name if they've already been instantiated.


    Parameters

    • externalname: string

      Case-sensitive name of the Actor, e.g. Alice

    Returns Actor

externaltheActorInTheSpotlight

  • theActorInTheSpotlight(): Actor
  • Returns the last Actor instantiated via Stage.actor. Useful when you don't can't or choose not to reference the actor by their name.

    @throws

    LogicError If no Actor has been activated yet


    Returns Actor

externaltheShowHasStarted

  • theShowHasStarted(): boolean
  • Returns true if there is an Actor in the spotlight, false otherwise.


    Returns boolean

externalengage

  • engage(actors: Cast): void
  • Configures the Stage to prepare actors instantiated via Stage.actor using the provided cast.


    Parameters

    • externalactors: Cast

    Returns void

externalassign

externalannounce

  • Notifies all the assigned listeners of the events, emitting them one by one.


    Parameters

    Returns void

externalcurrentTime

  • Returns current time. This method should be used whenever DomainEvent objects are instantiated by you programmatically.


    Returns Timestamp

externalassignNewSceneId

  • assignNewSceneId(): CorrelationId
  • Generates and remembers a CorrelationId for the current scene.

    This method should be used in custom test runner adapters when instantiating a SceneStarts event.

    Learn more


    Returns CorrelationId

externalcurrentSceneId

  • currentSceneId(): CorrelationId
  • Returns the CorrelationId for the current scene.

    Learn more


    Returns CorrelationId

externalassignNewActivityId

  • assignNewActivityId(activityDetails: ActivityDetails): CorrelationId
  • Generates and remembers a CorrelationId for the current Activity.

    This method should be used in custom test runner adapters when instantiating the ActivityStarts event.

    Learn more


    Parameters

    • externalactivityDetails: ActivityDetails

    Returns CorrelationId

externalcurrentActivityId

  • currentActivityId(): CorrelationId

externalwaitForNextCue

  • waitForNextCue(): Promise<void>
  • Returns a Promise that will be resolved when any asynchronous post-processing activities performed by Serenity/JS are completed.

    Invoked in Serenity/JS test runner adapters to inform the test runner when the scenario has finished and when it's safe for the test runner to proceed with the next test, or finish execution.


    Returns Promise<void>

externalcreateError

  • createError<RE>(errorType: new (...args: any[]) => RE, options: ErrorOptions): RE
  • Type parameters

    Parameters

    • externalerrorType: new (...args: any[]) => RE
      • externaloptions: ErrorOptions

      Returns RE