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(''); }