[Test] Easy automated testing in NodeJS with TestCafe

Quickly get up and running with sensible automated testing scenarios written in ES6. Installing and creating your first automated tests with TestCafe is very easy. You can supercharge your quality control with a developer-friendly automation framework like TestCafe.

 

Install:

npm install -g testcafe

 

Code:

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!');
});

 

Run:

testcafe chrome test1.js

 

posted @ 2018-01-23 01:09  Zhentiw  阅读(483)  评论(0编辑  收藏  举报