react-native-navigation的迁移库

test.e2e.ios.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. const conf = release ? `release` : `debug`;
  8. exec.execSync(`detox build --configuration ios.sim.${conf}`);
  9. exec.execAsync(`sleep 10`).then(() => {
  10. exec.execAsync(`open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app`);
  11. });
  12. startRecording();
  13. exec.execSync(`detox test --configuration ios.sim.${conf} ${process.env.CI ? '--cleanup' : ''}`);
  14. } finally {
  15. stopRecording();
  16. }
  17. }
  18. function startRecording() {
  19. const screenId = exec.execSyncRead(`ffmpeg -f avfoundation -list_devices true -i "" 2>&1 | grep "Capture screen 0" | sed -e "s/.*\\[//" -e "s/\\].*//"`);
  20. exec.execAsync(`ffmpeg -f avfoundation -i "${screenId}:none" out.avi`);
  21. }
  22. function stopRecording() {
  23. exec.execSync(`killall ffmpeg || true`);
  24. exec.execSync(`ls -l out.avi`);
  25. const json = require('./../package.json');
  26. json.name = 'fix-travis-rnn';
  27. json.version = `0.0.${Date.now()}`;
  28. require('fs').writeFileSync('./package.json', JSON.stringify(json, null, 2), { encoding: 'utf-8' });
  29. exec.execSync(`npm run release`);
  30. }