react-native-navigation的迁移库

12345678910111213141516171819202122232425262728293031
  1. const detox = require('detox');
  2. const config = require('../package.json').detox;
  3. const exec = require('shell-utils').exec;
  4. const adapter = require('detox/runners/jest/adapter');
  5. jest.setTimeout(300000);
  6. jasmine.getEnv().addReporter(adapter); // don't forget this line
  7. beforeAll(async () => {
  8. await detox.init(config, {launchApp: false});
  9. disableAndroidEmulatorAnimations();
  10. });
  11. afterAll(async () => {
  12. await adapter.afterAll();
  13. await detox.cleanup();
  14. });
  15. beforeEach(async () => {
  16. await adapter.beforeEach();
  17. });
  18. function disableAndroidEmulatorAnimations() {
  19. if (device.getPlatform() === 'android') {
  20. const deviceId = device._deviceId;
  21. exec.execAsync(`adb -s ${deviceId} shell settings put global window_animation_scale 0.0`);
  22. exec.execAsync(`adb -s ${deviceId} shell settings put global transition_animation_scale 0.0`);
  23. exec.execAsync(`adb -s ${deviceId} shell settings put global animator_duration_scale 0.0`);
  24. }
  25. }