A Node.js tool to automate end-to-end web testing.
Write tests in JS or TypeScript, run them and view results.
- Works on all popular environments: TestCafe runs on Windows, MacOS, and Linux. It supports desktop, mobile, remote and cloud browsers (UI or headless).
- 1 minute to set up: You do not need WebDriver or any other testing software. Install TestCafe with one command, and you are ready to test:
npm install -g testcafe
- Free and open source: TestCafe is free to use under the MIT license. Plugins provide custom reports, integration with other tools, launching tests from IDE, etc. You can use the plugins made by the GitHub community or make your own.
Running a sample test in Safari
Table of contents
- TestCafe Studio: IDE for End-to-End Web Testing
- Getting Started
- Get Help
- Issue Tracker
- Stay in Touch
- Different Versions of TestCafe
Stable tests and no manual timeouts
TestCafe automatically waits for page loads and XHRs before the test starts and after each action. It also features smart test actions and assertions that wait for page elements to appear. You can change the maximum wait time. If elements load faster, tests skip the timeout and continue.
Rapid test development tool
Changes in test code immediately restart the test, and you see the results instantly.
See how it works in the TestCafe Live repository.
Latest JS and TypeScript support
Detects JS errors in your code
TestCafe reports JS errors that it finds on the webpage. Tests automatically fail because of that. However, you can disable this.
Concurrent tests launch
TestCafe can open multiple instances of the same browser to run parallel tests which decreases test execution time.
const macOSInput = ;
Easy to include in a continuous integration system
You can run TestCafe from a console, and its reports can be viewed in a CI system's interface (TeamCity, Jenkins, Travis & etc.)
TestCafe Studio: IDE for End-to-End Web Testing
Read the following article to learn how TestCafe Studio could fit into your workflow: What's Better than TestCafe? TestCafe Studio.
Record and Run a Test in TestCafe Studio
npm install -g testcafe
Creating the Test
As an example, we are going to test the https://devexpress.github.io/testcafe/example page.
.ts file on your computer.
Note that it needs to have a specific structure: tests must be organized into fixtures.
You can paste the following code to see the test in action:
; // first import testcafe selectorsfixture `Getting Started`// declare the fixturepage ``; // specify the start page//then create a test and place your code there;
Running the Test
testcafe chrome test1.js
TestCafe opens the browser and starts executing the test.
Important! Make sure to stay in the browser tab that is running tests. Do not minimize the browser window. Tests are not guaranteed to execute correctly in inactive tabs and minimized browser windows because they switch to a lower resource consumption mode.
Viewing the Results
Read the Getting Started page for a more detailed guide.
Go to our website for full documentation on TestCafe.
Join the TestCafe community on Stack Overflow to get help. Ask and answer questions with the TestCafe tag.
Stay in Touch
Follow us on Twitter. We post TestCafe news and updates, several times a week.
Read our Contributing Guide to learn how to contribute to the project.
To create your own plugin for TestCafe, you can use these plugin generators:
- Build a browser provider to set up tests on your on-premises server farm, to use a cloud testing platform, or to start your local browsers in a special way. Use this Yeoman generator to write only a few lines of code.
- To build a custom reporter with your formatting and style, check out this generator.
If you want your plugin to be listed below, send us a note in a Github issue.
Thank you to all the people who already contributed to TestCafe!
TestCafe developers and community members made these plugins:
Allow you to use TestCafe with cloud browser providers and emulators.
Work with page elements in a way that is native to your framework.
Plugins for Task Runners
Integrate TestCafe into your project's workflow.
View test results in different formats.
Find accessibility issues in your web app.
Run tests and view results from your favorite IDE.
Use ESLint when writing and editing TestCafe tests.
Different Versions of TestCafe
|No need for WebDriver, browser plugins or other tools||✓||✓|
|Cross-platform and cross-browser out of the box||✓||✓|
|Clear and flexible API supports ES6 and PageModel pattern||✓||✓|
|Stable tests due to the Smart Assertion Query Mechanism||✓||✓|
|Tests run fast due to intelligent Automatic Waiting Mechanism and Concurrent Test Execution||✓||✓|
|Custom reporter plugins||✓||✓|
|Use third-party Node.js modules in test scripts||✓||✓|
|Integration with popular CI systems||✓||✓*|
|Free and open-source||✓|
|Visual Test Recorder||✓|
|Interactive Test Editor||✓|
|Automatic Selector Generation||✓|
|Run Configuration Manager||✓|
* You can use open-source TestCafe to run TestCafe Studio tests in CI systems.
Show everyone you are using TestCafe:
To display this badge, add the following code to your repository readme:
Thanks to BrowserStack
We are grateful to BrowserStack for providing the infrastructure that we use to test code in this repository.
Code released under the MIT license.
Developer Express Inc. (https://devexpress.com)