test Function

Declares a test.

test( testName, fn(t) ) → this
ParameterTypeDescription

testName

String

The test name.

fn

Function

An asynchronous function that contains test code.

t

Object

The test controller used to access the test run API.

fixture `My Fixture`;

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

test('Type something', async t => {
    await t.typeText('#comment', 'I love TestCafe')
});

Use the fixture global function to declare fixtures.

You can also import the test object into your test file.

import { test } from 'testcafe';

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

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