Browse Source

removed android e2e with uiautomator, replaced by detox tests

Daniel Zlotin 6 years ago
parent
commit
c588004290
42 changed files with 25 additions and 1146 deletions
  1. 0
    9
      AndroidE2E/.gitignore
  2. 0
    1
      AndroidE2E/app/.gitignore
  3. 0
    31
      AndroidE2E/app/build.gradle
  4. 0
    17
      AndroidE2E/app/proguard-rules.pro
  5. 0
    132
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/ApplicationLifecycleTest.java
  6. 0
    22
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/BackHandlerTest.java
  7. 0
    114
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/BaseTest.java
  8. 0
    17
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/EnvironmentTest.java
  9. 0
    128
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/ModalsTest.java
  10. 0
    50
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/NavigationOptionsTest.java
  11. 0
    33
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/OverlayTest.java
  12. 0
    30
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/ScreenLifecycleTest.java
  13. 0
    57
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/ScreenStackTest.java
  14. 0
    17
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/StaticLifecycleEvents.java
  15. 0
    31
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/TopLevelApiTest.java
  16. 0
    12
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/TopTabsTest.java
  17. 0
    17
      AndroidE2E/app/src/main/AndroidManifest.xml
  18. BIN
      AndroidE2E/app/src/main/res/mipmap-hdpi/ic_launcher.png
  19. BIN
      AndroidE2E/app/src/main/res/mipmap-mdpi/ic_launcher.png
  20. BIN
      AndroidE2E/app/src/main/res/mipmap-xhdpi/ic_launcher.png
  21. BIN
      AndroidE2E/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  22. BIN
      AndroidE2E/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
  23. 0
    6
      AndroidE2E/app/src/main/res/values/colors.xml
  24. 0
    3
      AndroidE2E/app/src/main/res/values/strings.xml
  25. 0
    11
      AndroidE2E/app/src/main/res/values/styles.xml
  26. 0
    23
      AndroidE2E/build.gradle
  27. 0
    17
      AndroidE2E/gradle.properties
  28. BIN
      AndroidE2E/gradle/wrapper/gradle-wrapper.jar
  29. 0
    6
      AndroidE2E/gradle/wrapper/gradle-wrapper.properties
  30. 0
    160
      AndroidE2E/gradlew
  31. 0
    90
      AndroidE2E/gradlew.bat
  32. 0
    1
      AndroidE2E/settings.gradle
  33. 3
    4
      docs/docs/WorkingLocally.md
  34. 1
    1
      e2e/OverlayTest.test.js
  35. 2
    3
      package.json
  36. 0
    2
      scripts/clean.js
  37. 1
    0
      scripts/local-docs.js
  38. 0
    12
      scripts/test-e2e-android-detox.js
  39. 0
    56
      scripts/test-e2e-android.js
  40. 0
    12
      scripts/test-e2e-ios.js
  41. 18
    0
      scripts/test-e2e.js
  42. 0
    21
      scripts/waitForAndroidEmulator.sh

+ 0
- 9
AndroidE2E/.gitignore View File

@@ -1,9 +0,0 @@
1
-*.iml
2
-.gradle
3
-/local.properties
4
-/.idea/workspace.xml
5
-/.idea/libraries
6
-.DS_Store
7
-/build
8
-/captures
9
-.externalNativeBuild

+ 0
- 1
AndroidE2E/app/.gitignore View File

@@ -1 +0,0 @@
1
-/build

+ 0
- 31
AndroidE2E/app/build.gradle View File

@@ -1,31 +0,0 @@
1
-apply plugin: 'com.android.application'
2
-
3
-android {
4
-    compileOptions {
5
-        sourceCompatibility JavaVersion.VERSION_1_8
6
-        targetCompatibility JavaVersion.VERSION_1_8
7
-    }
8
-
9
-    compileSdkVersion 27
10
-    buildToolsVersion "27.0.3"
11
-    defaultConfig {
12
-        applicationId "com.reactnativenavigation.e2e.androide2e"
13
-        minSdkVersion 24
14
-        targetSdkVersion 27
15
-        versionCode 1
16
-        versionName "1.0"
17
-
18
-        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
19
-    }
20
-}
21
-
22
-dependencies {
23
-    implementation fileTree(dir: 'libs', include: ['*.jar'])
24
-    implementation 'com.android.support:appcompat-v7:27.0.2'
25
-
26
-    androidTestImplementation 'org.assertj:assertj-core:3.8.0'
27
-    androidTestImplementation 'com.android.support:support-annotations:27.0.2'
28
-    androidTestImplementation 'com.android.support.test:runner:1.0.1'
29
-    androidTestImplementation 'com.android.support.test:rules:1.0.1'
30
-    androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
31
-}

+ 0
- 17
AndroidE2E/app/proguard-rules.pro View File

@@ -1,17 +0,0 @@
1
-# Add project specific ProGuard rules here.
2
-# By default, the flags in this file are appended to flags specified
3
-# in /Users/danielzl/Library/Android/sdk/tools/proguard/proguard-android.txt
4
-# You can edit the include path and order by changing the proguardFiles
5
-# directive in build.gradle.
6
-#
7
-# For more details, see
8
-#   http://developer.android.com/guide/developing/tools/proguard.html
9
-
10
-# Add any project specific keep options here:
11
-
12
-# If your project uses WebView with JS, uncomment the following
13
-# and specify the fully qualified class name to the JavaScript interface
14
-# class:
15
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
-#   public *;
17
-#}

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

