JavaScript HTML TypeScript Other
Latest commit 25f0cb3 Sep 22, 2017 @VasilyStrelyaev VasilyStrelyaev committed with AlexanderMoskovkin [docs] Describe creating client functions that run async client code (#…
…1804)

* Describe creating client functions that run async client code

* Make the example more realistic (again)
Permalink
Failed to load latest commit information.
.github [docs] Added a contribution guide, code of conduct and issue template ( Oct 12, 2016
.md-lint [docs] Add the FAQ section (#1690) Aug 21, 2017
bin Handle SIGINT via async-exit-hook (closes #1378) (#1780) Sep 20, 2017
docker Use exposed Docker ports (closes #1728) (#1744) Aug 30, 2017
docs [docs] Describe creating client functions that run async client code (#… Sep 22, 2017
examples fix link err (#1526) Jun 11, 2017
media [docs] Fix client debugging example (#1363) Mar 28, 2017
src status bar hiding and showing behavior changed (fix for TestCafe Stud… Sep 20, 2017
test link without href but with tabIndex included in nextFocusable method'… Sep 21, 2017
ts-defs Implement --page-load-timeout (closes #1645) (#1648) Sep 14, 2017
.dockerignore Implement builds of Docker images (closes #1141) (#1197) Apr 11, 2017
.editorconfig Start implementing build infrastructure Jun 25, 2015
.eslintignore Fix `ReferenceError: selector is not defined` if selector promise is … Aug 12, 2016
.eslintrc Add import/export eslint rules (#741) Aug 30, 2016
.gitattributes Fix EOL in TS files (#1748) Aug 31, 2017
.gitignore Bump to release version (#1365) Mar 28, 2017
.publishrc [prerelease-0.17.3-dev20170913] Bump version (#1788) Sep 13, 2017
.travis-docs.yml [docs] Add info about Chrome-specific features (#1513) Jun 13, 2017
.travis.yml [WIP ]try to stable osx tests (#1566) Jun 28, 2017
CHANGELOG.md Update v0.17.2 release date in the CHANGELOG. Sep 6, 2017
CODE_OF_CONDUCT.md Update CODE_OF_CONDUCT.md Jun 19, 2017
CONTRIBUTING.md A couple of corrections (#895) Oct 19, 2016
Gulpfile.js [docs] Add the FAQ section (#1690) Aug 21, 2017
LICENSE Update year in license Jan 16, 2017
README.md Add the puppeteer browser provider Sep 21, 2017
appveyor.yml Should hide Shadow-UI root for get elementFromPoint in iframe in IE (c… Dec 13, 2016
package.json Update testcafe-hammerhead (closes #1767). Bump version (dev) (#1800) Sep 21, 2017

README.md

testcafe

Functional Windows desktop All Travis tasks (server, client, functional: mobile, macOS, Edge) NPM Version

A Node.js tool to automate end-to-end web testing.
Write tests in JS or TypeScript, run them and view results.

https://devexpress.github.io/testcafe


  • 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.

Install TestCafe and Run a Test

Running a sample test in Safari

Table of contents

Features

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.

Latest JS and TypeScript support
TestCafe supports the latest JavaScript features, including ES2017 (for example, async/await). You can also use TypeScript if you prefer a strongly typed language.

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.

PageObject pattern support
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
You can run TestCafe from a console, and its reports can be viewed in a CI system's interface (TeamCity, Jenkins, Travis & etc.)

Getting Started

Installation

Ensure that Node.js (version 4 or newer) and npm are installed on your computer before running it:

npm install -g testcafe

Creating the Test

As an example, we are going to test the https://devexpress.github.io/testcafe/example page.

Create a .js or .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:

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 there
test('My first test', async t => {
    await t
        .typeText('#developer-name', 'John Smith')
        .click('#submit-button')

        // Use the assertion to check if the actual header text is equal to the expected one
        .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 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

TestCafe outputs the results into a command shell by default. See Reporters for more information. You can also use plugins to customize the reports.

Test Report

Read the Getting Started page for a more detailed guide.

Documentation

Go to our website for full documentation on TestCafe.

Community

Follow us on Twitter. We post TestCafe news and updates, several times a week.

Badge

Show everyone you are using TestCafe: Tested with 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>

Contributing

Report bugs and request features on our issues page.
Ask questions and participate in discussions on the discussion board.
For more information on how to help us improve TestCafe, see the CONTRIBUTING.md.

You can use these plugin generators to create your own plugins:

If you want your plugin to be listed below, send us a note in a Github issue.

Plugins

TestCafe developers and community members made these plugins:

Thanks to BrowserStack

We are grateful to BrowserStack for providing the infrastructure that we use to test code in this repository.

BrowserStack Logo

License

Code released under the MIT license.

Creators

Developer Express Inc. (https://devexpress.com)