Browse Source

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 years ago
parent
commit
3c3da0454f
No account linked to committer's email address

+ 6
- 6
e2e/ApplicationLifecycleTest.test.js View File

@@ -13,14 +13,14 @@ describe('application lifecycle test', () => {
13 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 17
     await elementById(testIDs.PUSH_BUTTON).tap();
18 18
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
19 19
     await device.reloadReactNative();
20 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 24
     await elementById(testIDs.PUSH_BUTTON).tap();
25 25
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
26 26
 
@@ -30,7 +30,7 @@ describe('application lifecycle test', () => {
30 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 34
     await elementById(testIDs.PUSH_BUTTON).tap();
35 35
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
36 36
 
@@ -40,7 +40,7 @@ describe('application lifecycle test', () => {
40 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 44
     await elementById(testIDs.PUSH_BUTTON).tap();
45 45
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
46 46
 
@@ -49,7 +49,7 @@ describe('application lifecycle test', () => {
49 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 53
     await elementById(testIDs.PUSH_BUTTON).tap();
54 54
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
55 55
     await device.sendToHome();
@@ -82,7 +82,7 @@ describe('application lifecycle test', () => {
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 86
     if (!IS_RELEASE) {
87 87
       await elementById(testIDs.PUSH_BUTTON).tap();
88 88
       await expect(elementByLabel('Pushed Screen')).toBeVisible();

+ 2
- 2
e2e/BackHandler.test.js View File

@@ -9,7 +9,7 @@ describe(':android: screen stack', () => {
9 9
     await device.relaunchApp();
10 10
   });
11 11
 
12
-  it('override hardware back button', async () => {
12
+  test('override hardware back button', async () => {
13 13
     await elementByLabel('BACK HANDLER').tap();
14 14
     await expect(elementByLabel('Back Handler Screen')).toBeVisible();
15 15
 
@@ -24,7 +24,7 @@ describe(':android: screen stack', () => {
24 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 28
     await elementByLabel('BACK HANDLER').tap();
29 29
     await expect(elementByLabel('Back Handler Screen')).toBeVisible();
30 30
 

+ 2
- 2
e2e/ComplexLayout.test.js View File

@@ -8,13 +8,13 @@ describe('complex layout', () => {
8 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 12
     await elementById(testIDs.COMPLEX_LAYOUT_BUTTON).tap();
13 13
     await elementById(testIDs.EXTERNAL_COMPONENT_IN_STACK).tap();
14 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 18
     await elementById(testIDs.COMPLEX_LAYOUT_BUTTON).tap();
19 19
     await elementById(testIDs.EXTERNAL_COMPONENT_IN_DEEP_STACK).tap();
20 20
     await expect(elementByLabel('External component in deep stack')).toBeVisible();

+ 1
- 1
e2e/CustomTransition.js View File

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

+ 26
- 23
e2e/Modals.test.js View File

@@ -9,19 +9,19 @@ describe('modal', () => {
9 9
     await device.relaunchApp();
10 10
   });
11 11
 
12
-  it('show modal', async () => {
12
+  test('show modal', async () => {
13 13
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
14 14
     await expect(elementById(testIDs.MODAL_SCREEN)).toBeVisible();
15 15
   });
16 16
 
17
-  it('dismiss modal', async () => {
17
+  test('dismiss modal', async () => {
18 18
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
19 19
     await expect(elementById(testIDs.MODAL_SCREEN)).toBeVisible();
20 20
     await elementById(testIDs.DISMISS_MODAL_BUTTON).tap();
21 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 25
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
26 26
     await expect(elementById(testIDs.MODAL_SCREEN)).toBeVisible();
27 27
     await elementById(testIDs.MODAL_LIFECYCLE_BUTTON).tap();
@@ -33,7 +33,7 @@ describe('modal', () => {
33 33
     await elementByLabel('OK').atIndex(0).tap();
34 34
   });
35 35
 
36
-  it('show multiple modals', async () => {
36
+  test('show multiple modals', async () => {
37 37
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
38 38
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
39 39
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
@@ -44,7 +44,7 @@ describe('modal', () => {
44 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 48
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
49 49
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
50 50
     await elementById(testIDs.DISMISS_UNKNOWN_MODAL_BUTTON).tap();
@@ -53,7 +53,7 @@ describe('modal', () => {
53 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 57
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
58 58
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
59 59
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
@@ -64,22 +64,25 @@ describe('modal', () => {
64 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 86
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
84 87
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
85 88
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
@@ -97,7 +100,7 @@ describe('modal', () => {
97 100
     await expect(elementById(testIDs.WELCOME_SCREEN_HEADER)).toBeVisible();
98 101
   });
99 102
 
100
-  it('dismissAllModals', async () => {
103
+  test('dismissAllModals', async () => {
101 104
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
102 105
     await expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
103 106
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
@@ -106,13 +109,13 @@ describe('modal', () => {
106 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 113
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
111 114
     await elementById(testIDs.PUSH_BUTTON).tap();
112 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 119
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
117 120
     await elementById(testIDs.PUSH_BUTTON).tap();
118 121
     await elementById(testIDs.PUSH_BUTTON).tap();
@@ -120,7 +123,7 @@ describe('modal', () => {
120 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 127
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
125 128
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
126 129
     await elementById(testIDs.DISMISS_MODAL_BUTTON).tap();

+ 4
- 4
e2e/Orientations.test.js View File

@@ -11,7 +11,7 @@ describe(':ios: orientation', () => {
11 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 15
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
16 16
     await elementById(testIDs.DEFAULT_ORIENTATION_BUTTON).tap();
17 17
     waitForDeviceToSettleAfterOrientationChangeAndroid();
@@ -25,7 +25,7 @@ describe(':ios: orientation', () => {
25 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 29
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
30 30
     await elementById(testIDs.LANDSCAPE_PORTRAIT_ORIENTATION_BUTTON).tap();
31 31
     await expect(element(by.id(testIDs.PORTRAIT_ELEMENT))).toBeVisible();
@@ -38,7 +38,7 @@ describe(':ios: orientation', () => {
38 38
     await elementById(testIDs.DISMISS_BUTTON).tap();
39 39
   });
40 40
 
41
-  it(':ios: portrait only', async () => {
41
+  test(':ios: portrait only', async () => {
42 42
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
43 43
     await elementById(testIDs.PORTRAIT_ORIENTATION_BUTTON).tap();
44 44
     await expect(elementById(testIDs.PORTRAIT_ELEMENT)).toBeVisible();
@@ -49,7 +49,7 @@ describe(':ios: orientation', () => {
49 49
     await elementById(testIDs.DISMISS_BUTTON).tap();
50 50
   });
51 51
 
52
-  it(':ios: landscape only', async () => {
52
+  test(':ios: landscape only', async () => {
53 53
     await elementById(testIDs.ORIENTATION_BUTTON).tap();
54 54
     await elementById(testIDs.LANDSCAPE_ORIENTATION_BUTTON).tap();
55 55
     await device.setOrientation('landscape');

+ 4
- 4
e2e/OverlayTest.test.js View File

@@ -7,7 +7,7 @@ describe('Overlay', () => {
7 7
     await device.relaunchApp();
8 8
   });
9 9
 
10
-  it('show and dismiss overlay', async () => {
10
+  test('show and dismiss overlay', async () => {
11 11
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
12 12
     await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
13 13
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
@@ -15,7 +15,7 @@ describe('Overlay', () => {
15 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 19
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
20 20
     await elementById(testIDs.SHOW_TOUCH_THROUGH_OVERLAY_BUTTON).tap();
21 21
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
@@ -24,7 +24,7 @@ describe('Overlay', () => {
24 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 28
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
29 29
     await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
30 30
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
@@ -33,7 +33,7 @@ describe('Overlay', () => {
33 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 37
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
38 38
     await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
39 39
     await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();

+ 12
- 12
e2e/ScreenStack.test.js View File

@@ -9,21 +9,21 @@ describe('screen stack', () => {
9 9
     await device.relaunchApp();
10 10
   });
11 11
 
12
-  it('push and pop screen', async () => {
12
+  test('push and pop screen', async () => {
13 13
     await elementById(testIDs.PUSH_BUTTON).tap();
14 14
     await expect(elementById(testIDs.PUSHED_SCREEN_HEADER)).toBeVisible();
15 15
     await elementById(testIDs.POP_BUTTON).tap();
16 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 20
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
21 21
     await expect(elementById(testIDs.OPTIONS_SCREEN_HEADER)).toBeVisible();
22 22
     Android.pressBack();
23 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 27
     await elementById(testIDs.PUSH_BUTTON).tap();
28 28
     await expect(elementByLabel('Stack Position: 1')).toBeVisible();
29 29
     await elementById(testIDs.PUSH_BUTTON).tap();
@@ -34,7 +34,7 @@ describe('screen stack', () => {
34 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 38
     await elementById(testIDs.PUSH_BUTTON).tap();
39 39
     await elementById(testIDs.PUSH_BUTTON).tap();
40 40
     await elementById(testIDs.PUSH_BUTTON).tap();
@@ -43,7 +43,7 @@ describe('screen stack', () => {
43 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 47
     await elementById(testIDs.PUSH_BUTTON).tap();
48 48
     await elementById(testIDs.PUSH_BUTTON).tap();
49 49
     await elementById(testIDs.PUSH_BUTTON).tap();
@@ -51,7 +51,7 @@ describe('screen stack', () => {
51 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 55
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
56 56
     await expect(elementByLabel('This is tab 1')).toBeVisible();
57 57
     await elementById(testIDs.SWITCH_SECOND_TAB_BUTTON).tap();
@@ -59,7 +59,7 @@ describe('screen stack', () => {
59 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 63
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
64 64
     await expect(elementByLabel('This is tab 1')).toBeVisible();
65 65
     await elementById(testIDs.SWITCH_SECOND_TAB_BUTTON).tap();
@@ -68,7 +68,7 @@ describe('screen stack', () => {
68 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 72
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
73 73
     await elementById(testIDs.MODAL_WITH_STACK_BUTTON).tap();
74 74
     await expect(elementByLabel('Screen 2')).toBeVisible();
@@ -76,13 +76,13 @@ describe('screen stack', () => {
76 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 80
     await elementById(testIDs.PUSH_EXTERNAL_COMPONENT_BUTTON).tap();
81 81
     await expect(elementByLabel('This is an external component')).toBeVisible();
82 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 86
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
87 87
     await elementById(testIDs.PUSH_BUTTON).tap();
88 88
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
@@ -90,7 +90,7 @@ describe('screen stack', () => {
90 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 94
     await elementById(testIDs.PUSH_BUTTON).tap();
95 95
     await expect(elementByLabel('Stack Position: 1')).toBeVisible();
96 96
     await elementById(testIDs.SET_STACK_ROOT_BUTTON).tap();
@@ -99,7 +99,7 @@ describe('screen stack', () => {
99 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 103
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
104 104
     await elementById(testIDs.SHOW_LEFT_SIDE_MENU_BUTTON).tap();
105 105
     await elementById(testIDs.LEFT_SIDE_MENU_PUSH_BUTTON).tap();

+ 35
- 29
e2e/ScreenStyle.test.js View File

@@ -8,31 +8,37 @@ describe('screen style', () => {
8 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 12
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
13 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 17
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
18 18
     await expect(elementByLabel('Static Title')).toBeVisible();
19 19
     await elementById(testIDs.DYNAMIC_OPTIONS_BUTTON).tap();
20 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 43
   xit('hides topBar onScroll down and shows it on scroll up', async () => {
38 44
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
@@ -45,20 +51,20 @@ describe('screen style', () => {
45 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 55
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
50 56
     await elementById(testIDs.SET_TAB_BADGE_BUTTON).tap();
51 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 61
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
56 62
     await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeVisible();
57 63
     await elementById(testIDs.HIDE_BOTTOM_TABS_BUTTON).tap();
58 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 68
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
63 69
     await elementById(testIDs.HIDE_BOTTOM_TABS_BUTTON).tap();
64 70
     await expect(elementById(testIDs.BOTTOM_TABS_ELEMENT)).toBeNotVisible();
@@ -66,7 +72,7 @@ describe('screen style', () => {
66 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 76
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
71 77
     await elementById(testIDs.SHOW_LEFT_SIDE_MENU_BUTTON).tap();
72 78
     await expect(elementById(testIDs.HIDE_LEFT_SIDE_MENU_BUTTON)).toBeVisible();
@@ -74,7 +80,7 @@ describe('screen style', () => {
74 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 84
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
79 85
     await elementById(testIDs.SHOW_RIGHT_SIDE_MENU_BUTTON).tap();
80 86
     await expect(elementById(testIDs.HIDE_RIGHT_SIDE_MENU_BUTTON)).toBeVisible();
@@ -82,7 +88,7 @@ describe('screen style', () => {
82 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 92
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
87 93
     await expect(elementById('buttonOne')).toBeVisible();
88 94
     await elementById('buttonOne').tap();
@@ -91,18 +97,18 @@ describe('screen style', () => {
91 97
     await expect(elementById('buttonOne')).toBeVisible();
92 98
   });
93 99
 
94
-  it('set left buttons', async () => {
100
+  test('set left buttons', async () => {
95 101
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
96 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 106
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
101 107
     await expect(elementById(testIDs.FIRST_TAB_BAR_BUTTON)).toBeVisible();
102 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 112
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
107 113
     await elementById(testIDs.PUSH_DEFAULT_OPTIONS_BUTTON).tap();
108 114
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
@@ -110,7 +116,7 @@ describe('screen style', () => {
110 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 120
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
115 121
     await elementById(testIDs.PUSH_DEFAULT_OPTIONS_BUTTON).tap();
116 122
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
@@ -118,23 +124,23 @@ describe('screen style', () => {
118 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 128
     await elementById(testIDs.PROVIDED_ID).tap();
123 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 133
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
128 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 138
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
133 139
     await elementById(testIDs.SHOW_TOPBAR_REACT_VIEW).tap();
134 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 144
     await elementById(testIDs.SHOW_TOPBAR_SEARCHBAR).tap();
139 145
     await expect(elementByLabel('Start Typing')).toBeVisible();
140 146
     await elementByLabel('Start Typing').tap();

+ 4
- 4
e2e/StaticLifecycleEvents.test.js View File

@@ -7,7 +7,7 @@ describe('static lifecycle events', () => {
7 7
     await device.relaunchApp();
8 8
   });
9 9
 
10
-  it('didAppear didDisappear', async () => {
10
+  test('didAppear didDisappear', async () => {
11 11
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
12 12
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
13 13
     await expect(elementByLabel('componentDidAppear | navigation.playground.StaticLifecycleOverlay')).toBeVisible();
@@ -16,7 +16,7 @@ describe('static lifecycle events', () => {
16 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 20
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
21 21
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
22 22
     await expect(elementByLabel('componentDidAppear | navigation.playground.StaticLifecycleOverlay')).toBeVisible();
@@ -26,7 +26,7 @@ describe('static lifecycle events', () => {
26 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 30
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
31 31
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
32 32
     await expect(elementByLabel('componentDidAppear | navigation.playground.StaticLifecycleOverlay')).toBeVisible();
@@ -36,7 +36,7 @@ describe('static lifecycle events', () => {
36 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 40
     await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
41 41
     await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
42 42
     await elementById(testIDs.DISMISS_BUTTON).tap();

+ 5
- 5
e2e/TopLevelApi.test.js View File

@@ -8,30 +8,30 @@ describe('top level api', () => {
8 8
     await device.relaunchApp();
9 9
   });
10 10
 
11
-  it('shows welcome screen', async () => {
11
+  test('shows welcome screen', async () => {
12 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 16
     await elementById(testIDs.TAB_BASED_APP_BUTTON).tap();
17 17
     await expect(elementByLabel('This is tab 1')).toBeVisible();
18 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 22
     await elementById(testIDs.TAB_BASED_APP_SIDE_BUTTON).tap();
23 23
     await elementById(testIDs.CENTERED_TEXT_HEADER).swipe('right');
24 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 28
     await elementById(testIDs.PUSH_LIFECYCLE_BUTTON).tap();
29 29
     await expect(elementByLabel('didAppear')).toBeVisible();
30 30
     await elementById(testIDs.PUSH_TO_TEST_DID_DISAPPEAR_BUTTON).tap();
31 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 35
     await elementById(testIDs.PUSH_LIFECYCLE_BUTTON).tap();
36 36
     await expect(elementByLabel('didAppear')).toBeVisible();
37 37
     await elementById(testIDs.POP_BUTTON).tap();

+ 6
- 0
e2e/config.json View File

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

+ 11
- 2
e2e/init.js View File

@@ -1,16 +1,25 @@
1 1
 const detox = require('detox');
2 2
 const config = require('../package.json').detox;
3 3
 const exec = require('shell-utils').exec;
4
+jest.setTimeout(180000);
4 5
 
5
-before(async () => {
6
+beforeAll(async () => {
6 7
   await detox.init(config, { launchApp: false });
7 8
   disableAndroidEmulatorAnimations();
8 9
 });
9 10
 
10
-after(async () => {
11
+afterAll(async () => {
11 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 23
 function disableAndroidEmulatorAnimations() {
15 24
   if (device.getPlatform() === 'android') {
16 25
     const deviceId = device._deviceId;

+ 0
- 1
e2e/mocha.opts View File

@@ -1 +0,0 @@
1
---recursive --timeout 300000 --bail

+ 2
- 3
package.json View File

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

+ 3
- 1
scripts/test-e2e.js View File

@@ -5,6 +5,7 @@ const android = _.includes(process.argv, '--android');
5 5
 const release = _.includes(process.argv, '--release');
6 6
 const skipBuild = _.includes(process.argv, '--skipBuild');
7 7
 const headless = _.includes(process.argv, '--headless');
8
+const multi = _.includes(process.argv, '--multi');
8 9
 
9 10
 run();
10 11
 
@@ -15,9 +16,10 @@ function run() {
15 16
     const configuration = `${prefix}.${suffix}`;
16 17
     const cleanup = process.env.CI ? `--cleanup` : ``;
17 18
     const headless$ = android ? headless ? `--headless` : `` : ``;
19
+    const workers = multi ? 2 : 1;
18 20
 
19 21
     if (!skipBuild) {
20 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 View File

@@ -14,7 +14,7 @@ const dirs = [
14 14
 run();
15 15
 
16 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 18
   exec.execSync(`tslint ${paths} ${fix} --format verbose`);
19 19
   assertAllTsFilesInSrc();
20 20
   exec.execSync(`jest --coverage`);