react-native-navigation的迁移库

StaticLifecycleEvents.test.js 1.2KB

123456789101112131415161718192021222324252627
  1. const Utils = require('./Utils');
  2. const testIDs = require('../playground/src/testIDs');
  3. const { elementByLabel, elementById } = Utils;
  4. describe('static lifecycle events', () => {
  5. beforeEach(async () => {
  6. await device.relaunchApp();
  7. });
  8. it('didAppear didDisappear', async () => {
  9. await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
  10. await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
  11. await expect(elementByLabel('componentDidAppear | navigation.playground.StaticLifecycleOverlay')).toBeVisible();
  12. await elementById(testIDs.PUSH_BUTTON).tap();
  13. await expect(elementByLabel('componentDidAppear | navigation.playground.PushedScreen')).toBeVisible();
  14. await expect(elementByLabel('componentDidDisappear | navigation.playground.WelcomeScreen')).toBeVisible();
  15. });
  16. it(':android: unmounts when dismissed', async () => {
  17. await elementById(testIDs.PUSH_STATIC_LIFECYCLE_BUTTON).tap();
  18. await expect(elementByLabel('Static Lifecycle Events Overlay')).toBeVisible();
  19. await elementById(testIDs.DISMISS_BUTTON).tap();
  20. await expect(elementByLabel('Overlay Unmounted')).toBeVisible();
  21. await elementById(testIDs.OK_BUTTON).tap();
  22. });
  23. });