externalSerenityWorkerFixtures
Index
Properties
externalplatform
Information about the operating system platform where the Playwright Test worker process runs.
Returns an object with:
name- The platform name:'Windows','macOS', or'Linux'version- The OS version string fromos.release()
This information is used to tag test scenarios with platform metadata for reporting purposes.
Type declaration
externalname: string
externalversion: string
externalserenity
The root Serenity instance for this worker.
Provides access to the Serenity/JS framework for advanced use cases, such as:
- Announcing custom domain events
- Accessing the current time via
serenity.currentTime() - Configuring the framework programmatically
In most test scenarios, you won't need to interact with the serenity fixture directly.
Instead, use the actor
or actorCalled fixtures.
Learn more
externalactorCalled
Uses the provided cast of
actors to instantiate
an Actor called name
and inject it into a test scenario.
Retrieves an existing actor if one has already been instantiated.
Learn more
- Declaring a Serenity/JS test scenario
SerenityFixtures.actors
Type declaration
Parameters
externalname: string
Returns Actor
externalinteractionTimeout
The maximum default amount of time allowed for interactions such as Wait.until
to complete.
Defaults to 5 seconds, can be overridden per interaction.
Learn more
externalextraWorkerAbilities
Extra abilities given to actors at the worker scope, on top of the default ones
provided by the actors fixture.
Unlike extraAbilities,
which are test-scoped, extraWorkerAbilities persist across all tests within the same worker process.
This is useful for abilities that are expensive to create or that maintain state across tests.
Extra abilities for all actors
To give the same set of extra abilities to all the actors, provide an array of
Ability objects:
// playwright.config.ts
import type { SerenityFixtures, SerenityWorkerFixtures } from '@serenity-js/playwright-test'
import { defineConfig } from '@playwright/test'
import { MySharedAbility } from './MySharedAbility'
export default defineConfig<SerenityFixtures, SerenityWorkerFixtures>({
use: {
extraWorkerAbilities: [ new MySharedAbility() ],
},
})
Extra abilities for selected actors
To give extra abilities only to selected actors, provide a function that maps
the actor name to an array of Ability objects:
// playwright.config.ts
import type { SerenityFixtures, SerenityWorkerFixtures } from '@serenity-js/playwright-test'
import { defineConfig } from '@playwright/test'
import { MySharedAbility } from './MySharedAbility'
export default defineConfig<SerenityFixtures, SerenityWorkerFixtures>({
use: {
extraWorkerAbilities: (actorName: string) => {
return actorName === 'Admin'
? [ new MySharedAbility() ]
: [];
},
},
})
Learn more
extraAbilities- test-scoped extra abilitiesAbility
Serenity/JS-specific worker-scope Playwright Test fixtures injected into your test scenarios.
Example test scenario
Learn more