diff --git a/lib/devices/ios/ios-controller.js b/lib/devices/ios/ios-controller.js index e8de562dd..860645e19 100644 --- a/lib/devices/ios/ios-controller.js +++ b/lib/devices/ios/ios-controller.js @@ -1098,7 +1098,14 @@ iOSController.background = function (secs, cb) { }; iOSController.getOrientation = function (cb) { - this.proxy("au.getScreenOrientation()", cb); + this.proxy("au.getScreenOrientation()", function (err, res) { + if (res && res.status === status.codes.Success.code) { + // keep track of orientation for our own purposes + logger.debug("Setting internal orientation to " + res.value); + this.curOrientation = res.value; + } + cb(err, res); + }); }; iOSController.setOrientation = function (orientation, cb) { @@ -1123,6 +1130,7 @@ iOSController.getScreenshot = function (cb) { var shotPath = [screenshotFolder, 'screenshot', guid, ".png"].join(""); async.waterfall([ + function (cb) { this.getOrientation(function () { cb(); }); }.bind(this), function (cb) { this.proxy(command, cb); }.bind(this), function (response, cb) { var data = null;