react-native-navigation的迁移库

ExternalComponent.test.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. test(':ios: External component should receive options', async () => {
  38. await elementById(TestIDs.MODAL_BTN).tap();
  39. await expect(elementByLabel('External Component')).toBeVisible();
  40. });
  41. });