externaldescribe
Callable
Parameters
externaltitle: string
externalcallback: () => void
Returns void
Index
Properties
externalonly
Declares a focused group of tests. If there are some focused tests or suites, all of them will be run but nothing else.
Usage
test.describe.only('focused group', () => {
test('in the focused group', async ({ page }) => {
// This test will run
});
});
test('not in the focused group', async ({ page }) => {
// This test will not run
});
externalskip
Declares a skipped test group, similarly to test.describe(title, callback). Tests in the skipped group are never run.
Usage
test.describe.skip('skipped group', () => {
test('example', async ({ page }) => {
// This test will not run
});
});
externalfixme
Declares a test group similarly to test.describe(title, callback). Tests in this group are marked as "fixme" and will not be executed.
Usage
test.describe.fixme('broken tests', () => {
test('example', async ({ page }) => {
// This test will not run
});
});
externalserial
NOTE See test.describe.configure([options]) for the preferred way of configuring the execution mode.
Declares a group of tests that should always be run serially. If one of the tests fails, all subsequent tests are skipped. All tests in a group are retried together.
NOTE Using serial is not recommended. It is usually better to make your tests isolated, so they can be run independently.
Usage
test.describe.serial('group', () => {
test('runs first', async ({ page }) => {});
test('runs second', async ({ page }) => {});
});
externalparallel
NOTE See test.describe.configure([options]) for the preferred way of configuring the execution mode.
Declares a group of tests that could be run in parallel. By default, tests in a single test file run one after another, but using test.describe.parallel(title, callback) allows them to run in parallel.
Usage
test.describe.parallel('group', () => {
test('runs in parallel 1', async ({ page }) => {});
test('runs in parallel 2', async ({ page }) => {});
});
Note that parallel tests are executed in separate processes and cannot share any state or global variables. Each of the parallel tests executes all relevant hooks.
externalconfigure
Configures the enclosing scope. Can be executed either on the top level or inside a describe. Configuration applies to the entire scope, regardless of whether it run before or after the test declaration.
Learn more about the execution modes here.
Usage
- Running tests in parallel.
// Run all the tests in the file concurrently using parallel workers.
test.describe.configure({ mode: 'parallel' });
test('runs in parallel 1', async ({ page }) => {});
test('runs in parallel 2', async ({ page }) => {}); - Running tests serially, retrying from the start.
NOTE Running serially is not recommended. It is usually better to make your tests isolated, so they can be
run independently.
// Annotate tests as inter-dependent.
test.describe.configure({ mode: 'serial' });
test('runs first', async ({ page }) => {});
test('runs second', async ({ page }) => {}); - Configuring retries and timeout for each test.
// Each test in the file will be retried twice and have a timeout of 20 seconds.
test.describe.configure({ retries: 2, timeout: 20_000 });
test('runs first', async ({ page }) => {});
test('runs second', async ({ page }) => {}); - Run multiple describes in parallel, but tests inside each describe in order.
test.describe.configure({ mode: 'parallel' });
test.describe('A, runs in parallel with B', () => {
test.describe.configure({ mode: 'default' });
test('in order A1', async ({ page }) => {});
test('in order A2', async ({ page }) => {});
});
test.describe('B, runs in parallel with A', () => {
test.describe.configure({ mode: 'default' });
test('in order B1', async ({ page }) => {});
test('in order B2', async ({ page }) => {});
});
Type declaration
Parameters
externaloptions: { mode?: default | parallel | serial; retries?: number; timeout?: number }
externaloptionalmode: default | parallel | serial
externaloptionalretries: number
externaloptionaltimeout: number
Returns void
Declares a group of test scenarios.
Example
Learn more
describe
function