瀏覽代碼

Migrate to jest (#3343)

* Migrate to jest to support parallel ios simulator from detox

* When e2e lint only ts or js files

* Remove mocha from deps and decrease from 480000ms to 180000ms
Shalom Yerushalmy 6 年之前
父節點
當前提交
3c3da0454f
No account linked to committer's email address

+ 6
- 6
e2e/ApplicationLifecycleTest.test.js 查看文件

13
     await device.relaunchApp();
13
     await device.relaunchApp();
14
   });
14
   });
15
 
15
 
16
-  it('push a screen to ensure its not there after reload', async () => {
16
+  test('push a screen to ensure its not there after reload', async () => {
17
     await elementById(testIDs.PUSH_BUTTON).tap();
17
     await elementById(testIDs.PUSH_BUTTON).tap();
18
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
18
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
19
     await device.reloadReactNative();
19
     await device.reloadReactNative();
20
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
20
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
21
   });
21
   });
22
 
22
 
23
-  it('relaunch from background', async () => {
23
+  test('relaunch from background', async () => {
24
     await elementById(testIDs.PUSH_BUTTON).tap();
24
     await elementById(testIDs.PUSH_BUTTON).tap();
25
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
25
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
26
 
26
 
30
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
30
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
31
   });
31
   });
32
 
32
 
33
-  it(':android: relaunch after close with back button', async () => {
33
+  test(':android: relaunch after close with back button', async () => {
34
     await elementById(testIDs.PUSH_BUTTON).tap();
34
     await elementById(testIDs.PUSH_BUTTON).tap();
35
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
35
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
36
 
36
 
40
     await expect(elementByLabel('Pushed Screen')).toBeNotVisible();
40
     await expect(elementByLabel('Pushed Screen')).toBeNotVisible();
41
   });
41
   });
42
 
42
 
43
-  it('device orientation does not destroy activity', async () => {
43
+  test('device orientation does not destroy activity', async () => {
44
     await elementById(testIDs.PUSH_BUTTON).tap();
44
     await elementById(testIDs.PUSH_BUTTON).tap();
45
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
45
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
46
 
46
 
49
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
49
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
50
   });
50
   });
51
 
51
 
52
-  it(':android: relaunch after activity killed by system', async () => {
52
+  test(':android: relaunch after activity killed by system', async () => {
53
     await elementById(testIDs.PUSH_BUTTON).tap();
53
     await elementById(testIDs.PUSH_BUTTON).tap();
54
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
54
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
55
     await device.sendToHome();
55
     await device.sendToHome();
82
     }
82
     }
83
   });
83
   });
84
 
84
 
