react-native-navigation的迁移库

Orientations.test.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. const Utils = require('./Utils');
  2. const elementByLabel = Utils.elementByLabel;
  3. describe('orientation', () => {
  4. beforeEach(async () => {
  5. await device.relaunchApp();
  6. });
  7. afterEach(async () => {
  8. await device.setOrientation('landscape');
  9. await device.setOrientation('portrait');
  10. });
  11. it('default allows all', async () => {
  12. await elementByLabel('Orientation').tap();
  13. await elementByLabel('default').tap();
  14. await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
  15. await device.setOrientation('landscape');
  16. await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
  17. await device.setOrientation('portrait');
  18. await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
  19. await elementByLabel('Dismiss').tap();
  20. });
  21. it('landscape and portrait array', async () => {
  22. await elementByLabel('Orientation').tap();
  23. await elementByLabel('landscape and portrait').tap();
  24. await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
  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. await elementByLabel('Dismiss').tap();
  30. });
  31. it('portrait only', async () => {
  32. await elementByLabel('Orientation').tap();
  33. await elementByLabel('portrait only').tap();
  34. await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
  35. await device.setOrientation('landscape');
  36. await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
  37. await device.setOrientation('portrait');
  38. await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
  39. await elementByLabel('Dismiss').tap();
  40. });
  41. it('landscape only', async () => {
  42. await elementByLabel('Orientation').tap();
  43. await elementByLabel('landscape only').tap();
  44. await device.setOrientation('landscape');
  45. await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
  46. await device.setOrientation('portrait');
  47. await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
  48. await elementByLabel('Dismiss').tap();
  49. });
  50. });