Przeglądaj źródła

refactor e2e tests

Ran Greenberg 7 lat temu
rodzic
commit
ffe86e383f
1 zmienionych plików z 31 dodań i 19 usunięć
  1. 31
    19
      playground/e2e/app.test.js

+ 31
- 19
playground/e2e/app.test.js Wyświetl plik

@@ -13,11 +13,6 @@ describe('app', () => {
13 13
     expect(elementByLabel('Hello from a function!')).toBeVisible();
14 14
   });
15 15
 
16
-  it('push screen', () => {
17
-    elementByLabel('Push').tap();
18
-    expect(elementByLabel('Pushed Screen')).toBeVisible();
19
-  });
20
-
21 16
   it('switch to tabs with side menus', () => {
22 17
     elementByLabel('Switch to app with side menus').tap();
23 18
     elementByLabel('This is a side menu center screen tab 1').swipe('right');
@@ -31,6 +26,17 @@ describe('app', () => {
31 26
     expect(elementByLabel('Alert')).toBeVisible();
32 27
     expect(elementByLabel('onStop!')).toBeVisible();
33 28
   });
29
+});
30
+
31
+describe('screen stack', () => {
32
+  beforeEach((done) => {
33
+    global.simulator.relaunchApp(done);
34
+  });
35
+
36
+  it('push screen', () => {
37
+    elementByLabel('Push').tap();
38
+    expect(elementByLabel('Pushed Screen')).toBeVisible();
39
+  });
34 40
 
35 41
   it('pop screen', () => {
36 42
     elementByLabel('Push').tap();
@@ -39,7 +45,7 @@ describe('app', () => {
39 45
     expect(elementByLabel('React Native Navigation!')).toBeVisible();
40 46
   });
41 47
   
42
-  it.only('pop screen deep in the stack', () => {
48
+  it('pop screen deep in the stack', () => {
43 49
     elementByLabel('Push').tap();
44 50
     expect(elementByLabel('Stack Position: 1')).toBeVisible();
45 51
     elementByLabel('Push').tap();
@@ -48,21 +54,27 @@ describe('app', () => {
48 54
     expect(elementByLabel('Stack Position: 2')).toBeVisible();
49 55
     elementByLabel('Pop').tap();
50 56
     expect(elementByLabel('React Native Navigation!')).toBeVisible();
51
-  
52 57
   });
58
+});
59
+
53 60
 
61
+describe('modal', () => {
62
+  beforeEach((done) => {
63
+    global.simulator.relaunchApp(done);
64
+  });
65
+  
54 66
   it('show modal', () => {
55 67
     elementByLabel('Show Modal').tap();
56 68
     expect(elementByLabel('Modal Screen')).toBeVisible();
57 69
   });
58
-
70
+  
59 71
   it('dismiss modal', () => {
60 72
     elementByLabel('Show Modal').tap();
61 73
     expect(elementByLabel('Modal Screen')).toBeVisible();
62 74
     elementByLabel('Dismiss Modal').tap();
63 75
     expect(elementByLabel('React Native Navigation!')).toBeVisible();
64 76
   });
65
-
77
+  
66 78
   it('show multiple modals', () => {
67 79
     elementByLabel('Show Modal').tap();
68 80
     expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
@@ -73,7 +85,7 @@ describe('app', () => {
73 85
     elementByLabel('Dismiss Modal').tap();
74 86
     expect(elementByLabel('React Native Navigation!')).toBeVisible();
75 87
   });
76
-
88
+  
77 89
   it('dismiss unknown screen id', () => {
78 90
     elementByLabel('Show Modal').tap();
79 91
     expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
@@ -82,7 +94,7 @@ describe('app', () => {
82 94
     elementByLabel('Dismiss Modal').tap();
83 95
     expect(elementByLabel('React Native Navigation!')).toBeVisible();
84 96
   });
85
-
97
+  
86 98
   it('dismiss modal by id which is not the top most', () => {
87 99
     elementByLabel('Show Modal').tap();
88 100
     expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
@@ -93,7 +105,7 @@ describe('app', () => {
93 105
     elementByLabel('Dismiss Modal').tap();
94 106
     expect(elementByLabel('React Native Navigation!')).toBeVisible();
95 107
   });
96
-
108
+  
97 109
   it('dismiss all previous modals by id when they are below top presented modal', () => {
98 110
     elementByLabel('Show Modal').tap();
99 111
     expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
@@ -101,14 +113,14 @@ describe('app', () => {
101 113
     expect(elementByLabel('Modal Stack Position: 2')).toBeVisible();
102 114
     elementByLabel('Show Modal').tap();
103 115
     expect(elementByLabel('Modal Stack Position: 3')).toBeVisible();
104
-
116
+    
105 117
     elementByLabel('Dismiss ALL Previous Modals').tap();
106 118
     expect(elementByLabel('Modal Stack Position: 3')).toBeVisible();
107
-
119
+    
108 120
     elementByLabel('Dismiss Modal').tap();
109 121
     expect(elementByLabel('React Native Navigation!')).toBeVisible();
110 122
   });
111
-
123
+  
112 124
   it('dismiss some modal by id deep in the stack', () => {
113 125
     elementByLabel('Show Modal').tap();
114 126
     expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();
@@ -116,17 +128,17 @@ describe('app', () => {
116 128
     expect(elementByLabel('Modal Stack Position: 2')).toBeVisible();
117 129
     elementByLabel('Show Modal').tap();
118 130
     expect(elementByLabel('Modal Stack Position: 3')).toBeVisible();
119
-
131
+    
120 132
     elementByLabel('Dismiss First In Stack').tap();
121 133
     expect(elementByLabel('Modal Stack Position: 3')).toBeVisible();
122
-
134
+    
123 135
     elementByLabel('Dismiss Modal').tap();
124 136
     expect(elementByLabel('Modal Stack Position: 2')).toBeVisible();
125
-
137
+    
126 138
     elementByLabel('Dismiss Modal').tap();
127 139
     expect(elementByLabel('React Native Navigation!')).toBeVisible();
128 140
   });
129
-
141
+  
130 142
   it('dismissAllModals', () => {
131 143
     elementByLabel('Show Modal').tap();
132 144
     expect(elementByLabel('Modal Stack Position: 1')).toBeVisible();