@@ -1,132 +0,0 @@
1
-package com.reactnativenavigation.e2e.androide2e;
2
-
3
-import android.content.*;
4
-import android.net.*;
5
-import android.provider.*;
6
-import android.support.test.uiautomator.*;
7
-import android.view.*;
8
-
9
-import org.junit.*;
10
-
11
-import static android.support.test.InstrumentationRegistry.*;
12
-
13
-public class ApplicationLifecycleTest extends BaseTest {
14
-
15
-    @Test
16
-    public void relaunchFromBackground() throws Exception {
17
-        elementByText("PUSH").click();
18
-        assertExists(By.text("Pushed Screen"));
19
-
20
-        device().pressHome();
21
-        device().pressRecentApps();
22
-        elementByText("Playground").click();
23
-
24
-        assertExists(By.text("Pushed Screen"));
25
-    }
26
-
27
-    @Test
28
-    public void relaunchAfterClose() throws Exception {
29
-        elementByText("PUSH").click();
30
-        assertExists(By.text("Pushed Screen"));
31
-
32
-        device().pressBack();
33
-
34
-        launchTheApp();
35
-        assertMainShown();
36
-    }
37
-
38
-    @Test
39
-    public void deviceOrientationDoesNotDestroyActivity() throws Exception {
40
-        elementByText("PUSH").click();
41
-        assertExists(By.text("Pushed Screen"));
42
-
43
-        device().setOrientationLeft();
44
-        Thread.sleep(100);
45
-
46
-        assertExists(By.text("Pushed Screen"));
47
-    }
48
-
49
-    @Test
50
-    public void relaunchAfterActivityKilledBySystem() throws Exception {
51
-        elementByText("PUSH").click();
52
-        assertExists(By.text("Pushed Screen"));
53
-
54
-        killAppSaveInstanceState_ByTogglingPermissions();
55
-
56
-        device().pressRecentApps();
57
-        elementByText("Playground").click();
58
-        assertMainShown();
59
-    }
60
-
61
-    @Test
62
-    public void pressingMenuOpensDevMenu() throws Exception {
63
-        Assume.assumeTrue(isDebug());
64
-        device().pressKeyCode(KeyEvent.KEYCODE_MENU);
65
-        assertExists(By.text("Debug JS Remotely"));
66
-    }
67
-
68
-    @Test
69
-    public void pressingRTwiceInSuccessionReloadsReactNative() throws Exception {
70
-        Assume.assumeTrue(isDebug());
71
-
72
-        elementByText("PUSH").click();
73
-        assertExists(By.text("Pushed Screen"));
74
-
75
-        device().pressKeyCode(KeyEvent.KEYCODE_R);
76
-        device().pressKeyCode(KeyEvent.KEYCODE_R);
77
-        device().waitForIdle();
78
-        assertMainShown();
79
-    }
80
-
81
-    @Test
82
-    public void pressingRTwiceWithDelayDoesNothing() throws Exception {
83
-        Assume.assumeTrue(isDebug());
84
-
85
-        elementByText("PUSH").click();
86
-        assertExists(By.text("Pushed Screen"));
87
-
88
-        device().pressKeyCode(KeyEvent.KEYCODE_R);
89
-        Thread.sleep(1500);
90
-        device().pressKeyCode(KeyEvent.KEYCODE_R);
91
-        assertExists(By.text("Pushed Screen"));
92
-    }
93
-
94
-    @Test
95
-    public void sendingReloadBroadcastReloadsReactNative() throws Exception {
96
-        Assume.assumeTrue(isDebug());
97
-
98
-        elementByText("PUSH").click();
99
-        assertExists(By.text("Pushed Screen"));
100
-
101
-        device().executeShellCommand("am broadcast -a com.reactnativenavigation.broadcast.RELOAD");
102
-        device().waitForIdle();
103
-        assertMainShown();
104
-    }
105
-
106
-    private void killAppSaveInstanceState_ByTogglingPermissions() throws Exception {
107
-        device().pressHome();
108
-
109
-        device().waitForIdle();
110
-        launchAppInfoSettings();
111
-        device().waitForIdle();
112
-
113
-        elementByText("Permissions").click();
114
-        elementByText("Storage").click();
115
-        elementByText("Storage").click();
116
-        device().pressBack();
117
-        device().pressBack();
118
-        device().pressHome();
119
-        device().waitForIdle();
120
-    }
121
-
122
-    private void launchAppInfoSettings() {
123
-        Intent intent = new Intent();
124
-        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
125
-        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
126
-        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
127
-        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
128
-        Uri uri = Uri.fromParts("package", PACKAGE_NAME, null);
129
-        intent.setData(uri);
130
-        getInstrumentation().getTargetContext().startActivity(intent);
131
-    }
132
-}

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

@@ -1,22 +0,0 @@
1
-package com.reactnativenavigation.e2e.androide2e;
2
-
3
-import android.support.test.uiautomator.*;
4
-
5
-import org.junit.*;
6
-
7
-public class BackHandlerTest extends BaseTest {
8
-    @Test
9
-    public void overrideHardwareBackButton() throws Exception {
10
-        elementByText("BACK HANDLER").click();
11
-        assertExists(By.text("Back Handler Screen"));
12
-
13
-        elementByText("ADD BACK HANDLER").click();
14
-        device().pressBack();
15
-        assertExists(By.text("Back Handler Screen"));
16
-
17
-
18
-        elementByText("REMOVE BACK HANDLER").click();
19
-        device().pressBack();
20
-        assertMainShown();
21
-    }
22
-}

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

