Fixture.after Method

Defines the after fixture hook. The after fixture hook runs after the completion of the final test in the fixture.

fixture.after( fn(ctx) ) → this
Parameter Type Description
fn Function An asynchronous hook function that contains the hook code.
ctx Object A fixture context object used to share variables between fixture hooks and test code.

Fixture hooks run between tests and, as such, cannot access the browser. Use them to perform server-side operations. To perform browser operations before and after tests, use test hooks.

Use the fixture.before hook to execute code before the first fixture test.

import { utils } from './my-utils.js';

fixture `My fixture`
    .page `http://example.com`
    .after( async ctx => {
        utils.dropDb(ctx.dbName);
    });