react-native-navigation的迁移库

test.e2e.android.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* eslint-disable no-console */
  2. const _ = require('lodash');
  3. const exec = require('shell-utils').exec;
  4. // const avdName = 'pixel';
  5. // const sdk = 'android-24';
  6. // const apis = 'default';
  7. // const abi = 'armeabi-v7a';
  8. // const packageName = `system-images;${sdk};${apis};${abi}`;
  9. const release = _.includes(process.argv, 'release');
  10. // Run just a single test, e.g. yarn test-e2e-android -- just com.MyClass#myMethod
  11. const filter = _(process.argv).dropWhile((a) => a !== 'just').take(2).last();
  12. run();
  13. function run() {
  14. if (process.env.CI) {
  15. console.log(`android e2e is disabled on CI`);
  16. } else {
  17. runTests();
  18. }
  19. }
  20. function runTests() {
  21. exec.execSync(`yarn run uninstall-android`);
  22. exec.execSync(`yarn run install-android ${release ? '-- release' : ''}`);
  23. const filterParam = filter ? '-Pandroid.testInstrumentationRunnerArguments.class=' + filter : '';
  24. exec.execSync(`cd AndroidE2E && ./gradlew ${filterParam} connectedDebugAndroidTest`);
  25. }
  26. // function installEmulator() {
  27. // exec.execSync(`sdkmanager "emulator"`);
  28. // exec.execSync(`sdkmanager "${packageName}"`);
  29. // exec.execSync(`echo no | avdmanager create avd --force --name "${avdName}" --abi "${apis}/${abi}" --package "${packageName}" --device "pixel"`);
  30. // exec.execSync(`avdmanager list avd`);
  31. // }
  32. // function launchEmulator() {
  33. // console.log(`Launching Android Emulator`);
  34. // exec.execSync(`cd $ANDROID_HOME/tools && ./emulator -skin 1080x1920 -gpu host -no-audio @${avdName}`);
  35. // exec.execSync(`./scripts/waitForAndroidEmulator.sh`);
  36. // }
  37. // function killEmulators() {
  38. // exec.execSync(`adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done`);
  39. // }