| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 | 
const Utils = require('./Utils');
const testIDs = require('../playground/src/testIDs');
const { elementById } = Utils;
describe('orientation', () => {
  beforeEach(async () => {
    await device.relaunchApp();
  });
  afterEach(async () => {
    await device.setOrientation('landscape');
    await device.setOrientation('portrait');
  });
  it('default allows all', async () => {
    await elementById(testIDs.ORIENTATION_BUTTON).tap();
    await elementById(testIDs.DEFAULT_ORIENTATION_BUTTON).tap();
    await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
    await device.setOrientation('landscape');
    await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
    await device.setOrientation('portrait');
    await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
    await elementById(testIDs.DISMISS_BUTTON).tap();
  });
  it('landscape and portrait array', async () => {
    await elementById(testIDs.ORIENTATION_BUTTON).tap();
    await elementById(testIDs.LANDSCAPE_PORTRAIT_ORIENTATION_BUTTON).tap();
    await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
    await device.setOrientation('landscape');
    await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
    await device.setOrientation('portrait');
    await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
    await elementById(testIDs.DISMISS_BUTTON).tap();
  });
  it('portrait only', async () => {
    await elementById(testIDs.ORIENTATION_BUTTON).tap();
    await elementById(testIDs.PORTRAIT_ORIENTATION_BUTTON).tap();
    await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
    await device.setOrientation('landscape');
    await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
    await device.setOrientation('portrait');
    await expect(element(by.id('currentOrientation'))).toHaveText('Portrait');
    await elementById(testIDs.DISMISS_BUTTON).tap();
  });
  it('landscape only', async () => {
    await elementById(testIDs.ORIENTATION_BUTTON).tap();
    await elementById(testIDs.LANDSCAPE_ORIENTATION_BUTTON).tap();
    await device.setOrientation('landscape');
    await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
    await device.setOrientation('portrait');
    await expect(element(by.id('currentOrientation'))).toHaveText('Landscape');
    await elementById(testIDs.DISMISS_BUTTON).tap();
  });
});
 |