externaluseBase
Callable
Type parameters
- TestArgs: Record<string, any>
- WorkerArgs: Record<string, any> = object
Parameters
externalbaseTest: TestType<TestArgs, WorkerArgs>
Returns TestApi<Omit<SerenityOptions, actors> & SerenityFixtures & TestArgs, WorkerArgs>
Creates a Serenity/JS BDD-style test API around the given Playwright base test.
Using default configuration
When your test scenario doesn't require custom test fixtures, and you're happy with the default base test offered by Playwright, you can import test API functions such as
describe
andit
directly from@serenity-js/playwright-test
.In the above example, importing test API functions directly from
@serenity-js/playwright-test
is the equivalent of the following setup:Using custom fixtures
When your test scenario requires custom test fixtures, but you're still happy with the default base test offered by Playwright, you can create fixture-aware test API functions such as
describe
andit
by callinguseFixtures
.For example, you can create a test scenario using a static
message
fixture as follows:The value of your test fixtures can be either static or dynamic and based on the value of other fixtures.
To create a dynamic test fixture use the function syntax:
In the above example, creating test API functions via
useFixtures
is the equivalent of the following setup:Using custom base test
In cases where you need to use a non-default base test, for example when doing UI component testing, you can create Serenity/JS test API functions around your preferred base test.