react-native-navigation的迁移库

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. describe('app', () => {
  2. beforeEach((done) => {
  3. global.simulator.relaunchApp(done);
  4. });
  5. it('shows welcome screen', () => {
  6. expect(elementByLabel('React Native Navigation!')).toBeVisible();
  7. });
  8. it('switch to tab based app, passProps and functions', () => {
  9. elementByLabel('Switch to tab based app').tap();
  10. expect(elementByLabel('This is tab 1')).toBeVisible();
  11. expect(elementByLabel('Hello from a function!')).toBeVisible();
  12. });
  13. it('push screen', () => {
  14. elementByLabel('Push').tap();
  15. expect(elementByLabel('Pushed screen')).toBeVisible();
  16. });
  17. it('switch to tabs with side menus', () => {
  18. elementByLabel('Switch to app with side menus').tap();
  19. elementByLabel('This is a side menu center screen').swipe('right');
  20. expect(elementByLabel('This is a side menu screen')).toBeVisible();
  21. });
  22. it('screen lifecycle', () => {
  23. elementByLabel('Switch to lifecycle screen').tap();
  24. expect(elementByLabel('onStart!')).toBeVisible();
  25. elementByLabel('Push to test onStop').tap();
  26. expect(elementByLabel('Alert')).toBeVisible();
  27. expect(elementByLabel('onStop!')).toBeVisible();
  28. });
  29. it('pop screen', () => {
  30. elementByLabel('Push').tap();
  31. expect(elementByLabel('Pushed screen')).toBeVisible();
  32. elementByLabel('Pop').tap();
  33. expect(elementByLabel('React Native Navigation!')).toBeVisible();
  34. });
  35. it('show modal', () => {
  36. elementByLabel('Show Modal').tap();
  37. expect(elementByLabel('Modal screen')).toBeVisible();
  38. });
  39. it('dismiss modal', () => {
  40. elementByLabel('Show Modal').tap();
  41. expect(elementByLabel('Modal screen')).toBeVisible();
  42. elementByLabel('Dismiss Modal').tap();
  43. expect(elementByLabel('React Native Navigation!')).toBeVisible();
  44. });
  45. });
  46. describe('reload app', () => {
  47. before((done) => {
  48. simulator.reloadReactNativeApp(done);
  49. });
  50. it('shows welcome screen', () => {
  51. expect(elementByLabel('React Native Navigation!')).toBeVisible();
  52. });
  53. });
  54. function elementByLabel(label) {
  55. return element(by.label(label));
  56. }