Function _baseTest

  • 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.

    Parameters

    • title: string

      Test title.

    • body: ((args, testInfo) => void | Promise<void>)

      Test body that takes one or two arguments: an object with fixtures and optional TestInfo.

        • (args, testInfo): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    Returns void

  • 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.

    Parameters

    • title: string

      Test title.

    • details: TestDetails

      Additional test details.

    • body: ((args, testInfo) => void | Promise<void>)

      Test body that takes one or two arguments: an object with fixtures and optional TestInfo.

        • (args, testInfo): void | Promise<void>
        • Parameters

          Returns void | Promise<void>

    Returns void

Generated using TypeDoc