-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy path6-device.js
81 lines (68 loc) · 2.91 KB
/
6-device.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
describe('Device', () => {
it('reloadReactNative - should tap successfully', async () => {
await device.reloadReactNative();
await element(by.text('Sanity')).tap();
await element(by.text('Say Hello')).tap();
await expect(element(by.text('Hello!!!'))).toBeVisible();
});
it('relaunchApp - should tap successfully', async () => {
await device.relaunchApp();
await element(by.text('Sanity')).tap();
await element(by.text('Say Hello')).tap();
await expect(element(by.text('Hello!!!'))).toBeVisible();
});
it('relaunchApp({delete: true}) - should tap successfully', async () => {
await device.relaunchApp({delete: true});
await element(by.text('Sanity')).tap();
await element(by.text('Say Hello')).tap();
await expect(element(by.text('Hello!!!'))).toBeVisible();
});
it('uninstall() + install() + relaunch() - should tap successfully', async () => {
await device.uninstallApp();
await device.installApp();
await device.relaunchApp();
await element(by.text('Sanity')).tap();
await element(by.text('Say Hello')).tap();
await expect(element(by.text('Hello!!!'))).toBeVisible();
});
it('launchApp({newInstance: true}) + sendToHome() + launchApp() - should bring up previous instance', async () => {
await device.launchApp({newInstance: true});
await element(by.text('Sanity')).tap();
await element(by.text('Say Hello')).tap();
await device.sendToHome();
await device.launchApp();
await expect(element(by.text('Hello!!!'))).toBeVisible();
});
it('resetContentAndSettings() + install() + relaunch() - should tap successfully', async () => {
await device.resetContentAndSettings();
await device.installApp();
await device.launchApp({ newInstance: true });
await element(by.text('Sanity')).tap();
await element(by.text('Say Hello')).tap();
await expect(element(by.text('Hello!!!'))).toBeVisible();
});
it(':ios: shake() should shake screen', async () => {
await device.reloadReactNative();
await element(by.text('Shake')).tap();
await device.shake();
await expect(element(by.text('Shaken, not stirred'))).toBeVisible();
});
describe('device orientation', () => {
beforeEach(async() => {
await device.reloadReactNative();
await element(by.text('Orientation')).tap();
// Check if the element which input we will test actually exists
await expect(element(by.id('currentOrientation'))).toExist();
});
it('OrientationLandscape', async () => {
await device.setOrientation('landscape');
await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
});
it('OrientationPortrait', async() => {
// As default is portrait we need to set it otherwise
await device.setOrientation('landscape');
await device.setOrientation('portrait');
await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
});
});
});