Browse Source

TopTabs e2e (#2337)

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

+ 2
- 2
AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/TopLevelApiTest.java View File

@@ -17,8 +17,8 @@ public class TopLevelApiTest extends BaseTest {
17 17
 	public void switchToTabBasedApp_SwitchTab() throws Exception {
18 18
 		elementByText("SWITCH TO TAB BASED APP").click();
19 19
 		assertExists(By.text("This is tab 1"));
20
-    elementByText("SWITCH TO TAB 2").click();
21
-    assertExists(By.text("This is tab 2"));
20
+        elementByText("SWITCH TO TAB 2").click();
21
+        assertExists(By.text("This is tab 2"));
22 22
 	}
23 23
 
24 24
 	@Test

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

@@ -0,0 +1,16 @@
1
+package com.reactnativenavigation.e2e.androide2e;
2
+
3
+import android.support.test.uiautomator.By;
4
+
5
+import org.junit.Test;
6
+
7
+public class TopTabsTest extends BaseTest {
8
+
9
+    @Test
10
+    public void tabsCanBeSwiped() throws Exception {
11
+        elementByText("PUSH TOP TABS SCREEN").click();
12
+        assertExists(By.text("This is top tab 1"));
13
+        device().swipe(400, 400, 10, 400, 2);
14
+        assertExists(By.text("This is top tab 2"));
15
+    }
16
+}

+ 1
- 1
lib/src/commands/LayoutTreeCrawler.js View File

@@ -14,7 +14,7 @@ class LayoutTreeCrawler {
14 14
     node.id = this.uniqueIdProvider.generate(node.type);
15 15
     node.data = node.data || {};
16 16
     node.children = node.children || [];
17
-    if (node.type === LayoutTypes.Container) {
17
+    if ([LayoutTypes.Container, LayoutTypes.TopTab].includes(node.type)) {
18 18
       this._handleContainer(node);
19 19
     }
20 20
     _.forEach(node.children, this.crawl);

+ 1
- 1
playground/src/containers/WelcomeScreen.js View File

@@ -34,7 +34,7 @@ class WelcomeScreen extends Component {
34 34
         <Button title="Push Lifecycle Screen" testID={testIDs.PUSH_LIFECYCLE_BUTTON} onPress={this.onClickLifecycleScreen} />
35 35
         <Button title="Push" testID={testIDs.PUSH_BUTTON} onPress={this.onClickPush} />
36 36
         <Button title="Push Options Screen" testID={testIDs.PUSH_OPTIONS_BUTTON} onPress={this.onClickPushOptionsScreen} />
37
-        <Button title="Push TopTabs screen" testID={testIDs.PUSH_TOP_TABS_BUTTON} onPress={this.onClickPushTopTabsScreen} />
37
+        <Button title="Push Top Tabs screen" testID={testIDs.PUSH_TOP_TABS_BUTTON} onPress={this.onClickPushTopTabsScreen} />
38 38
         <Button title="Back Handler" testID={testIDs.BACK_HANDLER_BUTTON} onPress={this.onClickBackHandler} />
39 39
         <Button title="Show Modal" testID={testIDs.SHOW_MODAL_BUTTON} onPress={this.onClickShowModal} />
40 40
         <Button title="Show Redbox" testID={testIDs.SHOW_REDBOX_BUTTON} onPress={this.onClickShowRedbox} />