Declares a test.
test(title, body)
test(title, details, body)
Usage
import { test, expect } from '@playwright/test';
test('basic test', async ({ page }) => {
await page.goto('https://playwright.dev/');
// ...
});
Tags
You can tag tests by providing additional test details. Alternatively, you can include tags in the test title. Note
that each tag must start with @
symbol.
import { test, expect } from '@playwright/test';
test('basic test', {
tag: '@smoke',
}, async ({ page }) => {
await page.goto('https://playwright.dev/');
// ...
});
test('another test @smoke', async ({ page }) => {
await page.goto('https://playwright.dev/');
// ...
});
Test tags are displayed in the test report, and are available to a custom reporter via TestCase.tags
property.
You can also filter tests by their tags during test execution:
Learn more about tagging.
Annotations
You can annotate tests by providing additional test details.
import { test, expect } from '@playwright/test';
test('basic test', {
annotation: {
type: 'issue',
description: 'https://github.com/microsoft/playwright/issues/23180',
},
}, async ({ page }) => {
await page.goto('https://playwright.dev/');
// ...
});
Test annotations are displayed in the test report, and are available to a custom reporter via
TestCase.annotations
property.
You can also add annotations during runtime by manipulating testInfo.annotations.
Learn more about test annotations.
Test title.
Additional test details.
Test body that takes one or two arguments: an object with fixtures and optional TestInfo.
Generated using TypeDoc
Declares a test.
test(title, body)
test(title, details, body)
Usage
Tags
You can tag tests by providing additional test details. Alternatively, you can include tags in the test title. Note that each tag must start with
@
symbol.Test tags are displayed in the test report, and are available to a custom reporter via
TestCase.tags
property.You can also filter tests by their tags during test execution:
Learn more about tagging.
Annotations
You can annotate tests by providing additional test details.
Test annotations are displayed in the test report, and are available to a custom reporter via
TestCase.annotations
property.You can also add annotations during runtime by manipulating testInfo.annotations.
Learn more about test annotations.