react-native-navigation的迁移库

test.e2e.ios.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const _ = require('lodash');
  2. const exec = require('shell-utils').exec;
  3. const release = _.includes(process.argv, 'release');
  4. function buildProjForDetox() {
  5. const scheme = release ? `playground_release` : `playground`;
  6. const cmd = `cd ./playground/ios && xcodebuild
  7. -scheme ${scheme}
  8. ${release ? 'clean build' : 'build'}
  9. -project playground.xcodeproj
  10. -sdk iphonesimulator
  11. -derivedDataPath ./DerivedData/playground`;
  12. if (exec.which(`xcpretty`)) {
  13. exec.execSync(`${cmd} | xcpretty && exit \${PIPESTATUS[0]}`);
  14. } else {
  15. exec.execSync(`${cmd}`);
  16. }
  17. }
  18. function e2e() { //eslint-disable-line
  19. try {
  20. exec.execSyncSilent(`watchman watch-del-all || true`);
  21. const detoxAppBuildPath = `playground/ios/DerivedData/playground/Build/Products/${release ? 'Release' : 'Debug'}-iphonesimulator/playground.app`;
  22. exec.execSync(`detoxAppBuildPath="${detoxAppBuildPath}"
  23. BABEL_ENV=test
  24. ./node_modules/mocha/bin/mocha e2e
  25. --timeout ${2 * 60 * 1000}
  26. --recursive
  27. --bail`);
  28. } finally {
  29. if (process.env.CI) {
  30. exec.kill(`Simulator`);
  31. exec.kill(`CoreSimulator`);
  32. exec.execSync(`sleep 5`);
  33. }
  34. }
  35. }
  36. function run() {
  37. if (!exec.which(`fbsimctl`)) {
  38. throw new Error(`fbsimctl must be installed: "brew tap facebook/fb && brew install fbsimctl"`);
  39. }
  40. buildProjForDetox();
  41. e2e();
  42. }
  43. run();