-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvanilla.spec.js
85 lines (65 loc) · 2.91 KB
/
vanilla.spec.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const assert = require('assert');
describe('vanilla', () => {
it('should work with a single element', async () => {
await browser.url('/html/vanilla.html');
const input = await browser.$('#input');
assert.equal(await input.getValue(), '10');
await input.click();
await browser.keys(['Up arrow']);
assert.equal(await input.getValue(), '11');
});
it('should work with an array of elements', async () => {
await browser.url('/html/vanilla-array.html');
const input1 = await browser.$('#input1');
const input2 = await browser.$('#input2');
assert.equal(await input1.getValue(), '10');
assert.equal(await input2.getValue(), '20');
await input1.click();
await browser.keys(['Up arrow']);
await input2.click();
await browser.keys(['Up arrow']);
assert.equal(await input1.getValue(), '11');
assert.equal(await input2.getValue(), '21');
});
it('should work with a NodeList', async () => {
await browser.url('/html/vanilla-NodeList.html');
const input1 = await browser.$('#input1');
const input2 = await browser.$('#input2');
assert.equal(await input1.getValue(), '10');
assert.equal(await input2.getValue(), '20');
await input1.click();
await browser.keys(['Up arrow']);
await input2.click();
await browser.keys(['Up arrow']);
assert.equal(await input1.getValue(), '11');
assert.equal(await input2.getValue(), '21');
});
it('should work with a HTMLCollection', async () => {
await browser.url('/html/vanilla-HTMLCollection.html');
const input1 = await browser.$('#input1');
const input2 = await browser.$('#input2');
assert.equal(await input1.getValue(), '10');
assert.equal(await input2.getValue(), '20');
await input1.click();
await browser.keys(['Up arrow']);
await input2.click();
await browser.keys(['Up arrow']);
assert.equal(await input1.getValue(), '11');
assert.equal(await input2.getValue(), '21');
});
it('should not block event listeners', async () => {
await browser.url('/html/vanilla-events.html');
const keydownBefore = await browser.$('div=keydown-before');
const onkeydown = await browser.$('div=onkeydown');
const keydownAfter = await browser.$('div=keydown-after');
const input = await browser.$('#input');
assert.equal(await keydownBefore.isDisplayed(), false);
assert.equal(await onkeydown.isDisplayed(), false);
assert.equal(await keydownAfter.isDisplayed(), false);
await input.click();
await browser.keys(['Up arrow']);
assert.equal(await keydownBefore.isDisplayed(), true);
assert.equal(await onkeydown.isDisplayed(), true);
assert.equal(await keydownAfter.isDisplayed(), true);
});
});