Browse Source

missing case

Daniel Zlotin 7 years ago
parent
commit
3b8d10ac00

+ 38
- 0
playground/e2e/app.test.android.js View File

1
+xdescribe('app android', () => {
2
+  beforeEach((done) => {
3
+    global.simulator.relaunchApp(done);
4
+  });
5
+
6
+  it('shows welcome screen', () => {
7
+    expect(elementByLabel('React Native Navigation!')).toBeVisible();
8
+  });
9
+
10
+  it('switch to tab based app, passProps and functions', () => {
11
+    elementByLabel('Switch to tab based app').tap();
12
+    expect(elementByLabel('This is tab 1')).toBeVisible();
13
+    expect(elementByLabel('Hello from a function!')).toBeVisible();
14
+  });
15
+
16
+  it('push screen', () => {
17
+    elementByLabel('Push').tap();
18
+    expect(elementByLabel('Pushed screen')).toBeVisible();
19
+  });
20
+
21
+  xit('switch to tabs with side menus', () => {
22
+    elementByLabel('Switch to tab based app with side menus').tap();
23
+    elementByLabel('Switch to tab based app with side menus').swipeRight();
24
+    expect(elementByLabel('This is a side menu screen')).toBeVisible();
25
+  });
26
+
27
+  it('screen lifecycle', () => {
28
+    elementByLabel('Switch to lifecycle screen').tap();
29
+    expect(elementByLabel('onStart!')).toBeVisible();
30
+    elementByLabel('Push to test onStop').tap();
31
+    expect(elementByLabel('Alert')).toBeVisible();
32
+    expect(elementByLabel('onStop!')).toBeVisible();
33
+  });
34
+});
35
+
36
+function elementByLabel(label) {
37
+  return element(by.label(label));
38
+}

playground/e2e/app.test.js → playground/e2e/app.test.ios.js View File

1
-describe('app', () => {
1
+describe('app ios', () => {
2
   beforeEach((done) => {
2
   beforeEach((done) => {
3
     global.simulator.relaunchApp(done);
3
     global.simulator.relaunchApp(done);
4
   });
4
   });

+ 7
- 0
src/containers/ContainerWrapper.test.js View File

149
       }
149
       }
150
     }
150
     }
151
 
151
 
152
+    it('onStart and onStop are optional', () => {
153
+      const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
154
+      const tree = renderer.create(<NavigationContainer id={'container1'} />);
155
+      expect(() => tree.getInstance().onStart()).not.toThrow();
156
+      expect(() => tree.getInstance().onStop()).not.toThrow();
157
+    });
158
+
152
     it('calls onStart on OriginalContainer', () => {
159
     it('calls onStart on OriginalContainer', () => {
153
       const NavigationContainer = ContainerWrapper.wrap(containerName, MyLifecycleContainer, store);
160
       const NavigationContainer = ContainerWrapper.wrap(containerName, MyLifecycleContainer, store);
154
       const tree = renderer.create(<NavigationContainer id={'container1'} />);
161
       const tree = renderer.create(<NavigationContainer id={'container1'} />);