Stage
Implements
Index
Constructors
constructor
Parameters
cast: Cast
manager: StageManager
errors: ErrorFactory
clock: Clock
interactionTimeout: Duration
Returns Stage
Methods
theActorCalled
An alias for Stage.actor
Parameters
name: string
Returns Actor
actor
theActorInTheSpotlight
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.
Returns Actor
theShowHasStarted
Returns
true
if there is an Actor in the spotlight,false
otherwise.Returns boolean
engage
Configures the Stage to prepare Actors instantiated via Stage.actor using the provided Cast.
Parameters
actors: Cast
Returns void
assign
Assigns listeners to be notified of DomainEvents emitted via Stage.announce.s
Parameters
rest...listeners: ListensToDomainEvents[]
Returns void
announce
Notifies all the assigned listeners of the events, emitting them one by one.
Parameters
rest...events: DomainEvent[]
Returns void
currentTime
Returns current time. This method should be used whenever DomainEvent objects are instantiated by you programmatically.
Returns Timestamp
assignNewSceneId
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
- Stage.currentSceneId
- CorrelationId
Returns CorrelationId
currentSceneId
Returns CorrelationId
assignNewActivityId
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
activityDetails: ActivityDetails
Returns CorrelationId
currentActivityId
Returns CorrelationId
waitForNextCue
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>
createError
Type parameters
- RE: RuntimeError<RE>
Parameters
errorType: new (...args: any[]) => RE
options: ErrorOptions
Returns RE
Stage is the place where actors perform.
In more technical terms, the Stage is the main event bus propagating DomainEvents to Actors it instantiates and StageCrewMembers 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