Skip to content

Commit

Permalink
add setOrientation to device
Browse files Browse the repository at this point in the history
Closes wix#131
  • Loading branch information
DanielMSchmidt committed May 23, 2017
1 parent e37a429 commit 78111e4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions detox/src/devices/Device.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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('');
}
Expand Down

0 comments on commit 78111e4

Please sign in to comment.