react-native-navigation的迁移库

SideMenu.test.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. const Utils = require('./Utils');
  2. const TestIDs = require('../playground/src/testIDs');
  3. const { elementByLabel, elementById } = Utils;
  4. describe('SideMenu', () => {
  5. beforeEach(async () => {
  6. await device.relaunchApp();
  7. await elementById(TestIDs.SIDE_MENU_BTN).tap();
  8. });
  9. it('close SideMenu and push to stack with static id', async () => {
  10. await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap();
  11. await elementById(TestIDs.LEFT_SIDE_MENU_PUSH_BTN).tap();
  12. await elementById(TestIDs.CLOSE_LEFT_SIDE_MENU_BTN).tap();
  13. await expect(elementById(TestIDs.PUSHED_SCREEN_HEADER)).toBeVisible();
  14. await elementById(TestIDs.POP_BTN).tap();
  15. await expect(elementById(TestIDs.CENTER_SCREEN_HEADER)).toBeVisible();
  16. });
  17. it('Push to stack with static id and close SideMenu with screen options', async () => {
  18. await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap();
  19. await elementById(TestIDs.LEFT_SIDE_MENU_PUSH_AND_CLOSE_BTN).tap();
  20. await expect(elementById(TestIDs.PUSHED_SCREEN_HEADER)).toBeVisible();
  21. await elementById(TestIDs.POP_BTN).tap();
  22. await expect(elementById(TestIDs.CENTER_SCREEN_HEADER)).toBeVisible();
  23. });
  24. it('side menu visibility - left', async () => {
  25. await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap();
  26. await elementById(TestIDs.CLOSE_LEFT_SIDE_MENU_BTN).tap();
  27. await expect(elementById(TestIDs.CLOSE_LEFT_SIDE_MENU_BTN)).toBeNotVisible();
  28. });
  29. it('side menu visibility - right', async () => {
  30. await elementById(TestIDs.OPEN_RIGHT_SIDE_MENU_BTN).tap();
  31. await elementById(TestIDs.CLOSE_RIGHT_SIDE_MENU_BTN).tap();
  32. await expect(elementById(TestIDs.CLOSE_RIGHT_SIDE_MENU_BTN)).toBeNotVisible();
  33. });
  34. it('should rotate', async () => {
  35. await elementById(TestIDs.OPEN_LEFT_SIDE_MENU_BTN).tap();
  36. await device.setOrientation('landscape');
  37. await expect(elementById(TestIDs.LEFT_SIDE_MENU_PUSH_BTN)).toBeVisible();
  38. });
  39. });