85
-  it(':android: pressing r twice with delay does nothing', async () => {
85
+  test(':android: pressing r twice with delay does nothing', async () => {
86
     if (!IS_RELEASE) {
86
     if (!IS_RELEASE) {
87
       await elementById(testIDs.PUSH_BUTTON).tap();
87
       await elementById(testIDs.PUSH_BUTTON).tap();
88
       await expect(elementByLabel('Pushed Screen')).toBeVisible();
88
       await expect(elementByLabel('Pushed Screen')).toBeVisible();

+ 2
- 2
e2e/BackHandler.test.js 查看文件

9
     await device.relaunchApp();
9
     await device.relaunchApp();
10
   });
10
   });
11
 
11
 
12
-  it('override hardware back button', async () => {
12
+  test('override hardware back button', async () => {
13
     await elementByLabel('BACK HANDLER').tap();
13
     await elementByLabel('BACK HANDLER').tap();
14
     await expect(elementByLabel('Back Handler Screen')).toBeVisible();
14
     await expect(elementByLabel('Back Handler Screen')).toBeVisible();
15
 
15
 
24
     await expect(elementByLabel('React Native Navigation!')).toBeVisible();
24
     await expect(elementByLabel('React Native Navigation!')).toBeVisible();
25
   });
25
   });
26
 
26
 
27
-  it('override hardware back button in modal with stack', async () => {
27
+  test('override hardware back button in modal with stack', async () => {
28
     await elementByLabel('BACK HANDLER').tap();
28
     await elementByLabel('BACK HANDLER').tap();
29
     await expect(elementByLabel('Back Handler Screen')).toBeVisible();
29
     await expect(elementByLabel('Back Handler Screen')).toBeVisible();
30
 
30
 

+ 2
- 2
e2e/ComplexLayout.test.js 查看文件

8
     await device.relaunchApp();
8
     await device.relaunchApp();
9
   });
9
   });
10
 
10
 
11
-  it(':ios: shows external component in stack in modal', async () => {
11
+  test(':ios: shows external component in stack in modal', async () => {
12
     await elementById(testIDs.COMPLEX_LAYOUT_BUTTON).tap();
12
     await elementById(testIDs.COMPLEX_LAYOUT_BUTTON).tap();
13
     await elementById(testIDs.EXTERNAL_COMPONENT_IN_STACK).tap();
13
     await elementById(testIDs.EXTERNAL_COMPONENT_IN_STACK).tap();
14
     await expect(elementByLabel('External component in stack')).toBeVisible();
14
     await expect(elementByLabel('External component in stack')).toBeVisible();
15
   });
15
   });
16
 
16
 
17
-  it(':ios: shows external component in deep stack in modal', async () => {
17
+  test(':ios: shows external component in deep stack in modal', async () => {
18
     await elementById(testIDs.COMPLEX_LAYOUT_BUTTON).tap();
18
     await elementById(testIDs.COMPLEX_LAYOUT_BUTTON).tap();
19
     await elementById(testIDs.EXTERNAL_COMPONENT_IN_DEEP_STACK).tap();
19
     await elementById(testIDs.EXTERNAL_COMPONENT_IN_DEEP_STACK).tap();
20
     await expect(elementByLabel('External component in deep stack')).toBeVisible();
20
     await expect(elementByLabel('External component in deep stack')).toBeVisible();

+ 1
- 1
e2e/CustomTransition.js 查看文件

9
     await device.relaunchApp();
9
     await device.relaunchApp();
10
   });
10
   });
11
 
11
 
12
-  it('sanity', async () => {
12
+  test('sanity', async () => {
13
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
13
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
14
     await elementById(testIDs.CUSTOM_TRANSITION_BUTTON).tap();
14
     await elementById(testIDs.CUSTOM_TRANSITION_BUTTON).tap();
15
     await expect(element(by.id('shared_image1'))).toExist();
15
     await expect(element(by.id('shared_image1'))).toExist();

+ 26
- 23
e2e/Modals.test.js 查看文件

9
     await device.relaunchApp();
9
     await device.relaunchApp();
10
   });
10
   });
11
 
11
 
12
-  it('show modal', async () => {
12
+  test('show modal', async () => {
13
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
13
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
14
     await expect(elementById(testIDs.MODAL_SCREEN)).toBeVisible();
14
     await expect(elementById(testIDs.MODAL_SCREEN)).toBeVisible();
15
   });
15
   });
16
 
16
 
17
-  it('dismiss modal', async () => {
17
+  test('dismiss modal', async () => {
18
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
18
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
19
     await expect(elementById(testIDs.MODAL_SCREEN)).toBeVisible();
19
     await expect(elementById(testIDs.MODAL_SCREEN)).toBeVisible();
20
     await elementById(testIDs.DISMISS_MODAL_BUTTON).tap();
20
     await elementById(testIDs.DISMISS_MODAL_BUTTON).tap();
21
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
21
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
22
   });
22
   });
23
 
23
 
24
-  it('unmount modal when dismissed', async () => {
24
+  test('unmount modal when dismissed', async () => {
25
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
25
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
26
     await expect(elementById(testIDs.MODAL_SCREEN)).toBeVisible();
26
     await expect(elementById(testIDs.MODAL_SCREEN)).toBeVisible();
27
     await elementById(testIDs.MODAL_LIFECYCLE_BUTTON).tap();
27
     await elementById(testIDs.MODAL_LIFECYCLE_BUTTON).tap();
33
     await elementByLabel('OK').atIndex(0).tap();
33
     await elementByLabel('OK').atIndex(0).tap();
34
   });
34
   });
35
 
35
 
36
-  it('show multiple modals', async () => {
36
+  test('show multiple modals', async () => {
37
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
37
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
38
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
38
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
39
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
39
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
44
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
44
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
45
   });
45
   });
46
 
46
 
47
-  it('dismiss unknown screen id', async () => {
47
+  test('dismiss unknown screen id', async () => {
48
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
48
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
49
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
49
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
50
     await elementById(testIDs.DISMISS_UNKNOWN_MODAL_BUTTON).tap();
50
     await elementById(testIDs.DISMISS_UNKNOWN_MODAL_BUTTON).tap();
53
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
53
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
54
   });
54
   });
55
 
55
 
56
-  it('dismiss modal by id which is not the top most', async () => {
56
+  test('dismiss modal by id which is not the top most', async () => {
57
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
57
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
58
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
58
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
59
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
59
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
64
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
64
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
65
   });
65
   });
66
 
66
 
67
-  it('dismiss all previous modals by id when they are below top presented modal', async () => {
68
-    await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
69
-    await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
70
-    await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
71
-    await expect(elementByLabel('Modal Stack Position: 2')).toBeVisible();
72
-    await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
73
-    await expect(elementByLabel('Modal Stack Position: 3')).toBeVisible();
67
+  test(
68
+    'dismiss all previous modals by id when they are below top presented modal',
69
+    async () => {
70
+      await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
71
+      await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
72
+      await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
73
+      await expect(elementByLabel('Modal Stack Position: 2')).toBeVisible();
74
+      await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
75
+      await expect(elementByLabel('Modal Stack Position: 3')).toBeVisible();
74
 
76
 
75
-    await elementById(testIDs.DISMISS_ALL_PREVIOUS_MODAL_BUTTON).tap();
76
-    await expect(elementByLabel('Modal Stack Position: 3')).toBeVisible();
77
+      await elementById(testIDs.DISMISS_ALL_PREVIOUS_MODAL_BUTTON).tap();
78
+      await expect(elementByLabel('Modal Stack Position: 3')).toBeVisible();
77
 
79
 
78
-    await elementById(testIDs.DISMISS_MODAL_BUTTON).tap();
79
-    await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
80
-  });
80
+      await elementById(testIDs.DISMISS_MODAL_BUTTON).tap();
81
+      await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
82
+    }
83
+  );
81
 
84
 
82
-  it('dismiss some modal by id deep in the stack', async () => {
85
+  test('dismiss some modal by id deep in the stack', async () => {
83
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
86
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
84
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
87
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
85
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
88
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
97
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
100
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
98
   });
101
   });
99
 
102
 
100
-  it('dismissAllModals', async () => {
103
+  test('dismissAllModals', async () => {
101
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
104
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
102
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
105
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
103
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
106
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
106
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
109
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
107
   });
110
   });
108
 
111
 
109
-  it('push into modal', async () => {
112
+  test('push into modal', async () => {
110
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
113
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
111
     await elementById(testIDs.PUSH_BUTTON).tap();
114
     await elementById(testIDs.PUSH_BUTTON).tap();
112
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
115
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
113
   });
116
   });
114
 
117
 
115
-  it(':android: push into modal', async () => {
118
+  test(':android: push into modal', async () => {
116
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
119
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
117
     await elementById(testIDs.PUSH_BUTTON).tap();
120
     await elementById(testIDs.PUSH_BUTTON).tap();
118
     await elementById(testIDs.PUSH_BUTTON).tap();
121
     await elementById(testIDs.PUSH_BUTTON).tap();
120
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
123
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
121
   });
124
   });
122
 
125
 
123
-  it('present modal multiple times', async () => {
126
+  test('present modal multiple times', async () => {
124
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
127
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
125
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
128
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
126
     await elementById(testIDs.DISMISS_MODAL_BUTTON).tap();
129
     await elementById(testIDs.DISMISS_MODAL_BUTTON).tap();

+ 4
- 4
e2e/Orientations.test.js 查看文件

11
     waitForDeviceToSettleAfterOrientationChangeAndroid = ms => new Promise(res => setTimeout(res, device.getPlatform() === 'ios' ? 0 : 400));
11
     waitForDeviceToSettleAfterOrientationChangeAndroid = ms => new Promise(res => setTimeout(res, device.getPlatform() === 'ios' ? 0 : 400));
12
   });
12
   });
13
 
13
 
14
-  it('default allows all', async () => {
14
+  test('default allows all', async () => {
15
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
15
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
16
     await elementById(testIDs.DEFAULT_ORIENTATION_BUTTON).tap();
16
     await elementById(testIDs.DEFAULT_ORIENTATION_BUTTON).tap();
17
     waitForDeviceToSettleAfterOrientationChangeAndroid();
17
     waitForDeviceToSettleAfterOrientationChangeAndroid();
25
     await elementById(testIDs.DISMISS_BUTTON).tap();
25
     await elementById(testIDs.DISMISS_BUTTON).tap();
26
   });
26
   });
27
 
27
 
28
-  it('landscape and portrait array', async () => {
28
+  test('landscape and portrait array', async () => {
29
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
29
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
30
     await elementById(testIDs.LANDSCAPE_PORTRAIT_ORIENTATION_BUTTON).tap();
30
     await elementById(testIDs.LANDSCAPE_PORTRAIT_ORIENTATION_BUTTON).tap();
31
     await expect(element(by.id(testIDs.PORTRAIT_ELEMENT))).toBeVisible();
31
     await expect(element(by.id(testIDs.PORTRAIT_ELEMENT))).toBeVisible();
38
     await elementById(testIDs.DISMISS_BUTTON).tap();
38
     await elementById(testIDs.DISMISS_BUTTON).tap();
39
   });
39
   });
40
 
40
 
41
-  it(':ios: portrait only', async () => {
41
+  test(':ios: portrait only', async () => {
42
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
42
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
43
     await elementById(testIDs.PORTRAIT_ORIENTATION_BUTTON).tap();
43
     await elementById(testIDs.PORTRAIT_ORIENTATION_BUTTON).tap();
44
     await expect(elementById(testIDs.PORTRAIT_ELEMENT)).toBeVisible();
44
     await expect(elementById(testIDs.PORTRAIT_ELEMENT)).toBeVisible();
49
     await elementById(testIDs.DISMISS_BUTTON).tap();
49
     await elementById(testIDs.DISMISS_BUTTON).tap();
50
   });
50
   });
51
 
51
 
52
-  it(':ios: landscape only', async () => {
52
+  test(':ios: landscape only', async () => {
53
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
53
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
54
     await elementById(testIDs.LANDSCAPE_ORIENTATION_BUTTON).tap();
54
     await elementById(testIDs.LANDSCAPE_ORIENTATION_BUTTON).tap();
55
     await device.setOrientation('landscape');
55
     await device.setOrientation('landscape');

+ 4
- 4
e2e/OverlayTest.test.js 查看文件

7
     await device.relaunchApp();
7
     await device.relaunchApp();
8
   });
8
   });
9
 
9
 
10
-  it('show and dismiss overlay', async () => {
10
+  test('show and dismiss overlay', async () => {
11
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
11
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
12
     await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
12
     await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
13
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
13
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
15
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeNotVisible();
15
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeNotVisible();
16
   });
16
   });
17
 
17
 
18
-  it('overlay pass touches - true', async () => {
18
+  test('overlay pass touches - true', async () => {
19
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
19
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
20
     await elementById(testIDs.SHOW_TOUCH_THROUGH_OVERLAY_BUTTON).tap();
20
     await elementById(testIDs.SHOW_TOUCH_THROUGH_OVERLAY_BUTTON).tap();
21
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
21
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
24
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
24
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
25
   });
25
   });
26
 
26
 
27
-  it('overlay pass touches - false', async () => {
27
+  test('overlay pass touches - false', async () => {
28
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
28
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
29
     await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
29
     await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
30
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
30
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
33
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
33
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
34
   });
34
   });
35
 
35
 
36
-  it('overlay should redraw after orientation change', async () => {
36
+  test('overlay should redraw after orientation change', async () => {
37
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
37
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
38
     await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
38
     await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
39
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
39
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();

+ 12
- 12
e2e/ScreenStack.test.js 查看文件

9
     await device.relaunchApp();
9
     await device.relaunchApp();
10
   });
10
   });
11
 
11
 
12
-  it('push and pop screen', async () => {
12
+  test('push and pop screen', async () => {
13
     await elementById(testIDs.PUSH_BUTTON).tap();
13
     await elementById(testIDs.PUSH_BUTTON).tap();
14
     await expect(elementById(testIDs.PUSHED_SCREEN_HEADER)).toBeVisible();
14
     await expect(elementById(testIDs.PUSHED_SCREEN_HEADER)).toBeVisible();
15
     await elementById(testIDs.POP_BUTTON).tap();
15
     await elementById(testIDs.POP_BUTTON).tap();
16
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
16
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
17
   });
17
   });
18
 
18
 
19
-  it(':android: push and pop screen without animation', async () => {
19
+  test(':android: push and pop screen without animation', async () => {
20
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
20
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
21
     await expect(elementById(testIDs.OPTIONS_SCREEN_HEADER)).toBeVisible();
21
     await expect(elementById(testIDs.OPTIONS_SCREEN_HEADER)).toBeVisible();
22
     Android.pressBack();
22
     Android.pressBack();
23
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
23
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
24
   });
24
   });
25
 
25
 
26
-  it('pop screen deep in the stack', async () => {
26
+  test('pop screen deep in the stack', async () => {
27
     await elementById(testIDs.PUSH_BUTTON).tap();
27
     await elementById(testIDs.PUSH_BUTTON).tap();
28
     await expect(elementByLabel('Stack Position: 1')).toBeVisible();
28
     await expect(elementByLabel('Stack Position: 1')).toBeVisible();
29
     await elementById(testIDs.PUSH_BUTTON).tap();
29
     await elementById(testIDs.PUSH_BUTTON).tap();
34
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
34
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
35
   });
35
   });
36
 
36
 
37
-  it('pop to specific id', async () => {
37
+  test('pop to specific id', async () => {
38
     await elementById(testIDs.PUSH_BUTTON).tap();
38
     await elementById(testIDs.PUSH_BUTTON).tap();
39
     await elementById(testIDs.PUSH_BUTTON).tap();
39
     await elementById(testIDs.PUSH_BUTTON).tap();
40
     await elementById(testIDs.PUSH_BUTTON).tap();
40
     await elementById(testIDs.PUSH_BUTTON).tap();
43
     await expect(elementByLabel('Stack Position: 1')).toBeVisible();
43
     await expect(elementByLabel('Stack Position: 1')).toBeVisible();
44
   });
44
   });
45
 
45
 
46
-  it('pop to root', async () => {
46
+  test('pop to root', async () => {
47
     await elementById(testIDs.PUSH_BUTTON).tap();
47
     await elementById(testIDs.PUSH_BUTTON).tap();
48
     await elementById(testIDs.PUSH_BUTTON).tap();
48
     await elementById(testIDs.PUSH_BUTTON).tap();
49
     await elementById(testIDs.PUSH_BUTTON).tap();
49
     await elementById(testIDs.PUSH_BUTTON).tap();
51
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
51
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
52
   });
52
   });
53
 
53
 
54
-  it('switch to tab', async () => {
54
+  test('switch to tab', async () => {
55
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
55
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
56
     await expect(elementByLabel('This is tab 1')).toBeVisible();
56
     await expect(elementByLabel('This is tab 1')).toBeVisible();
57
     await elementById(testIDs.SWITCH_SECOND_TAB_BUTTON).tap();
57
     await elementById(testIDs.SWITCH_SECOND_TAB_BUTTON).tap();
59
     await expect(elementByLabel('This is tab 2')).toBeVisible();
59
     await expect(elementByLabel('This is tab 2')).toBeVisible();
60
   });
60
   });
61
 
61
 
62
-  it('switch to tab by cotnainerId', async () => {
62
+  test('switch to tab by cotnainerId', async () => {
63
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
63
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
64
     await expect(elementByLabel('This is tab 1')).toBeVisible();
64
     await expect(elementByLabel('This is tab 1')).toBeVisible();
65
     await elementById(testIDs.SWITCH_SECOND_TAB_BUTTON).tap();
65
     await elementById(testIDs.SWITCH_SECOND_TAB_BUTTON).tap();
68
     await expect(elementByLabel('This is tab 1')).toBeVisible();
68
     await expect(elementByLabel('This is tab 1')).toBeVisible();
69
   });
69
   });
70
 
70
 
71
-  it('push stack with multiple children', async () => {
71
+  test('push stack with multiple children', async () => {
72
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
72
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
73
     await elementById(testIDs.MODAL_WITH_STACK_BUTTON).tap();
73
     await elementById(testIDs.MODAL_WITH_STACK_BUTTON).tap();
74
     await expect(elementByLabel('Screen 2')).toBeVisible();
74
     await expect(elementByLabel('Screen 2')).toBeVisible();
76
     await expect(elementByLabel('Screen 1')).toBeVisible();
76
     await expect(elementByLabel('Screen 1')).toBeVisible();
77
   });
77
   });
78
 
78
 
79
-  it('push external component with options', async () => {
79
+  test('push external component with options', async () => {
80
     await elementById(testIDs.PUSH_EXTERNAL_COMPONENT_BUTTON).tap();
80
     await elementById(testIDs.PUSH_EXTERNAL_COMPONENT_BUTTON).tap();
81
     await expect(elementByLabel('This is an external component')).toBeVisible();
81
     await expect(elementByLabel('This is an external component')).toBeVisible();
82
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
82
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
83
   });
83
   });
84
 
84
 
85
-  it('push into a stack from BottomTabs', async () => {
85
+  test('push into a stack from BottomTabs', async () => {
86
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
86
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
87
     await elementById(testIDs.PUSH_BUTTON).tap();
87
     await elementById(testIDs.PUSH_BUTTON).tap();
88
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
88
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
90
     await expect(elementByLabel('This is tab 1')).toBeVisible();
90
     await expect(elementByLabel('This is tab 1')).toBeVisible();
91
   });
91
   });
92
 
92
 
93
-  it(':ios: set stack root component should be first in stack', async () => {
93
+  test(':ios: set stack root component should be first in stack', async () => {
94
     await elementById(testIDs.PUSH_BUTTON).tap();
94
     await elementById(testIDs.PUSH_BUTTON).tap();
95
     await expect(elementByLabel('Stack Position: 1')).toBeVisible();
95
     await expect(elementByLabel('Stack Position: 1')).toBeVisible();
96
     await elementById(testIDs.SET_STACK_ROOT_BUTTON).tap();
96
     await elementById(testIDs.SET_STACK_ROOT_BUTTON).tap();
99
     await expect(elementByLabel('Stack Position: 2')).toBeVisible();
99
     await expect(elementByLabel('Stack Position: 2')).toBeVisible();
100
   });
100
   });
101
 
101
 
102
-  it('push to stack with static id from SideMenu', async () => {
102
+  test('push to stack with static id from SideMenu', async () => {
103
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
103
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
104
     await elementById(testIDs.SHOW_LEFT_SIDE_MENU_BUTTON).tap();
104
     await elementById(testIDs.SHOW_LEFT_SIDE_MENU_BUTTON).tap();
105
     await elementById(testIDs.LEFT_SIDE_MENU_PUSH_BUTTON).tap();
105
     await elementById(testIDs.LEFT_SIDE_MENU_PUSH_BUTTON).tap();

+ 35
- 29
e2e/ScreenStyle.test.js 查看文件

8
     await device.relaunchApp();
8
     await device.relaunchApp();
9
   });
9
   });
10
 
10
 
11
-  it('declare a options on component component', async () => {
11
+  test('declare a options on component component', async () => {
12
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
12
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
13
     await expect(elementByLabel('Static Title')).toBeVisible();
13
     await expect(elementByLabel('Static Title')).toBeVisible();
14
   });
14
   });
15
 
15
 
16
-  it('change title on component component', async () => {
16
+  test('change title on component component', async () => {
17
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
17
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
18
     await expect(elementByLabel('Static Title')).toBeVisible();
18
     await expect(elementByLabel('Static Title')).toBeVisible();
19
     await elementById(testIDs.DYNAMIC_OPTIONS_BUTTON).tap();
19
     await elementById(testIDs.DYNAMIC_OPTIONS_BUTTON).tap();
20
     await expect(elementByLabel('Dynamic Title')).toBeVisible();
20
     await expect(elementByLabel('Dynamic Title')).toBeVisible();
21
   });
21
   });
22
 
22
 
23
-  it('set dynamic options with valid options will do something and not crash', async () => {
24
-    await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
25
-    await elementById(testIDs.DYNAMIC_OPTIONS_BUTTON).tap();
26
-    await expect(elementById(testIDs.OPTIONS_SCREEN_HEADER)).toBeVisible();
27
-  });
28
-
29
-  it('hides Tab Bar when pressing on Hide Top Bar and shows it when pressing on Show Top Bar', async () => {
30
-    await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
31
-    await elementById(testIDs.HIDE_TOP_BAR_BUTTON).tap();
32
-    await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
33
-    await elementById(testIDs.SHOW_TOP_BAR_BUTTON).tap();
34
-    await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
35
-  });
23
+  test(
24
+    'set dynamic options with valid options will do something and not crash',
25
+    async () => {
26
+      await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
27
+      await elementById(testIDs.DYNAMIC_OPTIONS_BUTTON).tap();
28
+      await expect(elementById(testIDs.OPTIONS_SCREEN_HEADER)).toBeVisible();
29
+    }
30
+  );
31
+
32
+  test(
33
+    'hides Tab Bar when pressing on Hide Top Bar and shows it when pressing on Show Top Bar',
34
+    async () => {
35
+      await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
36
+      await elementById(testIDs.HIDE_TOP_BAR_BUTTON).tap();
37
+      await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
38
+      await elementById(testIDs.SHOW_TOP_BAR_BUTTON).tap();
39
+      await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
40
+    }
41
+  );
36
 
42
 
37
   xit('hides topBar onScroll down and shows it on scroll up', async () => {
43
   xit('hides topBar onScroll down and shows it on scroll up', async () => {
38
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
44
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
45
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
51
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
46
   });
52
   });
47
 
53
 
48
-  it('set Tab Bar badge on a current Tab', async () => {
54
+  test('set Tab Bar badge on a current Tab', async () => {
49
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
55
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
50
     await elementById(testIDs.SET_TAB_BADGE_BUTTON).tap();
56
     await elementById(testIDs.SET_TAB_BADGE_BUTTON).tap();
51
     await expect(element(by.text('TeSt'))).toBeVisible();
57
     await expect(element(by.text('TeSt'))).toBeVisible();
52
   });
58
   });
53
 
59
 
54
-  it('hide Tab Bar', async () => {
60
+  test('hide Tab Bar', async () => {
55
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
61
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
56
     await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeVisible();
62
     await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeVisible();
57
     await elementById(testIDs.HIDE_BOTTOM_TABS_BUTTON).tap();
63
     await elementById(testIDs.HIDE_BOTTOM_TABS_BUTTON).tap();
58
     await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeNotVisible();
64
     await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeNotVisible();
59
   });
65
   });
60
 
66
 
61
-  it('show Tab Bar', async () => {
67
+  test('show Tab Bar', async () => {
62
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
68
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
63
     await elementById(testIDs.HIDE_BOTTOM_TABS_BUTTON).tap();
69
     await elementById(testIDs.HIDE_BOTTOM_TABS_BUTTON).tap();
64
     await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeNotVisible();
70
     await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeNotVisible();
66
     await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeVisible();
72
     await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeVisible();
67
   });
73
   });
68
 
74
 
69
-  it('side menu visibility - left', async () => {
75
+  test('side menu visibility - left', async () => {
70
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
76
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
71
     await elementById(testIDs.SHOW_LEFT_SIDE_MENU_BUTTON).tap();
77
     await elementById(testIDs.SHOW_LEFT_SIDE_MENU_BUTTON).tap();
72
     await expect(elementById(testIDs.HIDE_LEFT_SIDE_MENU_BUTTON)).toBeVisible();
78
     await expect(elementById(testIDs.HIDE_LEFT_SIDE_MENU_BUTTON)).toBeVisible();
74
     await expect(elementById(testIDs.CENTERED_TEXT_HEADER)).toBeVisible();
80
     await expect(elementById(testIDs.CENTERED_TEXT_HEADER)).toBeVisible();
75
   });
81
   });
76
 
82
 
77
-  it('side menu visibility - right', async () => {
83
+  test('side menu visibility - right', async () => {
78
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
84
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
79
     await elementById(testIDs.SHOW_RIGHT_SIDE_MENU_BUTTON).tap();
85
     await elementById(testIDs.SHOW_RIGHT_SIDE_MENU_BUTTON).tap();
80
     await expect(elementById(testIDs.HIDE_RIGHT_SIDE_MENU_BUTTON)).toBeVisible();
86
     await expect(elementById(testIDs.HIDE_RIGHT_SIDE_MENU_BUTTON)).toBeVisible();
82
     await expect(elementById(testIDs.CENTERED_TEXT_HEADER)).toBeVisible();
88
     await expect(elementById(testIDs.CENTERED_TEXT_HEADER)).toBeVisible();
83
   });
89
   });
84
 
90
 
85
-  it('set right buttons', async () => {
91
+  test('set right buttons', async () => {
86
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
92
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
87
     await expect(elementById('buttonOne')).toBeVisible();
93
     await expect(elementById('buttonOne')).toBeVisible();
88
     await elementById('buttonOne').tap();
94
     await elementById('buttonOne').tap();
91
     await expect(elementById('buttonOne')).toBeVisible();
97
     await expect(elementById('buttonOne')).toBeVisible();
92
   });
98
   });
93
 
99
 
94
-  it('set left buttons', async () => {
100
+  test('set left buttons', async () => {
95
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
101
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
96
     await expect(elementById('buttonLeft')).toBeVisible();
102
     await expect(elementById('buttonLeft')).toBeVisible();
97
   });
103
   });
98
 
104
 
99
-  it('tab bar items visibility', async () => {
105
+  test('tab bar items visibility', async () => {
100
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
106
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
101
     await expect(elementById(testIDs.FIRST_TAB_BAR_BUTTON)).toBeVisible();
107
     await expect(elementById(testIDs.FIRST_TAB_BAR_BUTTON)).toBeVisible();
102
     await expect(elementById(testIDs.SECOND_TAB_BAR_BUTTON)).toBeVisible();
108
     await expect(elementById(testIDs.SECOND_TAB_BAR_BUTTON)).toBeVisible();
103
   });
109
   });
104
 
110
 
105
-  it('default options should apply to all screens in stack', async () => {
111
+  test('default options should apply to all screens in stack', async () => {
106
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
112
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
107
     await elementById(testIDs.PUSH_DEFAULT_OPTIONS_BUTTON).tap();
113
     await elementById(testIDs.PUSH_DEFAULT_OPTIONS_BUTTON).tap();
108
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
114
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
110
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
116
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
111
   });
117
   });
112
 
118
 
113
-  it('default options should not override static options', async () => {
119
+  test('default options should not override static options', async () => {
114
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
120
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
115
     await elementById(testIDs.PUSH_DEFAULT_OPTIONS_BUTTON).tap();
121
     await elementById(testIDs.PUSH_DEFAULT_OPTIONS_BUTTON).tap();
116
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
122
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
118
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
124
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
119
   });
125
   });
120
 
126
 
121
-  it('supports user-provided id', async () => {
127
+  test('supports user-provided id', async () => {
122
     await elementById(testIDs.PROVIDED_ID).tap();
128
     await elementById(testIDs.PROVIDED_ID).tap();
123
     await expect(elementByLabel('User provided id')).toBeVisible();
129
     await expect(elementByLabel('User provided id')).toBeVisible();
124
   });
130
   });
125
 
131
 
126
-  it('stack options should not override component options', async () => {
132
+  test('stack options should not override component options', async () => {
127
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
133
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
128
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
134
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
129
   });
135
   });
130
 
136
 
131
-  it('set title component', async () => {
137
+  test('set title component', async () => {
132
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
138
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
133
     await elementById(testIDs.SHOW_TOPBAR_REACT_VIEW).tap();
139
     await elementById(testIDs.SHOW_TOPBAR_REACT_VIEW).tap();
134
     await expect(elementByLabel('Press Me')).toBeVisible();
140
     await expect(elementByLabel('Press Me')).toBeVisible();
135
   });
141
   });
136
 
142
 
137
-  it(':ios: set searchBar and handle onSearchUpdated event', async () => {
143
+  test(':ios: set searchBar and handle onSearchUpdated event', async () => {
138
     await elementById(testIDs.SHOW_TOPBAR_SEARCHBAR).tap();
144
     await elementById(testIDs.SHOW_TOPBAR_SEARCHBAR).tap();
139
     await expect(elementByLabel('Start Typing')).toBeVisible();
145
     await expect(elementByLabel('Start Typing')).toBeVisible();
140
     await elementByLabel('Start Typing').tap();
146
     await elementByLabel('Start Typing').tap();

+ 4
- 4
e2e/StaticLifecycleEvents.test.js 查看文件

7
     await device.relaunchApp();
7
     await device.relaunchApp();
8
   });
8
   });
9
 
9
 
10
-  it('didAppear didDisappear', async () => {
10
+  test('didAppear didDisappear', async () => {
11
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
11
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
12
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
12
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
13
     await expect(elementByLabel('componentDidAppear | navigation.playground.StaticLifecycleOverlay')).toBeVisible();
13
     await expect(elementByLabel('componentDidAppear | navigation.playground.StaticLifecycleOverlay')).toBeVisible();
16
     await expect(elementByLabel('componentDidDisappear | navigation.playground.WelcomeScreen')).toBeVisible();
16
     await expect(elementByLabel('componentDidDisappear | navigation.playground.WelcomeScreen')).toBeVisible();
17
   });
17
   });
18
 
18
 
19
-  it(':ios: pushing and popping screen dispatch static event', async () => {
19
+  test(':ios: pushing and popping screen dispatch static event', async () => {
20
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
20
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
21
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
21
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
22
     await expect(elementByLabel('componentDidAppear | navigation.playground.StaticLifecycleOverlay')).toBeVisible();
22
     await expect(elementByLabel('componentDidAppear | navigation.playground.StaticLifecycleOverlay')).toBeVisible();
26
     await expect(elementByLabel('pop')).toBeVisible();
26
     await expect(elementByLabel('pop')).toBeVisible();
27
   });
27
   });
28
 
28
 
29
-  it(':ios: showModal and dismissModal dispatch static event', async () => {
29
+  test(':ios: showModal and dismissModal dispatch static event', async () => {
30
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
30
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
31
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
31
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
32
     await expect(elementByLabel('componentDidAppear | navigation.playground.StaticLifecycleOverlay')).toBeVisible();
32
     await expect(elementByLabel('componentDidAppear | navigation.playground.StaticLifecycleOverlay')).toBeVisible();
36
     await expect(elementByLabel('dismissModal')).toBeVisible();
36
     await expect(elementByLabel('dismissModal')).toBeVisible();
37
   });
37
   });
38
 
38
 
39
-  it(':ios: unmounts when dismissed', async () => {
39
+  test(':ios: unmounts when dismissed', async () => {
40
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
40
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
41
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
41
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
42
     await elementById(testIDs.DISMISS_BUTTON).tap();
42
     await elementById(testIDs.DISMISS_BUTTON).tap();

+ 5
- 5
e2e/TopLevelApi.test.js 查看文件

8
     await device.relaunchApp();
8
     await device.relaunchApp();
9
   });
9
   });
10
 
10
 
11
-  it('shows welcome screen', async () => {
11
+  test('shows welcome screen', async () => {
12
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
12
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
13
   });
13
   });
14
 
14
 
15
-  it('switch to tab based app, passProps and functions', async () => {
15
+  test('switch to tab based app, passProps and functions', async () => {
16
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
16
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
17
     await expect(elementByLabel('This is tab 1')).toBeVisible();
17
     await expect(elementByLabel('This is tab 1')).toBeVisible();
18
     await expect(elementByLabel('Hello from a function!')).toBeVisible();
18
     await expect(elementByLabel('Hello from a function!')).toBeVisible();
19
   });
19
   });
20
 
20
 
21
-  it(':ios: switch to tabs with side menus', async () => {
21
+  test(':ios: switch to tabs with side menus', async () => {
22
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
22
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
23
     await elementById(testIDs.CENTERED_TEXT_HEADER).swipe('right');
23
     await elementById(testIDs.CENTERED_TEXT_HEADER).swipe('right');
24
     await expect(elementById(testIDs.HIDE_LEFT_SIDE_MENU_BUTTON)).toBeVisible();
24
     await expect(elementById(testIDs.HIDE_LEFT_SIDE_MENU_BUTTON)).toBeVisible();
25
   });
25
   });
26
 
26
 
27
-  it('screen lifecycle', async () => {
27
+  test('screen lifecycle', async () => {
28
     await elementById(testIDs.PUSH_LIFECYCLE_BUTTON).tap();
28
     await elementById(testIDs.PUSH_LIFECYCLE_BUTTON).tap();
29
     await expect(elementByLabel('didAppear')).toBeVisible();
29
     await expect(elementByLabel('didAppear')).toBeVisible();
30
     await elementById(testIDs.PUSH_TO_TEST_DID_DISAPPEAR_BUTTON).tap();
30
     await elementById(testIDs.PUSH_TO_TEST_DID_DISAPPEAR_BUTTON).tap();
31
     await expect(elementByLabel('didDisappear')).toBeVisible();
31
     await expect(elementByLabel('didDisappear')).toBeVisible();
32
   });
32
   });
33
 
33
 
34
-  it('unmount is called on pop', async () => {
34
+  test('unmount is called on pop', async () => {
35
     await elementById(testIDs.PUSH_LIFECYCLE_BUTTON).tap();
35
     await elementById(testIDs.PUSH_LIFECYCLE_BUTTON).tap();
36
     await expect(elementByLabel('didAppear')).toBeVisible();
36
     await expect(elementByLabel('didAppear')).toBeVisible();
37
     await elementById(testIDs.POP_BUTTON).tap();
37
     await elementById(testIDs.POP_BUTTON).tap();

+ 6
- 0
e2e/config.json 查看文件

1
+{
2
+  "setupTestFrameworkScriptFile" : "./init.js",
3
+  "testEnvironment": "node",
4
+  "bail": true,
5
+  "verbose": true
6
+}

+ 11
- 2
e2e/init.js 查看文件

1
 const detox = require('detox');
1
 const detox = require('detox');
2
 const config = require('../package.json').detox;
2
 const config = require('../package.json').detox;
3
 const exec = require('shell-utils').exec;
3
 const exec = require('shell-utils').exec;
4
+jest.setTimeout(180000);
4
 
5
 
5
-before(async () => {
6
+beforeAll(async () => {
6
   await detox.init(config, { launchApp: false });
7
   await detox.init(config, { launchApp: false });
7
   disableAndroidEmulatorAnimations();
8
   disableAndroidEmulatorAnimations();
8
 });
9
 });
9
 
10
 
10
-after(async () => {
11
+afterAll(async () => {
11
   await detox.cleanup();
12
   await detox.cleanup();
12
 });
13
 });
13
 
14
 
15
+beforeEach(async function() {
16
+    await detox.beforeEach(jasmine.testPath);
17
+});
18
+
19
+afterEach(async function() {
20
+    await detox.afterEach(jasmine.testPath);
21
+});
22
+
14
 function disableAndroidEmulatorAnimations() {
23
 function disableAndroidEmulatorAnimations() {
15
   if (device.getPlatform() === 'android') {
24
   if (device.getPlatform() === 'android') {
16
     const deviceId = device._deviceId;
25
     const deviceId = device._deviceId;

+ 0
- 1
e2e/mocha.opts 查看文件

1
---recursive --timeout 300000 --bail

+ 2
- 3
package.json 查看文件

41
     "test-e2e-android": "node ./scripts/test-e2e --android",
41
     "test-e2e-android": "node ./scripts/test-e2e --android",
42
     "pretest-e2e-ios": "npm run build",
42
     "pretest-e2e-ios": "npm run build",
43
     "test-e2e-ios": "node ./scripts/test-e2e --ios",
43
     "test-e2e-ios": "node ./scripts/test-e2e --ios",
44
+    "test-e2e-ios-multi": "npm run test-e2e-ios -- --multi",
44
     "test-all": "node ./scripts/test-all",
45
     "test-all": "node ./scripts/test-all",
45
     "prerelease": "npm run build",
46
     "prerelease": "npm run build",
46
     "release": "node ./scripts/release",
47
     "release": "node ./scripts/release",
65
   "devDependencies": {
66
   "devDependencies": {
66
     "detox": "7.x.x",
67
     "detox": "7.x.x",
67
     "jest": "22.x.x",
68
     "jest": "22.x.x",
68
-    "mocha": "4.x.x",
69
     "react": "16.2.0",
69
     "react": "16.2.0",
70
     "react-native": "0.51.x",
70
     "react-native": "0.51.x",
71
     "react-redux": "5.x.x",
71
     "react-redux": "5.x.x",
116
     }
116
     }
117
   },
117
   },
118
   "detox": {
118
   "detox": {
119
-    "test-runner": "mocha",
119
+    "test-runner": "jest",
120
     "specs": "e2e",
120
     "specs": "e2e",
121
-    "runner-config": "e2e/mocha.opts",
122
     "configurations": {
121
     "configurations": {
123
       "ios.sim.debug": {
122
       "ios.sim.debug": {
124
         "binaryPath": "playground/ios/DerivedData/playground/Build/Products/Debug-iphonesimulator/playground.app",
123
         "binaryPath": "playground/ios/DerivedData/playground/Build/Products/Debug-iphonesimulator/playground.app",

+ 3
- 1
scripts/test-e2e.js 查看文件

5
 const release = _.includes(process.argv, '--release');
5
 const release = _.includes(process.argv, '--release');
6
 const skipBuild = _.includes(process.argv, '--skipBuild');
6
 const skipBuild = _.includes(process.argv, '--skipBuild');
7
 const headless = _.includes(process.argv, '--headless');
7
 const headless = _.includes(process.argv, '--headless');
8
+const multi = _.includes(process.argv, '--multi');
8
 
9
 
9
 run();
10
 run();
10
 
11
 
15
     const configuration = `${prefix}.${suffix}`;
16
     const configuration = `${prefix}.${suffix}`;
16
     const cleanup = process.env.CI ? `--cleanup` : ``;
17
     const cleanup = process.env.CI ? `--cleanup` : ``;
17
     const headless$ = android ? headless ? `--headless` : `` : ``;
18
     const headless$ = android ? headless ? `--headless` : `` : ``;
19
+    const workers = multi ? 2 : 1;
18
 
20
 
19
     if (!skipBuild) {
21
     if (!skipBuild) {
20
         exec.execSync(`detox build --configuration ${configuration}`);
22
         exec.execSync(`detox build --configuration ${configuration}`);
21
     }
23
     }
22
-    exec.execSync(`detox test --configuration ${configuration} --platform ${platform} ${cleanup} ${headless$}`);
24
+    exec.execSync(`detox test --configuration ${configuration} --platform ${platform} ${cleanup} ${headless$} ${!android ? `-w ${workers}` : ``}`);
23
 }
25
 }

+ 1
- 1
scripts/test-js.js 查看文件

14
 run();
14
 run();
15
 
15
 
16
 function run() {
16
 function run() {
17
-  const paths = _.chain(dirs).map((d) => `'${d}/**/*.[tj]s*'`).join(' ').value();
17
+  const paths = _.chain(dirs).map((d) => d === 'e2e' ? `${d}/**/*.[tj]s` : `${d}/**/*.[tj]s*`).join(' ').value();
18
   exec.execSync(`tslint ${paths} ${fix} --format verbose`);
18
   exec.execSync(`tslint ${paths} ${fix} --format verbose`);
19
   assertAllTsFilesInSrc();
19
   assertAllTsFilesInSrc();
20
   exec.execSync(`jest --coverage`);
20
   exec.execSync(`jest --coverage`);