Easy Install

Everything is included in a single module installed with one command.

npm install -g testcafe

No native parts to compile, no browsers plugins to install.

Complete Test Harness

TestCafe automatically starts browsers, runs tests and gathers results. You only type a single command to begin testing.

testcafe chrome,firefox tests/

When testing is finished, TestCafe aggregates test results from different browsers and outputs them into one comprehensive report.

Write Test Code in Modern JavaScript and TypeScript

TestCafe allows you to write tests using TypeScript or JavaScript (with its modern features like async/await).

Test API consists of over two dozen methods that can emulate all actions one could possibly do with a webpage. Chained syntax allows for code that is easy to write and read.

fixture `Example page`
    .page `https://devexpress.github.io/testcafe/example`;

test('Emulate user actions and perform a verification', async t => {
    await t
        .setNativeDialogHandler(() => true)

    const location = await t.eval(() => window.location);

    await t.expect(location.pathname).eql('/testcafe/example/thank-you.html');

By using TypeScript to write your TestCafe tests, you get the advantages of strongly-typed languages such as: rich coding assistance, painless scalability, check-as-you-type code verification, and much more.

To make debugging easier, TestCafe automatically generates source maps. To debug your test code, start a debugging session in an IDE that supports source maps.

Flexible Selector System

TestCafe supports a flexible selector system that provides API with rich capabilities for writing test scripts.

You can access webpage elements in different ways using selectors. For example, you can use one of the following selector types:

  • CSS selector
  • Text
  • DOM hierarchy
  • or use any custom logic

The selector API provides methods that can be combined together, thus providing you with a flexible functional-style selector mechanism.

const macOSInput = Selector('.column').find('label').withText('MacOS').child('input');

Check our example that demonstrates how to create tests using declarative Page Objects built with TestCafe selectors.

Smart Assertions

TestCafe provides a full-featured set of built-in assertions, so you do not need to reference additional libraries. The Smart Assertion Query Mechanism allows you to create stable, fast and reliable tests that do not depend on page response time.

import { Selector } from 'testcafe';

fixture `Example page`
    .page `http://devexpress.github.io/testcafe/example/`;

test('Check property of element', async t => {
    const developerNameInput = Selector('#developer-name');

    await t
        .expect(developerNameInput.value).eql('', 'input is empty')
        .typeText(developerNameInput, 'Peter Parker')
        .expect(developerNameInput.value).contains('Peter', 'input contains text "Peter"');
No Extra Coding

Write tests without boilerplate code.

  • TestCafe automatically waits for page loads and XHRs to complete, as well as for DOM elements to become visible. You do not need to write custom code for that.
  • Test runs are isolated, which means that they do not share cookies, local or session storages. There is nothing to clean up between test runs.
Descriptive Reports

TestCafe automatically generates full-detailed reports that provide a test run summary and comprehensive information about errors. Automatic page screenshots, fancy call sites and call stacks free of TestCafe internals allow you to easily detect error causes.

Use one of built-in reporters to output test results or create your own one to produce custom reports.

Straightforward Continuous Integration

TestCafe is easy to set up on popular Continuous Integration platforms as it allows you to test against various browsers: local, remote, cloud (e.g. Sauce Labs) or headless (e.g. Nightmare). You can also create a custom browser provider to add support for a browser or a cloud platform of your choice.

Actively Developing Ecosystem

To ensure that TestCafe is easy to use with various tools, from IDEs to task runners, our core team - with help from the community - developed an ecosystem of plugins for these tools. Many are already available, more are yet to come. For a complete list, see TestCafe Ecosystem.

Other Useful Features
More to Come…

We plan to introduce other outstanding features so that you can test apps with even more efficiency. Meanwhile, you can help us improve TestCafe by voting for features on our road map or sharing your own ideas and code in our GitHub repository.