react-native-navigation的迁移库

Orientations.test.js 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. const Utils = require('./Utils');
  2. const testIDs = require('../playground/src/testIDs');
  3. const { elementById } = Utils;
  4. describe('orientation', () => {
  5. beforeEach(async () => {
  6. await device.relaunchApp();
  7. });
  8. it('default allows all', async () => {
  9. await elementById(testIDs.ORIENTATION_BUTTON).tap();
  10. await elementById(testIDs.DEFAULT_ORIENTATION_BUTTON).tap();
  11. await expect(elementById(testIDs.PORTRAIT_ELEMENT)).toBeVisible();
  12. await device.setOrientation('landscape');
  13. await expect(elementById(testIDs.LANDSCAPE_ELEMENT)).toBeVisible();
  14. await device.setOrientation('portrait');
  15. await expect(elementById(testIDs.PORTRAIT_ELEMENT)).toBeVisible();
  16. await elementById(testIDs.DISMISS_BUTTON).tap();
  17. });
  18. it('landscape and portrait array', async () => {
  19. await elementById(testIDs.ORIENTATION_BUTTON).tap();
  20. await elementById(testIDs.LANDSCAPE_PORTRAIT_ORIENTATION_BUTTON).tap();
  21. await expect(element(by.id(testIDs.PORTRAIT_ELEMENT))).toBeVisible();
  22. await device.setOrientation('landscape');
  23. await expect(element(by.id(testIDs.LANDSCAPE_ELEMENT))).toBeVisible();
  24. await device.setOrientation('portrait');
  25. await expect(element(by.id(testIDs.PORTRAIT_ELEMENT))).toBeVisible();
  26. await elementById(testIDs.DISMISS_BUTTON).tap();
  27. });
  28. it('portrait only', async () => {
  29. await elementById(testIDs.ORIENTATION_BUTTON).tap();
  30. await elementById(testIDs.PORTRAIT_ORIENTATION_BUTTON).tap();
  31. await expect(elementById(testIDs.PORTRAIT_ELEMENT)).toBeVisible();
  32. await device.setOrientation('landscape');
  33. await expect(elementById(testIDs.PORTRAIT_ELEMENT)).toBeVisible();
  34. await device.setOrientation('portrait');
  35. await expect(elementById(testIDs.PORTRAIT_ELEMENT)).toBeVisible();
  36. await elementById(testIDs.DISMISS_BUTTON).tap();
  37. });
  38. it('landscape only', async () => {
  39. await elementById(testIDs.ORIENTATION_BUTTON).tap();
  40. await elementById(testIDs.LANDSCAPE_ORIENTATION_BUTTON).tap();
  41. await device.setOrientation('landscape');
  42. await expect(element(by.id(testIDs.LANDSCAPE_ELEMENT))).toBeVisible();
  43. await device.setOrientation('portrait');
  44. await expect(element(by.id(testIDs.LANDSCAPE_ELEMENT))).toBeVisible();
  45. await elementById(testIDs.DISMISS_BUTTON).tap();
  46. });
  47. });