react-native-navigation的迁移库

test.e2e.android.js 982B

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