In Terminal, execute these to create an empty project:
mkdir myproject
cd myproject
git init
npm init --yes
npm install -g testcafe
npm install --save-dev chai
Create tests/fixtures/google.js with this content:
import { expect } from 'chai';
fixture `First test`
.page(`http://google.com`)
test('My Test', async t => {
await t
.typeText('input[name~="q"]', 'test cafe')
.wait(1000);
expect(await t.eval(() => document.querySelector('input[name~="q"]').value)).to.equal('test cafe');
});
Run your test in Chrome with:
testcafe chrome tests/fixtures/google.js