react-native-navigation的迁移库

Utils.js 511B

123456789101112131415161718192021
  1. const exec = require('shell-utils').exec;
  2. module.exports = {
  3. elementByLabel: (label) => {
  4. return element(by.text(label));
  5. },
  6. elementById: (id) => {
  7. return element(by.id(id));
  8. },
  9. tapBackIos: () => {
  10. try {
  11. return element(by.traits(['button']).and(by.label('Back'))).atIndex(0).tap();
  12. } catch (err) {
  13. return element(by.type('_UIModernBarButton').and(by.label('Back'))).tap();
  14. }
  15. },
  16. tapDeviceBackAndroid: () => {
  17. exec.execSync('adb shell input keyevent 4');
  18. }
  19. };