Skip to main content

afterAll

Callable

  • afterAll(inner: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, actors> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => any): void
  • afterAll(title: string, inner: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, actors> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => any): void

  • Declares an afterAll hook that is executed once per worker after all tests.

    When called in the scope of a test file, runs after all tests in the file. When called inside a test.describe([title, details, callback]) group, runs after all tests in the group.

    Details

    When multiple afterAll hooks are added, they will run in the order of their registration.

    Note that worker process is restarted on test failures, and afterAll hook runs again in the new worker. Learn more about workers and failures.

    Playwright will continue running all applicable hooks even if some of them have failed.

    • test.afterAll(hookFunction)
    • test.afterAll(title, hookFunction)

    Usage

    test.afterAll(async () => {
    console.log('Done with tests');
    // ...
    });

    Alternatively, you can declare a hook with a title.

    test.afterAll('Teardown', async () => {
    console.log('Done with tests');
    // ...
    });

    Parameters

    • inner: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, actors> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => any

    Returns void