Documentation
REFERENCE
Test.after Method
Executes the specified code after the test finishes (the after test hook).
test.after( 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 loaded, so that you can use test actions and other test run API inside the hook.
If
test.after
is specified, it overrides the corresponding fixture.after, so that the latter is not executed.
fixture `My fixture`
.page `http://example.com`;
test
.after( async t => {
await t.click('#delete-data');
})
('MyTest', async t => { /* ... */ });
To specify code executed before the test, use the test.before method.