react-native-navigation的迁移库

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const Utils = require('./Utils');
  2. const TestIDs = require('../playground/src/testIDs');
  3. const { elementByLabel, elementById } = Utils;
  4. describe('Overlay', () => {
  5. beforeEach(async () => {
  6. await device.relaunchApp();
  7. await elementById(TestIDs.NAVIGATION_TAB).tap();
  8. await elementById(TestIDs.OVERLAY_BTN).tap();
  9. });
  10. it('show and dismiss overlay', async () => {
  11. await elementById(TestIDs.SHOW_OVERLAY_BTN).tap();
  12. await expect(elementById(TestIDs.OVERLAY_ALERT_HEADER)).toBeVisible();
  13. await elementById(TestIDs.DISMISS_BTN).tap();
  14. await expect(elementById(TestIDs.OVERLAY_ALERT_HEADER)).toBeNotVisible();
  15. });
  16. it('overlay pass touches - true', async () => {
  17. await elementById(TestIDs.SHOW_TOUCH_THROUGH_OVERLAY_BTN).tap();
  18. await expect(elementById(TestIDs.SHOW_OVERLAY_BTN)).toBeVisible();
  19. await elementById(TestIDs.ALERT_BUTTON).tap();
  20. await expect(elementByLabel('Alert displayed')).toBeVisible();
  21. });
  22. it('overlay should redraw after orientation change', async () => {
  23. await elementById(TestIDs.SHOW_OVERLAY_BTN).tap();
  24. await device.setOrientation('landscape');
  25. await expect(elementById(TestIDs.OVERLAY_ALERT_HEADER)).toBeVisible();
  26. });
  27. it('setRoot should not remove overlay', async () => {
  28. await elementById(TestIDs.SHOW_TOUCH_THROUGH_OVERLAY_BTN).tap();
  29. await elementById(TestIDs.SET_ROOT_BTN).tap();
  30. await expect(elementById(TestIDs.OVERLAY_ALERT_HEADER)).toBeVisible();
  31. });
  32. xtest('overlay pass touches - false', async () => {
  33. await elementById(TestIDs.SHOW_OVERLAY_BUTTON).tap();
  34. await expect(elementById(TestIDs.SHOW_OVERLAY_BUTTON)).toBeVisible();
  35. await expect(elementById(TestIDs.TOP_BAR_ELEMENT)).toBeVisible();
  36. await elementById(TestIDs.HIDE_TOP_BAR_BUTTON).tap();
  37. await expect(elementById(TestIDs.TOP_BAR_ELEMENT)).toBeVisible();
  38. });
  39. });