|
@@ -2,16 +2,16 @@
|
2
|
2
|
const _ = require('lodash');
|
3
|
3
|
const exec = require('shell-utils').exec;
|
4
|
4
|
|
5
|
|
-const release = _.includes(process.argv, 'release');
|
|
5
|
+const release = _.includes(process.argv, '--release');
|
6
|
6
|
|
7
|
|
-// Run just a single test, e.g. npm test-e2e-android -- just com.MyClass#myMethod
|
8
|
|
-const filter = _(process.argv).dropWhile((a) => a !== 'just').take(2).last();
|
|
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
|
9
|
|
10
|
10
|
run();
|
11
|
11
|
|
12
|
12
|
function run() {
|
13
|
13
|
if (process.env.CI) {
|
14
|
|
- console.log(`android e2e is disabled on CI`);
|
|
14
|
+ console.log(`android e2e is disabled on CI until Travis will support x86 emulators or we migrate to our own solution`);
|
15
|
15
|
} else {
|
16
|
16
|
assertEnv();
|
17
|
17
|
if (!isDeviceRunning()) {
|
|
@@ -38,7 +38,7 @@ function isDeviceRunning() {
|
38
|
38
|
|
39
|
39
|
function startEmulator() {
|
40
|
40
|
console.log(`Looking for avd...`);
|
41
|
|
- const avds = exec.execSyncRead(`avdmanager list avd -c`);
|
|
41
|
+ const avds = exec.execSyncRead(`${process.env.ANDROID_HOME}/tools/bin/avdmanager list avd -c`);
|
42
|
42
|
const avdName = /^.*package\.xml(\S+)$/.exec(avds)[1];
|
43
|
43
|
if (_.isEmpty(avdName)) {
|
44
|
44
|
throw new Error(`Launch an android emulator or connect a device`);
|
|
@@ -50,30 +50,8 @@ function startEmulator() {
|
50
|
50
|
|
51
|
51
|
function runTests() {
|
52
|
52
|
exec.execSync(`npm run uninstall-android`);
|
53
|
|
- exec.execSync(`npm run install-android ${release ? '-- release' : ''}`);
|
|
53
|
+ exec.execSync(`npm run install-android ${release ? '-- --release' : ''}`);
|
54
|
54
|
const filterParam = filter ? '-Pandroid.testInstrumentationRunnerArguments.class=' + filter : '';
|
55
|
55
|
exec.execSync(`cd AndroidE2E && ./gradlew ${filterParam} connectedDebugAndroidTest`);
|
|
56
|
+ process.exit(0); // eslint-disable-line
|
56
|
57
|
}
|
57
|
|
-
|
58
|
|
-// const avdName = 'pixel';
|
59
|
|
-// const sdk = 'android-24';
|
60
|
|
-// const apis = 'default';
|
61
|
|
-// const abi = 'armeabi-v7a';
|
62
|
|
-// const packageName = `system-images;${sdk};${apis};${abi}`;
|
63
|
|
-
|
64
|
|
-// function installEmulator() {
|
65
|
|
-// exec.execSync(`sdkmanager "emulator"`);
|
66
|
|
-// exec.execSync(`sdkmanager "${packageName}"`);
|
67
|
|
-// exec.execSync(`echo no | avdmanager create avd --force --name "${avdName}" --abi "${apis}/${abi}" --package "${packageName}" --device "pixel"`);
|
68
|
|
-// exec.execSync(`avdmanager list avd`);
|
69
|
|
-// }
|
70
|
|
-
|
71
|
|
-// function launchEmulator() {
|
72
|
|
-// console.log(`Launching Android Emulator`);
|
73
|
|
-// exec.execSync(`cd $ANDROID_HOME/tools && ./emulator -skin 1080x1920 -gpu host -no-audio @${avdName}`);
|
74
|
|
-// exec.execSync(`./scripts/waitForAndroidEmulator.sh`);
|
75
|
|
-// }
|
76
|
|
-
|
77
|
|
-// function killEmulators() {
|
78
|
|
-// exec.execSync(`adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done`);
|
79
|
|
-// }
|