react-native-navigation的迁移库

Orientations.test.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. const Utils = require('./Utils');
  2. const elementByLabel = Utils.elementByLabel;
  3. describe('orientation', () => {
  4. beforeEach(async () => {
  5. await device.relaunchApp();
  6. });
  7. it('orientation should not change from landscape', async () => {
  8. await elementByLabel('Orientation').tap();
  9. await device.setOrientation('landscape');
  10. await elementByLabel('Push landscape only screen').tap();
  11. await device.setOrientation('portrait');
  12. await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
  13. });
  14. it('orientation should not change from portrait', async () => {
  15. await elementByLabel('Orientation').tap();
  16. await device.setOrientation('portrait');
  17. await elementByLabel('Push portrait only screen').tap();
  18. await device.setOrientation('landscape');
  19. await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
  20. });
  21. it('orientation should change to portrait and landscape', async () => {
  22. await elementByLabel('Orientation').tap();
  23. await device.setOrientation('portrait');
  24. await elementByLabel('Push landscape and portrait').tap();
  25. await device.setOrientation('landscape');
  26. await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
  27. await device.setOrientation('portrait');
  28. await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
  29. });
  30. it('orientation default should change to portrait and landscape', async () => {
  31. await elementByLabel('Orientation').tap();
  32. await device.setOrientation('portrait');
  33. await elementByLabel('Push default').tap();
  34. await device.setOrientation('landscape');
  35. await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
  36. await device.setOrientation('portrait');
  37. await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
  38. });
  39. });