react-native-navigation的迁移库

test.e2e.android.js 1020B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*eslint-disable no-console*/
  2. const _ = require('lodash');
  3. const exec = require('shell-utils').exec;
  4. const release = _.includes(process.argv, 'release');
  5. run();
  6. function run() {
  7. if (process.env.CI) {
  8. try {
  9. // console.log(`android e2e disabled on CI for now`);
  10. launchEmulator();
  11. runTests();
  12. } finally {
  13. killEmulators();
  14. }
  15. } else {
  16. runTests();
  17. }
  18. }
  19. function runTests() {
  20. console.log('all OK');
  21. // exec.execSync(`yarn run uninstall-android`);
  22. // exec.execSync(`yarn run install-android ${release ? '-- release' : ''}`);
  23. // exec.execSync(`cd AndroidE2E && ./gradlew connectedDebugAndroidTest`);
  24. }
  25. function launchEmulator() {
  26. console.log(`Launching Android Emulator`);
  27. exec.execSync(`cd $ANDROID_HOME/tools && ./emulator -skin 1080x1920 -gpu host -no-audio @pixel`);
  28. exec.execSync(`./scripts/waitForAndroidEmulator.sh`);
  29. }
  30. function killEmulators() {
  31. exec.execSync(`adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done`);
  32. }