@@ -1,114 +0,0 @@
1
-package com.reactnativenavigation.e2e.androide2e;
2
-
3
-import android.content.pm.*;
4
-import android.graphics.*;
5
-import android.support.test.runner.*;
6
-import android.support.test.uiautomator.*;
7
-
8
-import org.junit.*;
9
-import org.junit.runner.*;
10
-
11
-import java.io.*;
12
-
13
-import static android.support.test.InstrumentationRegistry.*;
14
-import static org.assertj.core.api.Java6Assertions.*;
15
-
16
-@RunWith(AndroidJUnit4.class)
17
-public abstract class BaseTest {
18
-    static final String PACKAGE_NAME = "com.reactnativenavigation.playground";
19
-    private static final long TIMEOUT = 60000;
20
-
21
-    @Before
22
-    public void beforeEach() throws Exception {
23
-        device().wakeUp();
24
-        device().setOrientationNatural();
25
-        launchTheApp();
26
-        assertMainShown();
27
-    }
28
-
29
-    @After
30
-    public void afterEach() throws Exception {
31
-        device().executeShellCommand("am force-stop " + PACKAGE_NAME);
32
-        device().executeShellCommand("am kill " + PACKAGE_NAME);
33
-    }
34
-
35
-    public UiDevice device() {
36
-        return UiDevice.getInstance(getInstrumentation());
37
-    }
38
-
39
-    public void launchTheApp() throws Exception {
40
-        device().executeShellCommand("am start -n " + PACKAGE_NAME + "/.MainActivity");
41
-        device().waitForIdle();
42
-        acceptOverlayPermissionIfNeeded();
43
-        device().wait(Until.gone(By.textContains("Please wait")), 1000 * 60 * 3);
44
-    }
45
-
46
-    public void assertMainShown() {
47
-        assertExists(By.text("React Native Navigation!"));
48
-    }
49
-
50
-    public void acceptOverlayPermissionIfNeeded() throws Exception {
51
-        if (isRequestingOverlayPermission()) {
52
-            if (!elementByText("Playground").exists()) {
53
-                scrollToText("Playground");
54
-            }
55
-            elementByText("Playground").click();
56
-            device().findObject(new UiSelector().checkable(true).checked(false)).click();
57
-            device().pressBack();
58
-            device().pressBack();
59
-        }
60
-    }
61
-
62
-    private boolean isRequestingOverlayPermission() {
63
-        return device().wait(Until.hasObject(By.pkg("com.android.settings").depth(0)), 300);
64
-    }
65
-
66
-    public UiObject elementByText(String text) {
67
-        return device().findObject(new UiSelector().text(text));
68
-    }
69
-
70
-    public UiObject elementByTextContains(String text) {
71
-        return device().findObject(new UiSelector().textContains(text));
72
-    }
73
-
74
-    public void scrollToText(String txt) throws Exception {
75
-        new UiScrollable(new UiSelector().scrollable(true)).scrollTextIntoView(txt);
76
-    }
77
-
78
-    public void assertExists(BySelector selector) {
79
-        assertThat(device().wait(Until.hasObject(selector), TIMEOUT)).withFailMessage("expected %1$s to be visible", selector).isTrue();
80
-        assertThat(device().findObject(selector).getVisibleCenter().x).isPositive().isLessThan(device().getDisplayWidth());
81
-        assertThat(device().findObject(selector).getVisibleCenter().y).isPositive().isLessThan(device().getDisplayHeight());
82
-    }
83
-
84
-    public Bitmap captureScreenshot() throws Exception {
85
-        File file = File.createTempFile("tmpE2E", "png");
86
-        device().takeScreenshot(file);
87
-        Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
88
-        file.delete();
89
-        return bitmap;
90
-    }
91
-
92
-    public void swipeOpenFromLeft() {
93
-        int w = device().getDisplayWidth();
94
-        int h = device().getDisplayHeight();
95
-        device().swipe(5, h / 2, w / 2, h / 2, 20);
96
-    }
97
-
98
-    public void swipeOpenFromRight() {
99
-        int w = device().getDisplayWidth();
100
-        int h = device().getDisplayHeight();
101
-        device().swipe(w - 5, h / 2, w / 2, h / 2, 20);
102
-    }
103
-
104
-    public void swipeUp() {
105
-        int w = device().getDisplayWidth();
106
-        int h = device().getDisplayHeight();
107
-        device().drag(w / 2, h / 2 + 100, w / 2, h / 2 - 100, 10);
108
-    }
109
-
110
-    public boolean isDebug() throws Exception {
111
-        PackageInfo packageInfo = getInstrumentation().getTargetContext().getPackageManager().getPackageInfo("com.reactnativenavigation.playground", 0);
112
-        return (packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
113
-    }
114
-}

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

@@ -1,17 +0,0 @@
1
-package com.reactnativenavigation.e2e.androide2e;
2
-
3
-import android.support.test.runner.*;
4
-
5
-import org.junit.*;
6
-import org.junit.runner.*;
7
-
8
-import static android.support.test.InstrumentationRegistry.*;
9
-import static org.assertj.core.api.Java6Assertions.*;
10
-
11
-@RunWith(AndroidJUnit4.class)
12
-public class EnvironmentTest {
13
-    @Test
14
-    public void instrumentationAndAssertJ() throws Exception {
15
-        assertThat(getInstrumentation().getTargetContext().getPackageName()).isEqualTo("com.reactnativenavigation.e2e.androide2e");
16
-    }
17
-}

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

@@ -1,128 +0,0 @@
1
-package com.reactnativenavigation.e2e.androide2e;
2
-
3
-import android.support.test.uiautomator.*;
4
-
5
-import org.junit.*;
6
-
7
-public class ModalsTest extends BaseTest {
8
-
9
-    @Test
10
-    public void showModal() throws Exception {
11
-        elementByText("SHOW MODAL").click();
12
-        assertExists(By.text("Modal Screen"));
13
-    }
14
-
15
-    @Test
16
-    public void dismissModal() throws Exception {
17
-        elementByText("SHOW MODAL").click();
18
-        assertExists(By.text("Modal Screen"));
19
-
20
-        elementByText("DISMISS MODAL").click();
21
-        assertMainShown();
22
-
23
-    }
24
-
25
-    @Test
26
-    public void showMultipleModals() throws Exception {
27
-        elementByText("SHOW MODAL").click();
28
-        assertExists(By.text("Modal Stack Position: 1"));
29
-
30
-        elementByText("SHOW MODAL").click();
31
-        assertExists(By.text("Modal Stack Position: 2"));
32
-
33
-        elementByText("DISMISS MODAL").click();
34
-        assertExists(By.text("Modal Stack Position: 1"));
35
-
36
-        elementByText("DISMISS MODAL").click();
37
-        assertMainShown();
38
-    }
39
-
40
-    @Test
41
-    public void dismissUnknownContainerId() throws Exception {
42
-        elementByText("SHOW MODAL").click();
43
-        assertExists(By.text("Modal Stack Position: 1"));
44
-
45
-        elementByText("DISMISS UNKNOWN MODAL").click();
46
-        assertExists(By.text("Modal Stack Position: 1"));
47
-
48
-        elementByText("DISMISS MODAL").click();
49
-        assertMainShown();
50
-    }
51
-
52
-    @Test
53
-    public void dismissModalByContainerIdWhenNotOnTop() throws Exception {
54
-        elementByText("SHOW MODAL").click();
55
-        assertExists(By.text("Modal Stack Position: 1"));
56
-
57
-        elementByText("SHOW MODAL").click();
58
-        assertExists(By.text("Modal Stack Position: 2"));
59
-
60
-        elementByText("DISMISS PREVIOUS MODAL").click();
61
-        assertExists(By.text("Modal Stack Position: 2"));
62
-
63
-        elementByText("DISMISS MODAL").click();
64
-        assertMainShown();
65
-    }
66
-
67
-    @Test
68
-    public void dismissAllPreviousModalsByIdWhenTheyAreBelowTopPresented() throws Exception {
69
-        elementByText("SHOW MODAL").click();
70
-        assertExists(By.text("Modal Stack Position: 1"));
71
-        elementByText("SHOW MODAL").click();
72
-        assertExists(By.text("Modal Stack Position: 2"));
73
-        elementByText("SHOW MODAL").click();
74
-        assertExists(By.text("Modal Stack Position: 3"));
75
-
76
-        elementByText("DISMISS ALL PREVIOUS MODALS").click();
77
-        assertExists(By.text("Modal Stack Position: 3"));
78
-
79
-        elementByText("DISMISS MODAL").click();
80
-        assertMainShown();
81
-    }
82
-
83
-    @Test
84
-    public void dismissSomeModalByIdDeepInTheStack() throws Exception {
85
-        elementByText("SHOW MODAL").click();
86
-        assertExists(By.text("Modal Stack Position: 1"));
87
-        elementByText("SHOW MODAL").click();
88
-        assertExists(By.text("Modal Stack Position: 2"));
89
-        elementByText("SHOW MODAL").click();
90
-        assertExists(By.text("Modal Stack Position: 3"));
91
-
92
-        elementByText("DISMISS FIRST IN STACK").click();
93
-        assertExists(By.text("Modal Stack Position: 3"));
94
-
95
-        elementByText("DISMISS MODAL").click();
96
-        assertExists(By.text("Modal Stack Position: 2"));
97
-
98
-        elementByText("DISMISS MODAL").click();
99
-        assertMainShown();
100
-    }
101
-
102
-    @Test
103
-    public void dismissAllModals() throws Exception {
104
-        elementByText("SHOW MODAL").click();
105
-        assertExists(By.text("Modal Stack Position: 1"));
106
-        elementByText("SHOW MODAL").click();
107
-        assertExists(By.text("Modal Stack Position: 2"));
108
-
109
-        elementByText("DISMISS ALL MODALS").click();
110
-        assertMainShown();
111
-    }
112
-
113
-    @Test
114
-    public void pushIntoModal() throws Exception {
115
-        elementByText("SHOW MODAL").click();
116
-        elementByText("PUSH SCREEN").click();
117
-        assertExists(By.text("Pushed Screen"));
118
-    }
119
-
120
-    @Test
121
-    public void backPopsModalStack() throws Exception {
122
-        elementByText("SHOW MODAL").click();
123
-        elementByText("PUSH SCREEN").click();
124
-        elementByText("PUSH").click();
125
-        device().pressBack();
126
-        assertExists(By.text("Pushed Screen"));
127
-    }
128
-}

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

@@ -1,50 +0,0 @@
1
-package com.reactnativenavigation.e2e.androide2e;
2
-
3
-import android.support.test.uiautomator.*;
4
-
5
-import org.junit.*;
6
-
7
-import static org.assertj.core.api.Java6Assertions.*;
8
-
9
-public class NavigationOptionsTest extends BaseTest {
10
-
11
-    @Test
12
-    public void declareNavigationStyleOnContainerComponent() throws Exception {
13
-        elementByText("PUSH OPTIONS SCREEN").click();
14
-        assertExists(By.text("Static Title"));
15
-    }
16
-
17
-    @Test
18
-    public void setTitleDynamically() throws Exception {
19
-        elementByText("PUSH OPTIONS SCREEN").click();
20
-        assertExists(By.text("Static Title"));
21
-        elementByText("DYNAMIC OPTIONS").click();
22
-        assertExists(By.text("Dynamic Title"));
23
-    }
24
-
25
-    @Test
26
-    public void testTopBarHidden() throws Exception {
27
-        elementByText("PUSH OPTIONS SCREEN").click();
28
-        elementByText("HIDE TOP BAR").click();
29
-        assertThat(elementByText("Static Title").exists()).isFalse();
30
-        elementByText("SHOW TOP BAR").click();
31
-        assertExists(By.text("Static Title"));
32
-    }
33
-
34
-    @Test
35
-    public void testRightButtons() throws Exception {
36
-        elementByText("PUSH OPTIONS SCREEN").click();
37
-        assertExists(By.text("ONE"));
38
-        elementByText("ONE").click();
39
-    }
40
-
41
-    @Test
42
-    public void testTopBarCollapse() throws Exception {
43
-        elementByText("PUSH OPTIONS SCREEN").click();
44
-        elementByText("SCROLLVIEW SCREEN").click();
45
-        assertExists(By.text("Collapse"));
46
-        elementByText("TOGGLE TOP BAR HIDE ON SCROLL").click();
47
-        swipeUp();
48
-        assertThat(device().hasObject(By.text("Collapse"))).isFalse();
49
-    }
50
-}

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

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

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

@@ -1,30 +0,0 @@
1
-package com.reactnativenavigation.e2e.androide2e;
2
-
3
-import android.support.test.uiautomator.*;
4
-
5
-import org.junit.*;
6
-
7
-public class ScreenLifecycleTest extends BaseTest {
8
-
9
-    @Test
10
-    public void didAppearDidDisappear() throws Exception {
11
-        elementByText("PUSH LIFECYCLE SCREEN").click();
12
-        assertExists(By.text("didAppear"));
13
-        elementByText("PUSH TO TEST DIDDISAPPEAR").click();
14
-        assertExists(By.text("didDisappear"));
15
-    }
16
-
17
-    @Test
18
-    public void unmountIsCalledWhenPopped() throws Exception {
19
-        elementByText("PUSH LIFECYCLE SCREEN").click();
20
-        assertExists(By.text("didAppear"));
21
-
22
-        device().pressBack();
23
-
24
-        assertExists(By.text("componentWillUnmount"));
25
-        elementByText("OK").click();
26
-        assertExists(By.text("didDisappear"));
27
-        elementByText("OK").click();
28
-        assertMainShown();
29
-    }
30
-}

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

@@ -1,57 +0,0 @@
1
-package com.reactnativenavigation.e2e.androide2e;
2
-
3
-import android.support.test.uiautomator.*;
4
-
5
-import org.junit.*;
6
-
7
-public class ScreenStackTest extends BaseTest {
8
-
9
-    @Test
10
-    public void pushAndPopScreen() throws Exception {
11
-        elementByText("PUSH").click();
12
-        assertExists(By.text("Pushed Screen"));
13
-        elementByText("POP").click();
14
-        assertMainShown();
15
-    }
16
-
17
-    @Test
18
-    public void popScreenDeepInTheStack() throws Exception {
19
-        elementByText("PUSH").click();
20
-        assertExists(By.text("Pushed Screen"));
21
-        assertExists(By.text("Stack Position: 1"));
22
-        elementByText("PUSH").click();
23
-        assertExists(By.text("Stack Position: 2"));
24
-        elementByText("POP PREVIOUS").click();
25
-        assertExists(By.text("Stack Position: 2"));
26
-        elementByText("POP").click();
27
-        assertMainShown();
28
-    }
29
-
30
-    @Test
31
-    public void popToId() throws Exception {
32
-        elementByText("PUSH").click();
33
-        elementByText("PUSH").click();
34
-        elementByText("PUSH").click();
35
-        assertExists(By.text("Stack Position: 3"));
36
-        elementByText("POP TO STACK POSITION 1").click();
37
-        assertExists(By.text("Stack Position: 1"));
38
-    }
39
-
40
-    @Test
41
-    public void popToRoot() throws Exception {
42
-        elementByText("PUSH").click();
43
-        elementByText("PUSH").click();
44
-        elementByText("PUSH").click();
45
-        elementByText("POP TO ROOT").click();
46
-        assertMainShown();
47
-    }
48
-
49
-    @Test
50
-    public void pushStackWithMultipleChildren() throws Exception {
51
-        elementByText("SHOW MODAL").click();
52
-        elementByText("SHOW MODAL WITH STACK").click();
53
-        assertExists(By.text("Screen 2"));
54
-        device().pressBack();
55
-        assertExists(By.text("Screen 1"));
56
-    }
57
-}

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

@@ -1,17 +0,0 @@
1
-package com.reactnativenavigation.e2e.androide2e;
2
-
3
-import android.support.test.uiautomator.By;
4
-
5
-import org.junit.Test;
6
-
7
-public class StaticLifecycleEvents extends BaseTest {
8
-    @Test
9
-    public void didAppearDidDisappear() throws Exception {
10
-        elementByText("STATIC LIFECYCLE EVENTS").click();
11
-        assertExists(By.text("Static Lifecycle Events"));
12
-        assertExists(By.text("didAppear | navigation.playground.StaticLifecycleOverlay"));
13
-        elementByText("PUSH").click();
14
-        assertExists(By.text("didAppear | navigation.playground.PushedScreen"));
15
-        assertExists(By.text("didDisappear | navigation.playground.WelcomeScreen"));
16
-    }
17
-}

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

@@ -1,31 +0,0 @@
1
-package com.reactnativenavigation.e2e.androide2e;
2
-
3
-import android.support.test.uiautomator.*;
4
-
5
-import org.junit.*;
6
-
7
-public class TopLevelApiTest extends BaseTest {
8
-
9
-    @Test
10
-    public void switchToTabBasedApp_PassPropsFunction() throws Exception {
11
-        elementByText("SWITCH TO TAB BASED APP").click();
12
-        assertExists(By.text("This is tab 1"));
13
-        assertExists(By.text("Hello from a function!"));
14
-    }
15
-
16
-    @Test
17
-    public void switchToTabBasedApp_SwitchTab() throws Exception {
18
-        elementByText("SWITCH TO TAB BASED APP").click();
19
-        assertExists(By.text("This is tab 1"));
20
-        elementByText("SWITCH TO TAB 2").click();
21
-        assertExists(By.text("This is tab 2"));
22
-    }
23
-
24
-    @Test
25
-    public void switchToTabsWithSideMenu() throws Exception {
26
-        elementByText("SWITCH TO APP WITH SIDE MENUS").click();
27
-        assertExists(By.textStartsWith("This is a side menu center screen tab 1"));
28
-        swipeOpenFromLeft();
29
-        assertExists(By.text("This is a left side menu screen"));
30
-    }
31
-}

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

@@ -1,12 +0,0 @@
1
-package com.reactnativenavigation.e2e.androide2e;
2
-
3
-public class TopTabsTest {//extends BaseTest {
4
-
5
-//    @Test
6
-//    public void tabsCanBeSwiped() throws Exception {
7
-//        elementByText("PUSH TOP TABS SCREEN").click();
8
-//        assertExists(By.text("This is top tab 1"));
9
-//        swipeOpenFromRight();
10
-//        assertExists(By.text("This is top tab 2"));
11
-//    }
12
-}

+ 0
- 17
AndroidE2E/app/src/main/AndroidManifest.xml View File

@@ -1,17 +0,0 @@
1
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
-          xmlns:tools="http://schemas.android.com/tools"
3
-          package="com.reactnativenavigation.e2e.androide2e">
4
-
5
-    <uses-sdk
6
-        android:minSdkVersion="18"
7
-        tools:overrideLibrary="android.support.test.uiautomator.v18"/>
8
-
9
-    <application
10
-        android:allowBackup="true"
11
-        android:icon="@mipmap/ic_launcher"
12
-        android:label="@string/app_name"
13
-        android:supportsRtl="true"
14
-        android:theme="@style/AppTheme">
15
-    </application>
16
-
17
-</manifest>

BIN
AndroidE2E/app/src/main/res/mipmap-hdpi/ic_launcher.png View File


BIN
AndroidE2E/app/src/main/res/mipmap-mdpi/ic_launcher.png View File


BIN
AndroidE2E/app/src/main/res/mipmap-xhdpi/ic_launcher.png View File


BIN
AndroidE2E/app/src/main/res/mipmap-xxhdpi/ic_launcher.png View File


BIN
AndroidE2E/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png View File


+ 0
- 6
AndroidE2E/app/src/main/res/values/colors.xml View File

@@ -1,6 +0,0 @@
1
-<?xml version="1.0" encoding="utf-8"?>
2
-<resources>
3
-    <color name="colorPrimary">#3F51B5</color>
4
-    <color name="colorPrimaryDark">#303F9F</color>
5
-    <color name="colorAccent">#FF4081</color>
6
-</resources>

+ 0
- 3
AndroidE2E/app/src/main/res/values/strings.xml View File

@@ -1,3 +0,0 @@
1
-<resources>
2
-    <string name="app_name">AndroidE2E</string>
3
-</resources>

+ 0
- 11
AndroidE2E/app/src/main/res/values/styles.xml View File

@@ -1,11 +0,0 @@
1
-<resources>
2
-
3
-    <!-- Base application theme. -->
4
-    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
5
-        <!-- Customize your theme here. -->
6
-        <item name="colorPrimary">@color/colorPrimary</item>
7
-        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
8
-        <item name="colorAccent">@color/colorAccent</item>
9
-    </style>
10
-
11
-</resources>

+ 0
- 23
AndroidE2E/build.gradle View File

@@ -1,23 +0,0 @@
1
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
2
-
3
-buildscript {
4
-    repositories {
5
-        jcenter()
6
-        google()
7
-    }
8
-    dependencies {
9
-        classpath 'com.android.tools.build:gradle:3.0.1'
10
-
11
-        // NOTE: Do not place your application dependencies here; they belong
12
-        // in the individual module build.gradle files
13
-    }
14
-}
15
-
16
-allprojects {
17
-    repositories {
18
-        google()
19
-        mavenLocal()
20
-        jcenter()
21
-        mavenCentral()
22
-    }
23
-}

+ 0
- 17
AndroidE2E/gradle.properties View File

@@ -1,17 +0,0 @@
1
-# Project-wide Gradle settings.
2
-
3
-# IDE (e.g. Android Studio) users:
4
-# Gradle settings configured through the IDE *will override*
5
-# any settings specified in this file.
6
-
7
-# For more details on how to configure your build environment visit
8
-# http://www.gradle.org/docs/current/userguide/build_environment.html
9
-
10
-# Specifies the JVM arguments used for the daemon process.
11
-# The setting is particularly useful for tweaking memory settings.
12
-org.gradle.jvmargs=-Xmx1536m
13
-
14
-# When configured, Gradle will run in incubating parallel mode.
15
-# This option should only be used with decoupled projects. More details, visit
16
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17
-# org.gradle.parallel=true

BIN
AndroidE2E/gradle/wrapper/gradle-wrapper.jar View File


+ 0
- 6
AndroidE2E/gradle/wrapper/gradle-wrapper.properties View File

@@ -1,6 +0,0 @@
1
-#Mon Jan 01 12:06:42 IST 2018
2
-distributionBase=GRADLE_USER_HOME
3
-distributionPath=wrapper/dists
4
-zipStoreBase=GRADLE_USER_HOME
5
-zipStorePath=wrapper/dists
6
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip

+ 0
- 160
AndroidE2E/gradlew View File

@@ -1,160 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-##############################################################################
4
-##
5
-##  Gradle start up script for UN*X
6
-##
7
-##############################################################################
8
-
9
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10
-DEFAULT_JVM_OPTS=""
11
-
12
-APP_NAME="Gradle"
13
-APP_BASE_NAME=`basename "$0"`
14
-
15
-# Use the maximum available, or set MAX_FD != -1 to use that value.
16
-MAX_FD="maximum"
17
-
18
-warn ( ) {
19
-    echo "$*"
20
-}
21
-
22
-die ( ) {
23
-    echo
24
-    echo "$*"
25
-    echo
26
-    exit 1
27
-}
28
-
29
-# OS specific support (must be 'true' or 'false').
30
-cygwin=false
31
-msys=false
32
-darwin=false
33
-case "`uname`" in
34
-  CYGWIN* )
35
-    cygwin=true
36
-    ;;
37
-  Darwin* )
38
-    darwin=true
39
-    ;;
40
-  MINGW* )
41
-    msys=true
42
-    ;;
43
-esac
44
-
45
-# Attempt to set APP_HOME
46
-# Resolve links: $0 may be a link
47
-PRG="$0"
48
-# Need this for relative symlinks.
49
-while [ -h "$PRG" ] ; do
50
-    ls=`ls -ld "$PRG"`
51
-    link=`expr "$ls" : '.*-> \(.*\)$'`
52
-    if expr "$link" : '/.*' > /dev/null; then
53
-        PRG="$link"
54
-    else
55
-        PRG=`dirname "$PRG"`"/$link"
56
-    fi
57
-done
58
-SAVED="`pwd`"
59
-cd "`dirname \"$PRG\"`/" >/dev/null
60
-APP_HOME="`pwd -P`"
61
-cd "$SAVED" >/dev/null
62
-
63
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64
-
65
-# Determine the Java command to use to start the JVM.
66
-if [ -n "$JAVA_HOME" ] ; then
67
-    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68
-        # IBM's JDK on AIX uses strange locations for the executables
69
-        JAVACMD="$JAVA_HOME/jre/sh/java"
70
-    else
71
-        JAVACMD="$JAVA_HOME/bin/java"
72
-    fi
73
-    if [ ! -x "$JAVACMD" ] ; then
74
-        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75
-
76
-Please set the JAVA_HOME variable in your environment to match the
77
-location of your Java installation."
78
-    fi
79
-else
80
-    JAVACMD="java"
81
-    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82
-
83
-Please set the JAVA_HOME variable in your environment to match the
84
-location of your Java installation."
85
-fi
86
-
87
-# Increase the maximum file descriptors if we can.
88
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89
-    MAX_FD_LIMIT=`ulimit -H -n`
90
-    if [ $? -eq 0 ] ; then
91
-        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92
-            MAX_FD="$MAX_FD_LIMIT"
93
-        fi
94
-        ulimit -n $MAX_FD
95
-        if [ $? -ne 0 ] ; then
96
-            warn "Could not set maximum file descriptor limit: $MAX_FD"
97
-        fi
98
-    else
99
-        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100
-    fi
101
-fi
102
-
103
-# For Darwin, add options to specify how the application appears in the dock
104
-if $darwin; then
105
-    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106
-fi
107
-
108
-# For Cygwin, switch paths to Windows format before running java
109
-if $cygwin ; then
110
-    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111
-    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112
-    JAVACMD=`cygpath --unix "$JAVACMD"`
113
-
114
-    # We build the pattern for arguments to be converted via cygpath
115
-    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116
-    SEP=""
117
-    for dir in $ROOTDIRSRAW ; do
118
-        ROOTDIRS="$ROOTDIRS$SEP$dir"
119
-        SEP="|"
120
-    done
121
-    OURCYGPATTERN="(^($ROOTDIRS))"
122
-    # Add a user-defined pattern to the cygpath arguments
123
-    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124
-        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125
-    fi
126
-    # Now convert the arguments - kludge to limit ourselves to /bin/sh
127
-    i=0
128
-    for arg in "$@" ; do
129
-        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130
-        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
131
-
132
-        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
133
-            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134
-        else
135
-            eval `echo args$i`="\"$arg\""
136
-        fi
137
-        i=$((i+1))
138
-    done
139
-    case $i in
140
-        (0) set -- ;;
141
-        (1) set -- "$args0" ;;
142
-        (2) set -- "$args0" "$args1" ;;
143
-        (3) set -- "$args0" "$args1" "$args2" ;;
144
-        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145
-        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146
-        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147
-        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148
-        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149
-        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150
-    esac
151
-fi
152
-
153
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154
-function splitJvmOpts() {
155
-    JVM_OPTS=("$@")
156
-}
157
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159
-
160
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

