-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
69 lines (60 loc) · 1.87 KB
/
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
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
/* eslint-disable no-undef */
import { Selector } from 'testcafe';
fixture('basic').page('http://localhost:3000');
const heading = (text) => Selector('h1').withText(text);
const button = (title) => Selector('button').withAttribute('title', title);
const input = (name) => Selector('input').withAttribute('name', name);
test('initial', async (t) => {
await t.expect(heading('Hi!').exists).ok();
});
test('start', async (t) => {
await t
.expect(heading('Hi!').exists)
.ok()
.typeText(input('name'), 'test name')
.typeText(input('email'), 'test@email')
.typeText(input('password'), 'test^password')
.click(button('get started'))
.expect(heading('test name'))
.ok()
.click(button('categories'))
.expect(heading('categories'))
.ok()
.click(button('add category'))
.expect(heading('add category'))
.ok()
.typeText(input('name'), 'test category')
.click(
Selector('span').withText('behavior - something you do, like exercise'),
)
.click(Selector('span').withText('number - like hours of sleep'))
.click(button('Add'))
.expect(Selector('span').withText('test category'))
.ok()
.click(button('data'))
.expect(heading('data'))
.ok()
.click(button('add data'))
.expect(heading('add data'))
.ok()
.typeText(Selector('input').withAttribute('aria-label', 'search'), 'sl')
.click(Selector('span').withText('sleep'))
.expect(Selector('span').withText('hours'))
.ok()
.typeText(input('value'), '8')
.click(button('Add'))
.expect(Selector('span').withText('8'))
.ok()
.click(button('correlate'))
.expect(heading('correlate'))
.ok()
.click(button('notes'))
.expect(heading('notes'))
.ok()
.click(button('home'))
.expect(heading('test name'))
.ok()
.click(button('delete everything'))
.expect(heading('Hi!').exists)
.ok();
});