react-native-navigation的迁移库

test.e2e.ios.js 851B

1234567891011121314151617181920212223242526272829
  1. const _ = require('lodash');
  2. const exec = require('shell-utils').exec;
  3. const release = _.includes(process.argv, '--release');
  4. run();
  5. function run() {
  6. try {
  7. startRecording();
  8. const conf = release ? `release` : `debug`;
  9. exec.execSync(`detox build --configuration ios.sim.${conf} && detox test --configuration ios.sim.${conf} ${process.env.CI ? '--cleanup' : ''}`);
  10. } catch (err) {
  11. stopRecording();
  12. }
  13. }
  14. function startRecording() {
  15. const json = JSON.parse(exec.execSyncRead(`applesimutils --list --byName "iPhone SE"`));
  16. const deviceId = json[0].udid;
  17. exec.execAsync(`xcrun simctl bootstatus ${deviceId} && xcrun simctl io booted recordVideo --type=mp4 video.mp4`);
  18. }
  19. function stopRecording() {
  20. const pid = exec.execSyncRead(`pgrep simctl`);
  21. exec.execSync(`kill -sigint ${pid}`);
  22. exec.execSync(`npm run release`);
  23. }