+ 0
- 90
AndroidE2E/gradlew.bat View File

@@ -1,90 +0,0 @@
1
-@if "%DEBUG%" == "" @echo off
2
-@rem ##########################################################################
3
-@rem
4
-@rem  Gradle startup script for Windows
5
-@rem
6
-@rem ##########################################################################
7
-
8
-@rem Set local scope for the variables with windows NT shell
9
-if "%OS%"=="Windows_NT" setlocal
10
-
11
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12
-set DEFAULT_JVM_OPTS=
13
-
14
-set DIRNAME=%~dp0
15
-if "%DIRNAME%" == "" set DIRNAME=.
16
-set APP_BASE_NAME=%~n0
17
-set APP_HOME=%DIRNAME%
18
-
19
-@rem Find java.exe
20
-if defined JAVA_HOME goto findJavaFromJavaHome
21
-
22
-set JAVA_EXE=java.exe
23
-%JAVA_EXE% -version >NUL 2>&1
24
-if "%ERRORLEVEL%" == "0" goto init
25
-
26
-echo.
27
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28
-echo.
29
-echo Please set the JAVA_HOME variable in your environment to match the
30
-echo location of your Java installation.
31
-
32
-goto fail
33
-
34
-:findJavaFromJavaHome
35
-set JAVA_HOME=%JAVA_HOME:"=%
36
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37
-
38
-if exist "%JAVA_EXE%" goto init
39
-
40
-echo.
41
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42
-echo.
43
-echo Please set the JAVA_HOME variable in your environment to match the
44
-echo location of your Java installation.
45
-
46
-goto fail
47
-
48
-:init
49
-@rem Get command-line arguments, handling Windowz variants
50
-
51
-if not "%OS%" == "Windows_NT" goto win9xME_args
52
-if "%@eval[2+2]" == "4" goto 4NT_args
53
-
54
-:win9xME_args
55
-@rem Slurp the command line arguments.
56
-set CMD_LINE_ARGS=
57
-set _SKIP=2
58
-
59
-:win9xME_args_slurp
60
-if "x%~1" == "x" goto execute
61
-
62
-set CMD_LINE_ARGS=%*
63
-goto execute
64
-
65
-:4NT_args
66
-@rem Get arguments from the 4NT Shell from JP Software
67
-set CMD_LINE_ARGS=%$
68
-
69
-:execute
70
-@rem Setup the command line
71
-
72
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73
-
74
-@rem Execute Gradle
75
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76
-
77
-:end
78
-@rem End local scope for the variables with windows NT shell
79
-if "%ERRORLEVEL%"=="0" goto mainEnd
80
-
81
-:fail
82
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83
-rem the _cmd.exe /c_ return code!
84
-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85
-exit /b 1
86
-
87
-:mainEnd
88
-if "%OS%"=="Windows_NT" endlocal
89
-
90
-:omega

