react-native-navigation的迁移库

OverlayTest.test.js 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. xtest('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. test('setRoot should not remove overlay', async () => {
  39. await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
  40. await elementById(testIDs.SHOW_OVERLAY_BUTTON).tap();
  41. await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
  42. await elementById(testIDs.SET_ROOT_BUTTON).tap();
  43. await expect(elementById(testIDs.DIALOG_HEADER)).toBeVisible();
  44. });
  45. });