@testim/testim-cli
Version:
Command line interface for running Testing on you CI
28 lines (22 loc) • 621 B
JavaScript
/**
*
* Retrieve current context or switch to the specified context
*
* @param {String=} id the context to switch to
*
* @see http://appium.io/slate/en/v1.1.0/?javascript#automating-hybrid-ios-apps, https://github.com/admc/wd/blob/master/lib/commands.js#L279
* @type appium
*
*/
module.exports = function context (id) {
var requestOptions = {
path: '/session/:sessionId/context',
method: 'GET'
};
var data = {};
if(typeof id === 'string') {
requestOptions.method = 'POST';
data.name = id;
}
return this.requestHandler.create(requestOptions, data);
};