react-native-navigation的迁移库

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const Utils = require('./Utils');
  2. const TestIDs = require('../playground/src/testIDs');
  3. const { elementById, elementByLabel } = Utils;
  4. describe('Buttons', () => {
  5. beforeEach(async () => {
  6. await device.relaunchApp();
  7. await elementById(TestIDs.OPTIONS_TAB).tap();
  8. await elementById(TestIDs.GOTO_BUTTONS_SCREEN).tap();
  9. });
  10. it('sets right buttons', async () => {
  11. await expect(elementById(TestIDs.BUTTON_ONE)).toBeVisible();
  12. await expect(elementById(TestIDs.ROUND_BUTTON)).toBeVisible();
  13. });
  14. it('set left buttons', async () => {
  15. await expect(elementById(TestIDs.LEFT_BUTTON)).toBeVisible();
  16. });
  17. it('pass props to custom button component', async () => {
  18. await expect(elementByLabel('Two')).toExist();
  19. });
  20. it('pass props to custom button component should exist after push pop', async () => {
  21. await expect(elementByLabel('Two')).toExist();
  22. await elementById(TestIDs.PUSH_BTN).tap();
  23. await elementById(TestIDs.POP_BTN).tap();
  24. await expect(elementByLabel('Two')).toExist();
  25. });
  26. it('custom button is clickable', async () => {
  27. await elementByLabel('Two').tap();
  28. await expect(elementByLabel('Thanks for that :)')).toExist();
  29. });
  30. it(':ios: Reseting buttons should unmount button react view', async () => {
  31. await elementById(TestIDs.SHOW_LIFECYCLE_BTN).tap();
  32. await elementById(TestIDs.RESET_BUTTONS).tap();
  33. await expect(elementByLabel('Button component unmounted')).toBeVisible();
  34. });
  35. it('change button props without rendering all buttons', async () => {
  36. await elementById(TestIDs.CHANGE_BUTTON_PROPS).tap();
  37. await expect(elementByLabel('Three')).toBeVisible();
  38. });
  39. });