react-native-navigation的迁移库

test.e2e.ios.js 1.5KB

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