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
 package com.reactnativenavigation.e2e.androide2e;
1
 package com.reactnativenavigation.e2e.androide2e;
2
 
2
 
3
 import android.support.test.uiautomator.By;
3
 import android.support.test.uiautomator.By;
4
+import android.support.test.uiautomator.UiObjectNotFoundException;
4
 
5
 
5
 import org.junit.Test;
6
 import org.junit.Test;
6
 
7
 
7
 public class OverlayTest extends BaseTest {
8
 public class OverlayTest extends BaseTest {
8
 
9
 
9
 	@Test
10
 	@Test
10
-	public void testOverlayInterAlertAppear() throws Exception {
11
+	public void testOverlayAlertAppear() throws Exception {
11
 		elementByText("PUSH OPTIONS SCREEN").click();
12
 		elementByText("PUSH OPTIONS SCREEN").click();
12
-        elementByText("SHOW OVERLAY INTER").click();
13
+        elementByText("SHOW OVERLAY").click();
13
 		assertExists(By.text("Test view"));
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
 		elementByText("PUSH OPTIONS SCREEN").click();
20
 		elementByText("PUSH OPTIONS SCREEN").click();
22
-        elementByText("SHOW TOUCH THROUGH OVERLAY NOTINTER").click();
21
+        elementByText("SHOW TOUCH THROUGH OVERLAY").click();
23
 		assertExists(By.text("Test view"));
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
         <Button title="Custom Transition" onPress={this.onClickCustomTranstition} />
66
         <Button title="Custom Transition" onPress={this.onClickCustomTranstition} />
67
         <Button title="Show custom alert" testID={testIDs.SHOW_CUSTOM_ALERT_BUTTON} onPress={this.onClickAlert} />
67
         <Button title="Show custom alert" testID={testIDs.SHOW_CUSTOM_ALERT_BUTTON} onPress={this.onClickAlert} />
68
         <Button title="Show snackbar" testID={testIDs.SHOW_SNACKBAR_BUTTON} onPress={this.onClickSnackbar} />
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
         <Button title="Push Default Options Screen" testID={testIDs.PUSH_DEFAULT_OPTIONS_BUTTON} onPress={this.onClickPushDefaultOptionsScreen} />
71
         <Button title="Push Default Options Screen" testID={testIDs.PUSH_DEFAULT_OPTIONS_BUTTON} onPress={this.onClickPushDefaultOptionsScreen} />
72
         <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
72
         <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
73
       </View>
73
       </View>