externalSerenityFixtures
Index
Properties
Properties
externalserenity
Retrieves the root object of the Serenity/JS framework.
externalplatform
Name and version of the operating system that Playwright Test worker process runs on.
Type declaration
externalname: string
externalversion: string
externalactors
A cast of Serenity/JS actors to be used instead of the default cast
when instantiating actor
and invoking actorCalled
.
Overriding the default cast of Serenity/JS actors
import { Cast, TakeNotes } from '@serenity-js/core'
import { Ensure, equals } from '@serenity-js/assertions'
import { BrowseTheWebWithPlaywright } from '@serenity-js/playwright'
import { describe, it, test } from '@serenity-js/playwright-test'
describe(`Recording items`, () => {
test.use({
defaultActorName: 'Serena',
actors: ({ browser, contextOptions }, use) => {
const cast = Cast.where(actor =>
actor.whoCan(
BrowseTheWebWithPlaywright.using(browser, contextOptions),
TakeNotes.usingAnEmptyNotepad(),
)
)
// Make sure to pass your custom cast to Playwright `use` callback
use(cast)
},
})
describe(`Todo List App`, () => {
it(`should allow me to add a todo item`, async ({ actor }) => {
await actor.attemptsTo(
startWithAnEmptyList(),
recordItem('Buy some milk'),
Ensure.that(itemNames(), equals([
'Buy some milk',
])),
)
})
})
})
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
SerenityOptions.actors
SerenityFixtures.actors
Type declaration
Parameters
externalname: string
Returns Actor
externalactor
Default actor
injected into a test scenario.
Using actor
fixture is equivalent to invoking actorCalled
with defaultActorName
.
Learn more
actorCalled
SerenityOptions.defaultActorName
- Declaring a Serenity/JS test scenario
Serenity/JS-specific Playwright Test fixtures injected into your test scenarios.
Example test scenario
Learn more