fixture Function

Declares a fixture.

fixture( fixtureName ) → this
fixture `fixtureName` → this
ParameterTypeDescription

fixtureName

String

The name of the fixture.

This function returns a fixture object that allows you to configure that fixture. Use this object to specify the start webpage, metadata, and the initialization and clean-up code for tests included in the fixture.

fixture `Authentication tests`
    .page `https://devexpress.github.io/testcafe/`
    .beforeEach(async t => {
        await t.click('#button');
    });

Use the test global function to declare tests in this fixture.

You can also import the fixture into your test file.

import { fixture } from 'testcafe';

fixture `My Fixture`
    .page("http://devexpress.github.io/testcafe/example");

test('Click a button', async t => {
    await t.click('#button');
});