+ 0
- 1
AndroidE2E/settings.gradle View File

@@ -1 +0,0 @@
1
-include ':app'

+ 3
- 4
docs/docs/WorkingLocally.md View File

@@ -42,8 +42,7 @@ No PR will be accepted without adequate test coverage.
42 42
 | `lib/src` | TypeScript sources and unit tests |
43 43
 | `lib/dist` | compiled javascript sources and unit tests |
44 44
 | `lib/dist/index.js` | the entry point for `import Navigation from 'react-native-navigation'` |
45
-| `e2e` | [detox](https://github.com/wix/detox) iOS e2e tests (in the future, once detox supports it, we will have android e2e here as well) |
46
-| `AndroidE2E` | Android e2e tests using native uiautomator (until detox for android is ready) |
45
+| `e2e` | [detox](https://github.com/wix/detox) e2e tests on both Android and iOS |
47 46
 | `playground` | The end-user project all e2e tests run against. Contains its own `src`, `android` and `ios`. Does not have its own package.json, depends on the local `<root>/lib` for faster local development (no need to `npm install` locally). |
48 47
 | `integration` | misc javascript integration tests, proving integration with other libraries like redux |
49 48
 | `scripts` | all scripts |
@@ -62,8 +61,8 @@ No PR will be accepted without adequate test coverage.
62 61
 | `npm run test-js` | runs javascript tests and coverage report |
63 62
 | `npm run test-unit-ios` | runs ios unit tests in debug/release <br> **Options:** `-- --release` |
64 63
 | `npm run test-unit-android` | runs android unit tests in debug/release <br> **Options:** `-- --release` |
65
-| `npm run test-e2e-ios` | runs the ios e2e suite (with detox) in debug/release <br> **Options:** `-- --release`|
66
-| `npm run test-e2e-android` | runs the android e2e suite (with uiautomator) in debug/release on running devices/emulators <br> **Options:** `-- [--release] [--just com.TestClass#testMethod]` |
64
+| `npm run test-e2e-ios` | runs the ios e2e tests using [detox](https://github.com/wix/detox) in debug/release <br> **Options:** `-- --release`|
65
+| `npm run test-e2e-android` | runs the android e2e tests using [detox](https://github.com/wix/detox) in debug/release <br> **Options:** `-- --release` |
67 66
 | `npm run test-all` | runs all tests in parallel |
68 67
 | `npm run gen-docs` | generates api docs |
69 68
 | `npm run local-docs` | serve the docs locally for `http://localhost:3000/` |

+ 1
- 1
e2e/OverlayTest.test.js View File

@@ -32,4 +32,4 @@ describe('Overlay', () => {
32 32
     await elementById(testIDs.HIDE_TOP_BAR_BUTTON).tap();
33 33
     await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
34 34
   });
35
-});
35
+});

