fixture Function

Declares a fixture.

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

fixtureName

String

The name of the fixture.

The fixture function returns a Fixture object. A fixture is a group of tests with the same starting URL. Every test belongs to a fixture.

The Fixture object offers methods that configure the following:

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

To populate the fixture with tests, use the test function.

You can also import the fixture into your test file.

import { fixture } from 'testcafe';

fixture`Fixture import`
    .page('https://devexpress.github.io/testcafe/example');

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