Re-configures Serenity/JS with a new cast of actors
you want to use in any subsequent calls to actorCalled.
This function is an alias for Serenity.engage,
which provides an alternative to calling Actor.whoCan directly in your tests
and is typically invoked in a "before all" or "before each" hook of your test runner of choice.
configure vs engage
Calling engage replaces the currently configured cast of actors,
but doesn't affect any other configuration.
If you want to reset the Serenity/JS configuration completely, use configure instead.
If your implementation of the cast interface is stateless,
you can invoke this function just once before your entire test suite is executed, see
import{ Actor, Cast }from'@serenity-js/core'; classActorsimplementsCast{ prepare(actor: Actor){ return actor.whoCan( // ... abilities you'd like the Actor to have ); } } engage(newActors());
Re-configures Serenity/JS with a new cast of actors you want to use in any subsequent calls to
actorCalled.This function is an alias for
Serenity.engage, which provides an alternative to callingActor.whoCandirectly in your tests and is typically invoked in a "before all" or "before each" hook of your test runner of choice.Calling
engagereplaces the currently configured cast of actors, but doesn't affect any other configuration. If you want to reset the Serenity/JS configuration completely, useconfigureinstead.If your implementation of the cast interface is stateless, you can invoke this function just once before your entire test suite is executed, see
beforeAllin Jasmine,beforein Mocha,BeforeAllin Cucumber.jsHowever, if your cast holds state that you want to reset before each scenario, it's better to invoke
engagebefore each test using:beforeEachin JasminebeforeEachin Mocha,Beforein Cucumber.jsEngaging a cast of actors
Using with Mocha test runner
Using with Jasmine test runner
Using with Cucumber.js test runner
Engage
Actorsbefore each test scenario:Engage
Actorsbefore scenarios with specific tags:Using with Playwright Test runner
Serenity/JS Playwright Test module will configure the cast on your behalf, so you don't need to call
engage.Learn more
ActorCastSerenity.engage