react-native-navigation的迁移库

app.test.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. xit('switch to tabs with side menus', () => {
  18. elementByLabel('Switch to tab based app with side menus').tap();
  19. elementByLabel('Switch to tab based app with side menus').swipeRight();
  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. });
  30. function elementByLabel(label) {
  31. return element(by.label(label));
  32. }