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 hook code. |
ctx |
Object | A fixture context object used to share variables between fixture hooks and test code. |
Fixture hooks run in between tests. They cannot access the browser and execute page actions. Use fixture hooks to perform server-side operations (e.g. manage database entries). To perform browser operations before and after tests, use test hooks.
Use the fixture.before hook to execute code before the first test in the fixture.
import { db } from './my-utils.js';
fixture`Fixture.after`
.page`https://devexpress.github.io/testcafe/example/`
.after(async ctx => {
db.push(ctx.db.name);
});