-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
03.actions-scroll.test.js
74 lines (64 loc) · 3.37 KB
/
03.actions-scroll.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
70
71
72
73
74
const custom = require('./utils/custom-it');
describe('Actions - Scroll', () => {
beforeEach(async () => {
await device.reloadReactNative();
await element(by.text('Actions')).tap();
});
custom.it.withFailureIf.android.rn58OrNewer('should scroll for a small amount in direction', async () => {
await expect(element(by.text('Text1'))).toBeVisible();
await expect(element(by.text('Text4'))).not.toBeVisible();
await expect(element(by.id('ScrollView161'))).toBeVisible();
await element(by.id('ScrollView161')).scroll(100, 'down');
await expect(element(by.text('Text1'))).not.toBeVisible();
await expect(element(by.text('Text4'))).toBeVisible();
await element(by.id('ScrollView161')).scroll(100, 'up');
await expect(element(by.text('Text1'))).toBeVisible();
await expect(element(by.text('Text4'))).not.toBeVisible();
});
custom.it.withFailureIf.android.rn58OrNewer('should scroll for a large amount in direction', async () => {
await expect(element(by.text('Text6'))).not.toBeVisible();
await element(by.id('ScrollView161')).scroll(220, 'down');
await expect(element(by.text('Text6'))).toBeVisible();
});
it('should scroll for a large amount in horizontal direction', async () => {
await expect(element(by.text('HText7'))).not.toBeVisible();
await element(by.id('ScrollViewH')).scroll(220, 'right');
await expect(element(by.text('HText7'))).toBeVisible();
});
it('should scroll to edge', async () => {
await expect(element(by.text('Text12'))).not.toBeVisible();
await element(by.id('ScrollView161')).scrollTo('bottom');
await expect(element(by.text('Text12'))).toBeVisible();
await element(by.id('ScrollView161')).scrollTo('top');
await expect(element(by.text('Text1'))).toBeVisible();
});
it('should scroll horizontally to edge', async () => {
await expect(element(by.text('HText8'))).not.toBeVisible();
await element(by.id('ScrollViewH')).scrollTo('right');
await expect(element(by.text('HText8'))).toBeVisible();
await element(by.id('ScrollViewH')).scrollTo('left');
await expect(element(by.text('HText1'))).toBeVisible();
});
it('should scroll from a custom start-position ratio', async () => {
await expect(element(by.text('Text12'))).not.toBeVisible();
await element(by.id('toggleScrollOverlays')).tap();
await element(by.id('ScrollView161')).scroll(550, 'down', 0.8, 0.6);
await element(by.id('toggleScrollOverlays')).tap();
await expect(element(by.text('Text12'))).toBeVisible();
await element(by.id('toggleScrollOverlays')).tap();
await element(by.id('ScrollView161')).scroll(550, 'up', 0.2, 0.4);
await element(by.id('toggleScrollOverlays')).tap();
await expect(element(by.text('Text12'))).not.toBeVisible();
});
it('should scroll horizontally from a custom start-position ratio', async () => {
await expect(element(by.text('HText6'))).not.toBeVisible();
await element(by.id('toggleScrollOverlays')).tap();
await element(by.id('ScrollViewH')).scroll(220, 'right', 0.8, 0.6);
await element(by.id('toggleScrollOverlays')).tap();
await expect(element(by.text('HText6'))).toBeVisible();
await element(by.id('toggleScrollOverlays')).tap();
await element(by.id('ScrollViewH')).scroll(220, 'left', 0.2, 0.4);
await element(by.id('toggleScrollOverlays')).tap();
await expect(element(by.text('HText6'))).not.toBeVisible();
});
});