yarn global add testcafetestcafe <target-browser> <test-file-path>testcafe chrome tests/test.jsExample
fixture `Getting Started`
.page `http://devexpress.github.io/testcafe/example`;test('My first test', async t => {
// Test code
});test('My first test', async t => {
await t
.typeText('#developer-name', 'John Smith')
.click('#submit-button');
});Selector & ClientFunction
import { Selector } from 'testcafe';
const article = Selector('.article-content');Note: The result of a Selector can be an individual node or a list. For lists you can use testcafe helper methods to further search and filter.
Selector('label').withText('foo');
Selector('li').filter('.someClass');
Selector('ul').filter((node, idx) => {
// node === a <ul> node
// idx === index of the current <ul> node
});import { ClientFunction } from 'testcafe';
const getWindowLocation = ClientFunction(() => window.location);
fixture `My fixture`
.page `http://www.example.com/`;
test('My Test', async t => {
const location = await getWindowLocation();
});import { Selector } from 'testcafe';
fixture `Getting Started`
.page `http://devexpress.github.io/testcafe/example`;
test('My first test', async t => {
await t
.typeText('#developer-name', 'John Smith')
.click('#submit-button');
const articleHeader = await Selector('.result-content').find('h1');
// Obtain the text of the article header
let headerText = await articleHeader.innerText;
});A site should display a "Thank you" header after submit.
import { Selector } from 'testcafe';
fixture `My fixture`;
test('My test', async t => {
await t.expect(Selector('.className').count).eql(3);
});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"');
});testcafe chrome test1.jstestcafe all test1.jstestcafe -c 3 chrome tests/test.jstestcafe -c 4 safari,firefox tests/test.jsimport VueSelector from 'testcafe-vue-selectors';
const todoInput = VueSelector('todo-input');
const todoItem = VueSelector('todo-list todo-item');var itemsCount = VueSelector().find('.items-count span');testcafe -b browserstack
testcafe browserstack:ie@11.0:Windows 10 test/e2e/*.test.js -S -s screenshots