Skip to main content

Setup fixtures

Extend with custom fixtures​

Define your custom fixtures in a separate file and extend test from playwright-webext. This makes extension available alongside your custom fixtures. See Playwright's fixture guide for defining fixtures.

test/fixtures.ts
import { test as base } from 'playwright-webext';

export const test = base.extend({
// ...custom fixtures
});

Import your extended test from this file in your tests.

See the example’s page and background fixtures and tests that use them.

Combine fixtures with mergeTests​

Use Playwright's mergeTests() to combine fixtures from multiple packages:

test/fixtures.ts
import { mergeTests } from '@playwright/test';
import { test as base } from 'some-playwright-package';
import { test as baseWebext } from 'playwright-webext';

export const test = mergeTests(base, baseWebext).extend({
// ...custom fixtures
});