forked from pubkey/rxdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe2e.test.js
36 lines (29 loc) · 1.21 KB
/
e2e.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
import { Selector } from 'testcafe';
import AsyncTestUtil from 'async-test-util';
fixture`Svelte + RxDB Note-taking App Demo`
.page`http://localhost:5000/`;
test('insert/edit/remove a note', async t => {
// clear previous notes
const noteElements = Selector('#note-list li');
const amount = await noteElements.count;
for (let i = 0; i < amount; i++) {
await t.click('.btn-delete');
}
// input title
const noteTitleInput = Selector('input');
await t
.expect(noteTitleInput.value).eql('', 'input is empty')
.typeText(noteTitleInput, 'My Note Title')
.expect(noteTitleInput.value).contains('My', 'input contains name');
// input note body
const noteBodyTextarea = Selector('textarea');
await t
.expect(noteBodyTextarea.value).eql('', 'input is empty')
.typeText(noteBodyTextarea, 'This is the content of the note.')
.expect(noteBodyTextarea.value).contains('content', 'input contains content');
// submit
await t.click('button');
await AsyncTestUtil.wait(200);
const noteListElement = Selector('#note-list li');
await t.expect(noteListElement.textContent).contains('My', 'list-item contains title match');
});