Browse Source

Test not intercepting overlay (#2598)

Guy Carmeli 6 years ago
parent
commit
b541d796b5
No account linked to committer's email address

+ 16
- 11
AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/OverlayTest.java View File

@@ -1,28 +1,33 @@
1 1
 package com.reactnativenavigation.e2e.androide2e;
2 2
 
3 3
 import android.support.test.uiautomator.By;
4
+import android.support.test.uiautomator.UiObjectNotFoundException;
4 5
 
5 6
 import org.junit.Test;
6 7
 
7 8
 public class OverlayTest extends BaseTest {
8 9
 
9 10
 	@Test
10
-	public void testOverlayInterAlertAppear() throws Exception {
11
+	public void testOverlayAlertAppear() throws Exception {
11 12
 		elementByText("PUSH OPTIONS SCREEN").click();
12
-        elementByText("SHOW OVERLAY INTER").click();
13
+        elementByText("SHOW OVERLAY").click();
13 14
 		assertExists(By.text("Test view"));
14
-		elementByText("OK").click();
15
-		assertExists(By.text("Overlay disappeared"));
16
-        elementByText("OK").click();
15
+        assetDismissed();
17 16
 	}
18 17
 
19
-	@Test
20
-	public void testOverlayNotInterAlertAppear() throws Exception {
18
+    @Test
19
+	public void testOverlayNotInterceptingTouchEvents() throws Exception {
21 20
 		elementByText("PUSH OPTIONS SCREEN").click();
22
-        elementByText("SHOW TOUCH THROUGH OVERLAY NOTINTER").click();
21
+        elementByText("SHOW TOUCH THROUGH OVERLAY").click();
23 22
 		assertExists(By.text("Test view"));
24
-		elementByText("OK").click();
25
-		assertExists(By.text("Overlay disappeared"));
26
-        elementByText("OK").click();
23
+        elementByText("DYNAMIC OPTIONS").click();
24
+        assertExists(By.text("Dynamic Title"));
25
+        assetDismissed();
27 26
 	}
27
+
28
+    private void assetDismissed() throws UiObjectNotFoundException {
29
+        elementByText("OK").click();
30
+        assertExists(By.text("Overlay disappeared"));
31
+        elementByText("OK").click();
32
+    }
28 33
 }

+ 2
- 2
playground/src/screens/OptionsScreen.js View File

@@ -66,8 +66,8 @@ class OptionsScreen extends Component {
66 66
         <Button title="Custom Transition" onPress={this.onClickCustomTranstition} />
67 67
         <Button title="Show custom alert" testID={testIDs.SHOW_CUSTOM_ALERT_BUTTON} onPress={this.onClickAlert} />
68 68
         <Button title="Show snackbar" testID={testIDs.SHOW_SNACKBAR_BUTTON} onPress={this.onClickSnackbar} />
69
-        <Button title="Show overlay inter" testID={testIDs.SHOW_OVERLAY_BUTTON} onPress={() => this.onClickShowOverlay(true)} />
70
-        <Button title="Show touch through overlay notInter" testID={testIDs.SHOW_TOUCH_THROUGH_OVERLAY_BUTTON} onPress={() => this.onClickShowOverlay(false)} />
69
+        <Button title="Show overlay" testID={testIDs.SHOW_OVERLAY_BUTTON} onPress={() => this.onClickShowOverlay(true)} />
70
+        <Button title="Show touch through overlay" testID={testIDs.SHOW_TOUCH_THROUGH_OVERLAY_BUTTON} onPress={() => this.onClickShowOverlay(false)} />
71 71
         <Button title="Push Default Options Screen" testID={testIDs.PUSH_DEFAULT_OPTIONS_BUTTON} onPress={this.onClickPushDefaultOptionsScreen} />
72 72
         <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
73 73
       </View>