+ 2
- 3
package.json View File

@@ -37,10 +37,9 @@
37 37
     "test-unit-android": "node ./scripts/test-unit-android",
38 38
     "test-unit-ios": "node ./scripts/test-unit-ios",
39 39
     "pretest-e2e-android": "npm run build",
40
-    "test-e2e-android": "node ./scripts/test-e2e-android",
41
-    "test-e2e-android-detox": "node ./scripts/test-e2e-android-detox",
40
+    "test-e2e-android": "node ./scripts/test-e2e --android",
42 41
     "pretest-e2e-ios": "npm run build",
43
-    "test-e2e-ios": "node ./scripts/test-e2e-ios",
42
+    "test-e2e-ios": "node ./scripts/test-e2e",
44 43
     "test-all": "node ./scripts/test-all",
45 44
     "prerelease": "npm run build",
46 45
     "release": "node ./scripts/release",

+ 0
- 2
scripts/clean.js View File

@@ -12,7 +12,5 @@ function run() {
12 12
   exec.execSync(`rm -rf lib/android/app/build`);
13 13
   exec.execSync(`rm -rf playground/android/build`);
14 14
   exec.execSync(`rm -rf playground/android/app/build`);
15
-  exec.execSync(`rm -rf AndroidE2E/android/build`);
16
-  exec.execSync(`rm -rf AndroidE2E/android/app/build`);
17 15
   exec.execSync(`rm -rf lib/dist`);
18 16
 }

