react-native-navigation的迁移库

OverlayTest.test.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. });
  8. test('show and dismiss overlay', async () => {
  9. await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
  10. await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
  11. await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
  12. await elementById(testIDs.OK_BUTTON).tap();
  13. await expect(elementById(testIDs.DIALOG_HEADER)).toBeNotVisible();
  14. });
  15. test('overlay pass touches - true', async () => {
  16. await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
  17. await elementById(testIDs.SHOW_TOUCH_THROUGH_OVERLAY_BUTTON).tap();
  18. await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
  19. await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
  20. await elementById(testIDs.HIDE_TOP_BAR_BUTTON).tap();
  21. await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeNotVisible();
  22. });
  23. test('overlay pass touches - false', async () => {
  24. await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
  25. await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
  26. await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
  27. await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
  28. await elementById(testIDs.HIDE_TOP_BAR_BUTTON).tap();
  29. await expect(elementById(testIDs.TOP_BAR_ELEMENT)).toBeVisible();
  30. });
  31. test('overlay should redraw after orientation change', async () => {
  32. await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
  33. await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
  34. await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
  35. await device.setOrientation('landscape');
  36. await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
  37. });
  38. });