End2End Tests with TestCafe

JS
R
JavaScript

Automate end-to-end web testing using TestCafe. Guide for setting up, writing, and running tests across browsers to ensure application functionality and reliability.

1# Docker
2`docker pull testcafe/testcafe`
3`export TEST_FOLDER=tests`
4`export TESTCAFE_ARGS='chromium --no-sandbox,firefox'`
5`docker run -v ${TEST_FOLDER}:/tests -it testcafe/testcafe ${TESTCAFE_ARGS}`
6
7# test.ts
8```js
9import { Selector } from 'testcafe'; // first import testcafe selectors
10fixture `Getting Started`// declare the fixture
11    .page `https://devexpress.github.io/testcafe/example`;  // specify the start page
12
13//then create a test and place your code there
14test('My first test', async t => {
15  await t
16      .typeText('#developer-name', 'John Smith')
17      .click('#submit-button')
18
19      // Use the assertion to check if the actual header text is equal to the expected one
20      .expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');
21});
22```
23

Created on 6/29/2018