From 78111e45273dab50746ef7e90e0363adde53bf6c Mon Sep 17 00:00:00 2001 From: Daniel Schmidt Date: Wed, 24 May 2017 00:31:51 +0200 Subject: [PATCH] add setOrientation to device Closes #131 --- detox/src/devices/Device.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/detox/src/devices/Device.js b/detox/src/devices/Device.js index a094a35076..69c077863b 100644 --- a/detox/src/devices/Device.js +++ b/detox/src/devices/Device.js @@ -1,6 +1,7 @@ const fs = require('fs'); const _ = require('lodash'); const argparse = require('../utils/argparse'); +const invoke = require('../invoke'); class Device { constructor(client, session, deviceConfig) { @@ -42,6 +43,16 @@ class Device { await this.client.sendUserNotification(params); } + async setOrientation(orientation) { + // orientation is 'landscape' (meaning left side portrait) or 'portrait' (non-reversed) + const call = invoke.call( + invoke.IOS.EarlGrey(''), + 'rotateDeviceToOrientation:errorOrNil:', + invoke.IOS.UIDeviceOrientation(orientation) + ); + await new invoke.InvocationManager(this.client).execute(call); + } + async shutdown() { return await Promise.resolve(''); }