Skip to content

How to create and use a custom ability #2740

Closed Answered by jan-molak
tomknee-accelins asked this question in How to... ?
Discussion options

You must be logged in to vote

Playwright Test uses fixtures to inject dependencies into test scenarios. Serenity/JS leverages this mechanism to configure the framework's object graph, so the top-level serenity object, as well as the cast of actors and so on. With Playwright Test, each worker process receives its own instance of the serenity object graph.

The engage function is intended to support test runners such as Mocha, Jasmine or Cucumber that don't offer any built-in dependency injection mechanisms. This function configures a global instance of the serenity object.

The configuration from the example doesn't work because beforeEach configures a global instance of serenity, while the test uses has its own instance.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by jan-molak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants