@testim/testim-cli
Version:
Command line interface for running Testing on you CI
47 lines (41 loc) • 1.13 kB
JavaScript
/**
*
* Get the current browser orientation.
*
* <example>
:getOrientation.js
var client = require('webdriverio').remote({
desiredCapabilities: {
browserName: 'safari',
platform: 'OS X 10.9',
deviceName: 'iPad',
device: 'iPad Simulator',
platformVersion: '7.1',
platformName: 'iOS',
app: 'safari',
'device-orientation': 'landscape'
}
})
client
.init()
.getOrientation().then(function(orientation) {
console.log(orientation); // outputs: "landscape"
})
.end();
* </example>
*
* @returns {String} device orientation (`{landscape|portrait}`)
* @uses protocol/orientation
* @type mobile
*
*/
var ErrorHandler = require('../utils/ErrorHandler.js');
module.exports = function getOrientation () {
if(!this.isMobile) {
throw new ErrorHandler.CommandError('getOrientation command is not supported on non mobile platforms');
}
return this.unify(this.orientation(), {
lowercase: true,
extractValue: true
});
};