react-native-navigation的迁移库

test.e2e.android.js 916B

12345678910111213141516171819202122232425262728293031323334353637
  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. launchEmulator();
  10. runTests();
  11. } finally {
  12. killEmulators();
  13. }
  14. } else {
  15. runTests();
  16. }
  17. }
  18. function runTests() {
  19. exec.execSync(`yarn run uninstall-android`);
  20. exec.execSync(`yarn run install-android ${release ? '-- release' : ''}`);
  21. exec.execSync(`cd AndroidE2E && ./gradlew connectedDebugAndroidTest`);
  22. }
  23. function launchEmulator() {
  24. console.log(`Launching Android Emulator`);
  25. exec.execSync(`cd $ANDROID_HOME/tools && ./emulator -skin 1080x1920 -no-audio @pixel`);
  26. exec.execSync(`./scripts/waitForAndroidEmulator.sh`);
  27. }
  28. function killEmulators() {
  29. exec.execSync(`adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done`);
  30. }