forked from DevExpress/testcafe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
type-test.js
32 lines (23 loc) · 911 Bytes
/
type-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// NOTE: to preserve callsites, add new tests AFTER the existing ones
import { ClientFunction } from 'testcafe';
import { expect } from 'chai';
fixture `Type`
.page `http://localhost:3000/fixtures/api/es-next/type/pages/index.html`;
const getStatusText = ClientFunction(() => document.getElementById('status').textContent);
test('Type text in input', async t => {
await t.typeText('#input', 'a', { replace: true });
const statusText = await getStatusText();
expect(statusText).to.equal('Type in input raised');
});
test('Incorrect action selector', async t => {
await t.typeText(NaN, 'a');
});
test('Incorrect action text', async t => {
await t.typeText('#input', 123);
});
test('Incorrect action options', async t => {
await t.typeText('#input', 'a', { replace: null, paste: null });
});
test('Not found selector', async t => {
await t.typeText('#not-found', 'a');
});