Fixture.afterEach Method

Executes the code after each test in the fixture finishes (the after each fixture hook).

fixture.afterEach( fn(t) ) → this
Parameter Type Description
fn Function An asynchronous hook function that contains the hook code.
t Object The test controller used to access test run API.

If a test runs in several browsers, the hook is executed in each browser.

When the hook runs, the tested webpage is already loaded, and you can use test actions and other test run API inside the hook.

If test.after is specified, it overrides the corresponding fixture.afterEach, and the latter is not executed.

fixture `My fixture`
    .page `http://example.com`
    .afterEach( async t => {
        await t.click('#delete-data');
    });

To specify code executed before each test in the fixture, use fixture.beforeEach.