react-native-navigation的迁移库

test.e2e.ios.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 conf = release ? `Release` : `Debug`;
  7. exec.execSync(`cd ./playground/ios &&
  8. RCT_NO_LAUNCH_PACKAGER=true
  9. xcodebuild build
  10. -scheme ${scheme}
  11. -project playground.xcodeproj
  12. -sdk iphonesimulator
  13. -configuration ${conf}
  14. -derivedDataPath ./DerivedData/playground
  15. ONLY_ACTIVE_ARCH=YES`);
  16. }
  17. function runDetoxUsingMocha() {
  18. const detoxAppBuildPath = `playground/ios/DerivedData/playground/Build/Products/${release ? 'Release' : 'Debug'}-iphonesimulator/playground.app`;
  19. exec.execSync(`detoxAppBuildPath="${detoxAppBuildPath}"
  20. BABEL_ENV=test
  21. ./node_modules/mocha/bin/mocha e2e
  22. --timeout ${5 * 60 * 1000}
  23. --recursive
  24. --bail
  25. ${process.env.CI ? '--cleanup' : ''}`);
  26. }
  27. function e2e() {
  28. runDetoxUsingMocha();
  29. }
  30. function run() {
  31. if (!exec.which(`fbsimctl`)) {
  32. throw new Error(`fbsimctl must be installed: "brew tap facebook/fb && brew install fbsimctl"`);
  33. }
  34. buildProjForDetox();
  35. e2e();
  36. }
  37. run();