+ 1
- 0
scripts/local-docs.js View File

@@ -1,3 +1,4 @@
1
+/* tslint:disable: no-console */
1 2
 const http = require('http');
2 3
 const fs = require('fs');
3 4
 

+ 0
- 12
scripts/test-e2e-android-detox.js View File

@@ -1,12 +0,0 @@
1
-const _ = require('lodash');
2
-const exec = require('shell-utils').exec;
3
-
4
-const release = _.includes(process.argv, '--release');
5
-
6
-run();
7
-
8
-function run() {
9
-  const conf = release ? `release` : `debug`;
10
-  exec.execSync(`detox build --configuration android.emu.${conf}`);
11
-  exec.execSync(`detox test --configuration android.emu.${conf} ${process.env.CI ? '--cleanup' : ''}  --platform android`);
12
-}

+ 0
- 56
scripts/test-e2e-android.js View File

@@ -1,56 +0,0 @@
1
-/* tslint:disable: no-console */
2
-const _ = require('lodash');
3
-const exec = require('shell-utils').exec;
4
-
5
-const release = _.includes(process.argv, '--release');
6
-
7
-// Run just a single test, e.g. npm test-e2e-android -- --just com.MyClass#myMethod
8
-const filter = _.chain(process.argv).dropWhile((a) => a !== '--just').take(2).last().value();
9
-
10
-run();
11
-
12
-function run() {
13
-  if (process.env.CI) {
14
-    console.log(`android e2e is disabled on CI until Travis will support x86 emulators or we migrate to our own solution`);
15
-  } else {
16
-    assertEnv();
17
-    if (!isDeviceRunning()) {
18
-      startEmulator();
19
-    }
20
-    runTests();
21
-  }
22
-}
23
-
24
-function assertEnv() {
25
-  if (_.isEmpty(process.env.ANDROID_HOME)) {
26
-    throw new Error(`$ANDROID_HOME is not defined`);
27
-  }
28
-}
29
-
30
-function isDeviceRunning() {
31
-  try {
32
-    const response = exec.execSyncRead(`adb -e shell getprop init.svc.bootanim 2>&1`);
33
-    return _.isEqual(response, `stopped`);
34
-  } catch (err) {
35
-    return false;
36
-  }
37
-}
38
-
39
-function startEmulator() {
40
-  console.log(`Looking for avd...`);
41
-  const avdsRaw = exec.execSyncRead(`${process.env.ANDROID_HOME}/tools/bin/avdmanager list avd -c`);
42
-  const avdName = _.get(/^.*package\.xml(\S+)$/m.exec(avdsRaw), '1');
43
-  if (_.isEmpty(avdName)) {
44
-    throw new Error(`\n\n\nCan't find avd to launch. Please create an avd first.\n\n\n`);
45
-  }
46
-  console.log(`found avd name: ${avdName}, Launching...`);
47
-  exec.execAsyncSilent(`${process.env.ANDROID_HOME}/tools/emulator -gpu host -no-audio @${avdName}`);
48
-  exec.execSync(`./scripts/waitForAndroidEmulator.sh`);
49
-}
50
-
51
-function runTests() {
52
-  exec.execSync(`npm run uninstall-android`);
53
-  exec.execSync(`npm run install-android ${release ? '-- --release' : ''}`);
54
-  const filterParam = filter ? '-Pandroid.testInstrumentationRunnerArguments.class=' + filter : '';
55
-  exec.execSync(`cd AndroidE2E && ./gradlew ${filterParam} connectedDebugAndroidTest`);
56
-}

