java.lang.Object
net.serenitybdd.screenplay.actors.OnStage
The stage is used to keep track of the actors taking part in a Screenplay test.
It is useful if you don't keep track of the actors explicitly, but just refer to them by name, as is often done
in Cucumber scenarios.
Actors can be referred to by name (which must be unique for a given actor) or a pronoun.
The default pronouns are "he","she","they" and "it", and they are used interchangeably - any pronoun will always
refer to last named actor who performed some action.
Pronouns can be configured using the screenplay.pronouns property, e.g.
screenplay.pronouns = il,elle
The current stage is kept as a ThreadLocal object, so if you have multiple threads in the same Screenplay test,
you need to propagate the stage to each new thread using the setTheStage() method.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ActorCreate a new actor whose name is not yet known.static voidPerform any cleanup actions on each actor on the stage.static StagesetTheStage(Cast cast) Set the stage before calling the actorsstatic StagesetTheStage(Stage stage) Set the stage to a specific stage object.static Stagestage()Get the current stage.static ActorA shorter version of "theActorCalled()"static ActortheActorCalled(String requiredActor) Returns an actor with a given name, creating a new actor if the actor is not already on stage.static ActorThe actor in the spotlight is the last actor on the stage who has performed any activity.static booleanCheck whether the stage has already been set.static voidwithCurrentActor(Performable... performTasks) A shorter version of "theActorInTheSpotlight().attemptsTo(...)"
-
Constructor Details
-
OnStage
public OnStage()
-
-
Method Details
-
setTheStage
Set the stage before calling the actors -
theStageIsSet
public static boolean theStageIsSet()Check whether the stage has already been set. -
setTheStage
Set the stage to a specific stage object. This is rarely needed but sometimes comes in handy when running tasks in parallel. -
theActorCalled
Returns an actor with a given name, creating a new actor if the actor is not already on stage. If a pronoun is used (e.g "she creates a new account") then the current actor in the spotlight will be used. -
aNewActor
Create a new actor whose name is not yet known. The next time the theActorCalled() method is used, this name will be assigned to this actor. -
theActor
A shorter version of "theActorCalled()" -
theActorInTheSpotlight
The actor in the spotlight is the last actor on the stage who has performed any activity. -
withCurrentActor
A shorter version of "theActorInTheSpotlight().attemptsTo(...)" -
stage
Get the current stage. Rarely needed for non-internal use, except when running tasks in parallel. In that case, you will need to call OnStage.setTheStage(stage) in each parallel thread if you use OnStage methods such as theActorInTheSpotlight() -
drawTheCurtain
public static void drawTheCurtain()Perform any cleanup actions on each actor on the stage. This calls the `wrapUp()` method if defined on each actor on the stage.
-