react-native-navigation的迁移库

test.e2e.ios.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. execWithXcprettyIfPossible(`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. ./node_modules/mocha/bin/mocha e2e
  21. --timeout ${5 * 60 * 1000}
  22. --recursive
  23. --bail
  24. ${process.env.CI ? '--cleanup' : ''}`);
  25. }
  26. function e2e() {
  27. runDetoxUsingMocha();
  28. }
  29. function run() {
  30. buildProjForDetox();
  31. e2e();
  32. }
  33. function execWithXcprettyIfPossible(cmd) {
  34. if (exec.which('xcpretty')) {
  35. exec.execSync(`${cmd} | xcpretty`);
  36. } else {
  37. exec.execSync(cmd);
  38. }
  39. }
  40. run();