Awesome
<p align="center"> <a href="https://www.devexpress.com/products/testcafestudio/?utm_source=github.com&utm_medium=referral&utm_campaign=tc-gh-banner"> <img src="https://raw.github.com/DevExpress/testcafe/master/media/testcafe-studio-banner.png" alt="Try TestCafe Studio IDE" /> </a> </p> <p align="center"> <a href="https://testcafe.io"> <img src="https://raw.githubusercontent.com/DevExpress/testcafe/master/media/testcafe-logo.svg?sanitize=true" alt="testcafe" /> </a> </p> <p align="center"> <a href="https://github.com/DevExpress/testcafe/commits/master"><img alt="Tests" src="https://img.shields.io/github/checks-status/DevExpress/testcafe/master?label=Tests"></a> <a href="https://github.com/DevExpress/testcafe/actions/workflows/test-dependencies.yml"><img alt="Test Dependencies" src="https://github.com/DevExpress/testcafe/actions/workflows/test-dependencies.yml/badge.svg" /></a> <a href="https://www.npmjs.com/package/testcafe"><img alt="NPM Version" src="https://img.shields.io/npm/v/testcafe.svg" data-canonical-src="https://img.shields.io/npm/v/testcafe.svg" style="max-width:100%;"></a> </p> <p align="center"> <i> Automate end-to-end web testing with TestCafe, a Node.js-based testing framework.</i><br><br> TestCafe is <strong>free</strong> and as easy to use as <strong>1-2-3</strong>:<br> <strong>1.</strong> Write your tests in JS or TypeScript.<br><strong>2.</strong> Execute your tests.<br><strong>3.</strong> View test results. </p> <p align="center"> <a href="https://testcafe.io">Homepage</a> • <a href="https://testcafe.io/documentation/402635/getting-started">Documentation</a> • <a href="https://testcafe.io/402636/faq">FAQ</a> • <a href="https://testcafe.io/support">Support</a> </p>- 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 create your own.
Table of contents
- Features
- TestCafe Studio: IDE for End-to-End Web Testing
- Getting Started
- Documentation
- Get Help
- Issue Tracker
- Stay in Touch
- Contributing
- Plugins
- Different Versions of TestCafe
- Badge
- License
- Creators
Features
Stable tests and no manual timeouts<br/> 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<br/> When you enable live mode, changes to test code immediately restart the test, and you instantly see the results.
Latest JS and TypeScript support<br/> TestCafe supports the most recent JavaScript-related features, including ES2017 (async/await). You can also use TypeScript if you prefer a strongly typed language instead.
Detects JS errors in your code<br/> TestCafe reports JS errors that it locates on a given webpage. Tests automatically fail if TestCafe encounters such errors.<br /> You can, however, disable this option.<br />
Concurrent test launch<br/> TestCafe can open multiple instances of the same browser and run parallel tests (to help decrease test execution time).
PageObject pattern support<br/> The TestCafe's Test API includes a high-level selector library, assertions, etc. You can combine them to implement readable tests with the PageObject pattern.
const macOSInput = Selector('.column').find('label').withText('MacOS').child('input');
Easy to include in a continuous integration system<br/> You can run TestCafe from a console, and its reports can be viewed within CI systems (TeamCity, Jenkins, Travis & etc.)
Love TestCafe Open-source Edition? Want to Record Tests without Writing JavaScript or TypeScript Code?
TestCafe Studio: IDE for End-to-End Web Testing
TestCafe is the perfect choice for JavaScript developers and experienced Q&A teams. If you’d like to delegate testing to QA engineers and are looking for a code-free way to record and maintain tests compatible with your existing infrastructure, check out TestCafe Studio - a testing IDE built atop the open-source version of TestCafe.
Review the following article to learn how TestCafe Studio can fit into any workflow: What's Better than TestCafe? TestCafe Studio.
<p align="center"> <i>Record and Run a Test in TestCafe Studio</i> </p>Getting Started
Installation
Ensure that you run Node.js version 16 or higher, and run the following command:
npm install -g testcafe
Creating the Test
For this simple example, we will test the following page: https://devexpress.github.io/testcafe/example
Create a .js or .ts file on your computer. Remember that a .js or .ts file must maintain a specific structure: tests must be organized into fixtures. You can paste the following code to see the test in action:
import { Selector } from 'testcafe'; // first import testcafe selectors
fixture `Getting Started`// declare the fixture
.page `https://devexpress.github.io/testcafe/example`; // specify the start page
//then create a test and place your code within it
test('My first test', async t => {
await t
.typeText('#developer-name', 'John Smith')
.click('#submit-button')
// Use the assertion to check if actual header text equals expected text
.expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');
});
Running the Test
Call the following command in a command shell. Specify the target browser and file path.
testcafe chrome test1.js
TestCafe opens the browser and begins test execution.
Important: Make certain the browser tab that runs tests stays active. Do not minimize the browser window. Inactive tabs and minimized browser windows switch to lower resource consumption mode. In low consumption mode, tests may not execute correctly.
Viewing the Results
TestCafe outputs results into a command shell by default. See Reporters for more information. You can also use plugins to customize reports.
Read the Getting Started page for additional assistance.
Documentation
Visit the following webpage to review our online help system: Documentation.
Get Help
Join the TestCafe community on Stack Overflow. Ask and answer questions using the TestCafe tag.
Issue Tracker
Use our GitHub issues page to report bugs and suggest enhancements.
Stay in Touch
Follow us on Twitter. We post TestCafe news and updates.
Contributing
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.
Thanks to all of our contributors – We appreciate your commitment to the TestCafe community.
Plugins
TestCafe developers and community members made these plugins:
-
Browser Providers<br/> Use TestCafe with cloud browser providers and emulators.
- SauceLabs provider (by @AndreyBelym)
- BrowserStack provider (by @AndreyBelym)
- CrossBrowserTesting provider (by @sijosyn)
- LambdaTest provider (by @kanhaiya15)
- Nightmare headless provider (by @ryx)
- Testingbot provider (by @testingbot)
- fbsimctl iOS emulator (by @ents24)
- Electron (by @AndreyBelym)
- Puppeteer (by @jdobosz)
- Puppeteer Chromium (by @stefanschenk)
-
Framework-Specific Selectors<br/> Work with page elements in a way that is native to your framework.
- React (by @kirovboris)
- Angular (by @miherlosev)
- Vue (by @miherlosev)
- Aurelia (by @miherlosev)
-
Plugins for Task Runners<br/> Integrate TestCafe into your project's workflow.
-
Custom Reporters<br/> View test results in different formats.
- TeamCity (by @nirsky)
- Slack (by @Shafied)
- NUnit (by @AndreyBelym)
- TimeCafe (by @jimthedev)
- Tesults (by @Tesults)
-
GitHub Action<br/> Run TestCafe tests in GitHub Actions workflows.
-
Test Accessibility<br/> Find accessibility issues in your web app.
-
IDE Plugins<br/> Run tests and view results from your favorite IDE.
- TestCafe Test Runner for Visual Studio Code (by @romanresh)
- TestLatte for Visual Studio Code (by @Selminha)
- TestCafe runner for Webstorm (by @lilbaek)
- Code snippets for TestCafe (by @hdorgeval)
- SublimeText (by @churkin)
-
ESLint<br/> Use ESLint when writing and editing TestCafe tests.
- ESLint plugin (by @miherlosev)
-
Cucumber Support<br/> Create and run tests that use the Cucumber syntax.
- gherkin-testcafe (by @kiwigrid, now maintained by @Arthy000) - run your Cucumber tests with TestCafe as a backend. Requires CucumberJS.
- testcafe-cucumber-steps (by @Marketionist) - provides predefined Cucumber steps for gherkin-testcafe.
Different Versions of TestCafe
TestCafe | TestCafe Studio | |
---|---|---|
No need for WebDriver, browser plugins or other tools | ✓ | ✓ |
Cross-platform and cross-browser out of the box | ✓ | ✓ |
Write tests in the latest JavaScript or TypeScript | ✓ | ✓ |
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 | ✓ | |
IDE-like GUI | ✓ |
* You can use open-source TestCafe to run TestCafe Studio tests in CI systems.
Badge
Show everyone you are using TestCafe:
To display this badge, add the following code to your repository readme:
<a href="https://github.com/DevExpress/testcafe">
<img alt="Tested with TestCafe" src="https://img.shields.io/badge/tested%20with-TestCafe-2fa4cf.svg">
</a>
Thanks to BrowserStack
We are grateful to BrowserStack for providing the infrastructure that we use to test code in this repository.
<a href="https://www.browserstack.com/"><img alt="BrowserStack Logo" src="https://raw.github.com/DevExpress/testcafe/master/media/BrowserStack.png"/></a>
License
Code released under the MIT license.
Creators
Developer Express Inc. (https://devexpress.com)