+ 0
- 12
scripts/test-e2e-ios.js View File

@@ -1,12 +0,0 @@
1
-const _ = require('lodash');
2
-const exec = require('shell-utils').exec;
3
-
4
-const release = _.includes(process.argv, '--release');
5
-
6
-run();
7
-
8
-function run() {
9
-  const conf = release ? `release` : `debug`;
10
-  exec.execSync(`detox build --configuration ios.sim.${conf}`);
11
-  exec.execSync(`detox test --configuration ios.sim.${conf} ${process.env.CI ? '--cleanup' : ''}`);
12
-}

+ 18
- 0
scripts/test-e2e.js View File

@@ -0,0 +1,18 @@
1
+const _ = require('lodash');
2
+const exec = require('shell-utils').exec;
3
+
4
+const android = _.includes(process.argv, '--android');
5
+const release = _.includes(process.argv, '--release');
6
+
7
+run();
8
+
9
+function run() {
10
+  const platform = android ? `android` : `ios`;
11
+  const prefix = android ? `android.emu` : `ios.sim`;
12
+  const suffix = release ? `release` : `debug`;
13
+  const configuration = `${prefix}.${suffix}`;
14
+  const cleanup = process.env.CI ? `--cleanup` : ``;
15
+
16
+  exec.execSync(`detox build --configuration ${configuration}`);
17
+  exec.execSync(`detox test --configuration ${configuration} --platform ${platform} ${cleanup}`);
18
+}

+ 0
- 21
scripts/waitForAndroidEmulator.sh View File

@@ -1,21 +0,0 @@
1
-#!/bin/bash -e
2
-
3
-bootanim=""
4
-failcounter=0
5
-timeout_in_sec=360
6
-
7
-until [[ "$bootanim" =~ "stopped" ]]; do
8
-  bootanim=`adb -e shell getprop init.svc.bootanim 2>&1 &`
9
-  if [[ "$bootanim" =~ "device not found" || "$bootanim" =~ "device offline"
10
-    || "$bootanim" =~ "running" ]]; then
11
-    let "failcounter += 1"
12
-    echo "Waiting for emulator to start"
13
-    if [[ $failcounter -gt timeout_in_sec ]]; then
14
-      echo "Timeout ($timeout_in_sec seconds) reached; failed to start emulator"
15
-      exit 1
16
-    fi
17
-  fi
18
-  sleep 1
19
-done
20
-
21
-echo "Emulator is ready"