react-native-navigation的迁移库

ExternalComponent.test.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const Utils = require('./Utils');
  2. const TestIDs = require('../playground/src/testIDs');
  3. const Android = require('./AndroidUtils');
  4. const { elementByLabel, elementById } = Utils;
  5. describe('External Component', () => {
  6. beforeEach(async () => {
  7. await device.relaunchApp();
  8. await elementById(TestIDs.NAVIGATION_TAB).tap();
  9. await elementById(TestIDs.EXTERNAL_COMP_BTN).tap();
  10. });
  11. test('Push external component', async () => {
  12. await elementById(TestIDs.PUSH_BTN).tap();
  13. await expect(elementByLabel('This is an external component')).toBeVisible();
  14. });
  15. test('Show external component in deep stack in modal', async () => {
  16. await elementById(TestIDs.MODAL_BTN).tap();
  17. await expect(elementByLabel('External component in deep stack')).toBeVisible();
  18. });
  19. test(':ios: Dismiss modal from external component should not crash', async () => {
  20. await elementById(TestIDs.PUSH_BTN).tap();
  21. await expect(elementByLabel('This is an external component')).toBeVisible();
  22. await elementById(TestIDs.EXTERNAL_DISMISS_MODAL_BTN).tap();
  23. await expect(elementById(TestIDs.NAVIGATION_SCREEN)).toBeVisible();
  24. });
  25. test(':ios: Top bar buttons should be visible', async () => {
  26. await elementById(TestIDs.PUSH_BTN).tap();
  27. await expect(elementByLabel('This is an external component')).toBeVisible();
  28. await expect(elementById(TestIDs.EXTERNAL_TOP_BAR_RIGHT_BTN)).toBeVisible();
  29. });
  30. test(':ios: Dismiss modal from external component should not crash when registered to modalDismissed event', async () => {
  31. await elementById(TestIDs.REGISTER_MODAL_DISMISS_EVENT_BTN).tap();
  32. await elementById(TestIDs.PUSH_BTN).tap();
  33. await expect(elementByLabel('This is an external component')).toBeVisible();
  34. await elementById(TestIDs.EXTERNAL_DISMISS_MODAL_BTN).tap();
  35. await expect(elementById(TestIDs.NAVIGATION_SCREEN)).toBeVisible();
  36. });
  37. });