Bladeren bron

More Detox related work

Guy Carmeli 6 jaren geleden
bovenliggende
commit
8045c23da2
4 gewijzigde bestanden met toevoegingen van 23 en 3 verwijderingen
  1. 2
    1
      e2e/Modals.test.js
  2. 2
    1
      e2e/Orientations.test.js
  3. 1
    1
      e2e/ScreenStack.test.js
  4. 18
    0
      e2e/StaticLifecycleEvents.test.js

+ 2
- 1
e2e/Modals.test.js Bestand weergeven

@@ -1,5 +1,6 @@
1 1
 const Utils = require('./Utils');
2 2
 const testIDs = require('../playground/src/testIDs');
3
+const Android = require('./AndroidUtils');
3 4
 
4 5
 const { elementByLabel, elementById, tapDeviceBackAndroid } = Utils;
5 6
 
@@ -103,7 +104,7 @@ describe('modal', () => {
103 104
     await elementById(testIDs.SHOW_MODAL_BUTTON).tap();
104 105
     await elementById(testIDs.PUSH_BUTTON).tap();
105 106
     await elementById(testIDs.PUSH_BUTTON).tap();
106
-    tapDeviceBackAndroid();
107
+    Android.pressBack();
107 108
     await expect(elementByLabel('Pushed Screen')).toBeVisible();
108 109
   });
109 110
 });

+ 2
- 1
e2e/Orientations.test.js Bestand weergeven

@@ -8,7 +8,7 @@ describe('orientation', () => {
8 8
 
9 9
   beforeEach(async () => {
10 10
     await device.relaunchApp();
11
-    waitForDeviceToSettleAfterOrientationChangeAndroid = ms => new Promise(res => setTimeout(res, device.getPlatform() === 'ios' ? 0 : 10));
11
+    waitForDeviceToSettleAfterOrientationChangeAndroid = ms => new Promise(res => setTimeout(res, device.getPlatform() === 'ios' ? 0 : 150));
12 12
   });
13 13
 
14 14
   it('default allows all', async () => {
@@ -30,6 +30,7 @@ describe('orientation', () => {
30 30
     await device.setOrientation('landscape');
31 31
     await expect(element(by.id(testIDs.LANDSCAPE_ELEMENT))).toBeVisible();
32 32
     await device.setOrientation('portrait');
33
+    waitForDeviceToSettleAfterOrientationChangeAndroid();
33 34
     await expect(element(by.id(testIDs.PORTRAIT_ELEMENT))).toBeVisible();
34 35
     await elementById(testIDs.DISMISS_BUTTON).tap();
35 36
   });

+ 1
- 1
e2e/ScreenStack.test.js Bestand weergeven

@@ -75,7 +75,7 @@ describe('screen stack', () => {
75 75
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
76 76
   });
77 77
 
78
-  it.only(':android: override hardware back button', async () => {
78
+  it(':android: override hardware back button', async () => {
79 79
     await elementByLabel('BACK HANDLER').tap();
80 80
     await expect(elementByLabel('Back Handler Screen')).toBeVisible();
81 81
 

+ 18
- 0
e2e/StaticLifecycleEvents.test.js Bestand weergeven

@@ -0,0 +1,18 @@
1
+const Utils = require('./Utils');
2
+const testIDs = require('../playground/src/testIDs');
3
+const { elementByLabel, elementById } = Utils;
4
+
5
+describe('Overlay', () => {
6
+  beforeEach(async () => {
7
+    await device.relaunchApp();
8
+  });
9
+
10
+  it('didAppear didDisappear', async () => {
11
+    await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
12
+    await expect(elementByLabel('Static Lifecycle Events')).toBeVisible();
13
+    await expect(elementByLabel('didAppear | navigation.playground.StaticLifecycleOverlay')).toBeVisible();
14
+    await elementByLabel('PUSH').tap();
15
+    await expect(elementByLabel('didAppear | navigation.playground.PushedScreen')).toBeVisible();
16
+    await expect(elementByLabel('didDisappear | navigation.playground.WelcomeScreen')).toBeVisible();
17
+  });
18
+});