react-native-navigation的迁移库

12345678910111213141516171819
  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. sleep: ms => new Promise(res => setTimeout(res, ms))
  17. };