blob: 7c00396b98915bc73bf93e201bde0f6afe33469e (
plain) (
blame)
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
|
import { Selector } from 'testcafe';
fixture `Simple Sorting`
.page `./single-list.html`;
let list1 = Selector('#list1');
test('Sort down list', async browser => {
const dragStartPosition = list1.child(0);
const dragEl = await dragStartPosition();
const dragEndPosition = list1.child(2);
const targetStartPosition = list1.child(2);
const target = await targetStartPosition();
const targetEndPosition = list1.child(1);
await browser
.expect(dragStartPosition.innerText).eql(dragEl.innerText)
.expect(targetStartPosition.innerText).eql(target.innerText)
.dragToElement(dragEl, target)
.expect(dragEndPosition.innerText).eql(dragEl.innerText)
.expect(targetEndPosition.innerText).eql(target.innerText);
});
test('Sort up list', async browser => {
const dragStartPosition = list1.child(2);
const dragEl = await dragStartPosition();
const dragEndPosition = list1.child(0);
const targetStartPosition = list1.child(0);
const target = await targetStartPosition();
const targetEndPosition = list1.child(1);
await browser
.expect(dragStartPosition.innerText).eql(dragEl.innerText)
.expect(targetStartPosition.innerText).eql(target.innerText)
.dragToElement(dragEl, target)
.expect(dragEndPosition.innerText).eql(dragEl.innerText)
.expect(targetEndPosition.innerText).eql(target.innerText);
});
|