Browse Source

fix test-e2e-android

Daniel Zlotin 7 years ago
parent
commit
d25b8bff60
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      scripts/test.e2e.android.js

+ 3
- 3
scripts/test.e2e.android.js View File

38
 
38
 
39
 function startEmulator() {
39
 function startEmulator() {
40
   console.log(`Looking for avd...`);
40
   console.log(`Looking for avd...`);
41
-  const avds = exec.execSyncRead(`${process.env.ANDROID_HOME}/tools/bin/avdmanager list avd -c`);
42
-  const avdName = /^.*package\.xml(\S+)$/.exec(avds)[1];
41
+  const avdsRaw = exec.execSyncRead(`${process.env.ANDROID_HOME}/tools/bin/avdmanager list avd -c`);
42
+  const avdName = /^.*package\.xml(\S+)$/m.exec(avdsRaw)[1];
43
   if (_.isEmpty(avdName)) {
43
   if (_.isEmpty(avdName)) {
44
-    throw new Error(`Launch an android emulator or connect a device`);
44
+    throw new Error(`Can't find avd to launch. Please create an avd first.`);
45
   }
45
   }
46
   console.log(`found avd name: ${avdName}, Launching...`);
46
   console.log(`found avd name: ${avdName}, Launching...`);
47
   exec.execAsyncSilent(`${process.env.ANDROID_HOME}/tools/emulator -gpu host -no-audio @${avdName}`);
47
   exec.execAsyncSilent(`${process.env.ANDROID_HOME}/tools/emulator -gpu host -no-audio @${avdName}`);