TestCafe Object

A TestCafe server instance.

To create it, use the createTestCafe function.

The TestCafe object creates test runners that launch tests and browser connections for remote testing.

Method Description
createBrowserConnection Creates a remote browser connection.
createRunner Creates a test runner that is used to configure and launch test tasks.
createLiveModeRunner Creates a test runner that runs TestCafe in live mode.
close Stops the TestCafe server.


const createTestCafe = require('testcafe');

const testcafe          = await createTestCafe('localhost', 1337, 1338);
const browserConnection = await testcafe.createBrowserConnection();

await new Promise(resolve => browserConnection.once('ready', resolve));

const runner      = testcafe.createRunner();
const failedTests = await runner
    .src(['tests/fixture1.js', 'tests/func/fixture3.js'])
    .browsers([browserConnection, 'safari'])