Bladeren bron

e2e android initial

Daniel Zlotin 7 jaren geleden
bovenliggende
commit
5d43e6a9bd

+ 0
- 17
AndroidE2E/app/build.gradle Bestand weergeven

@@ -24,20 +24,3 @@ dependencies {
24 24
     androidTestCompile 'com.android.support.test:rules:0.5'
25 25
     androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
26 26
 }
27
-
28
-task reinstallNavigation {
29
-    shell("cd ../../playground/ && yarn run uninstall-android && yarn run android");
30
-}
31
-
32
-def shell(cmd) {
33
-    exec {
34
-        executable "sh"
35
-        args "-c", "$cmd"
36
-    }
37
-}
38
-
39
-tasks.whenTaskAdded { task ->
40
-    if (task.name == 'connectedAndroidTest') {
41
-        task.dependsOn reinstallNavigation
42
-    }
43
-}

+ 11
- 14
AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/ApplicationLifecycleTest.java Bestand weergeven

@@ -2,11 +2,9 @@ package com.reactnativenavigation.e2e.androide2e;
2 2
 
3 3
 import android.annotation.TargetApi;
4 4
 import android.content.Intent;
5
-import android.provider.Settings;
6 5
 import android.support.test.filters.SdkSuppress;
7 6
 import android.support.test.runner.AndroidJUnit4;
8 7
 import android.support.test.uiautomator.UiDevice;
9
-import android.support.test.uiautomator.UiSelector;
10 8
 
11 9
 import org.junit.Test;
12 10
 import org.junit.runner.RunWith;
@@ -21,25 +19,24 @@ public class ApplicationLifecycleTest {
21 19
     @Test
22 20
     public void showSplash_AcceptsOverlayPermissions_ShowsWelcomeScreen() throws Exception {
23 21
         launchTheApp();
24
-        Thread.sleep(2000);
25 22
 //        assertThat(rule.getActivity().getContentView()).isNotNull().isInstanceOf(NavigationSplashView.class);
26 23
 //        acceptOverlayPermissionIfNeeded();
27 24
 //        assertMainShown();
28 25
     }
29 26
 
30
-    private void acceptOverlayPermissionIfNeeded() throws Exception {
31
-        if (Settings.canDrawOverlays(getInstrumentation().getTargetContext())) {
32
-            return;
33
-        }
34
-        uiDevice().waitForIdle();
35
-        uiDevice().findObject(new UiSelector().text("Playground")).click();
36
-        uiDevice().findObject(new UiSelector().text("Permit drawing over other apps")).click();
37
-        uiDevice().pressBack();
38
-        uiDevice().pressBack();
39
-    }
27
+//    private void acceptOverlayPermissionIfNeeded() throws Exception {
28
+//        if (Settings.canDrawOverlays(getInstrumentation().getTargetContext())) {
29
+//            return;
30
+//        }
31
+//        uiDevice().waitForIdle();
32
+//        uiDevice().findObject(new UiSelector().text("Playground")).click();
33
+//        uiDevice().findObject(new UiSelector().text("Permit drawing over other apps")).click();
34
+//        uiDevice().pressBack();
35
+//        uiDevice().pressBack();
36
+//    }
37
+//        uiDevice().findObject(new UiSelector().description("Apps")).clickAndWaitForNewWindow();
40 38
 
41 39
     private void launchTheApp() throws Exception {
42
-//        uiDevice().findObject(new UiSelector().description("Apps")).clickAndWaitForNewWindow();
43 40
         uiDevice().wakeUp();
44 41
         uiDevice().pressHome();
45 42
         uiDevice().waitForIdle();

+ 3
- 5
playground/scripts/e2e.android.js Bestand weergeven

@@ -10,16 +10,14 @@ function runEmulator() {
10 10
 }
11 11
 
12 12
 function e2e() {
13
-  shellUtils.exec.execSync(`cd android && ./gradlew uninstallAll`);
14
-  shellUtils.exec.execSync(`cd android && ./gradlew connectedDebugAndroidTest`);
13
+  shellUtils.exec.execSync(`yarn run uninstall-android`);
14
+  shellUtils.exec.execSync(`yarn run android`);
15
+  shellUtils.exec.execSync(`cd ../AndroidE2e/ && ./gradlew connectedDebugAndroidTest`);
15 16
 }
16 17
 
17 18
 function run() {
18 19
   shellUtils.exec.execSync(`echo 'travis_fold:start:android-e2e'`);
19 20
   try {
20
-    if (process.env.CI) {
21
-      runEmulator();
22
-    }
23 21
     e2e();
24 22
   } finally {
25 23
     shellUtils.exec.execSync(`echo 'travis_fold:end:android-e2e'`);

+ 1
- 0
scripts/test.android.js Bestand weergeven

@@ -4,6 +4,7 @@ function run() {
4 4
   if (process.env.CI) {
5 5
     exec.execSync(`./scripts/installAndroidSDK.sh`);
6 6
   }
7
+
7 8
   exec.execSync(`cd android && ./gradlew clean testDebugUnitTest`);
8 9
 }
9 10