diff --git a/lib/api/protocol/appium/getCurrentActivity.js b/lib/api/protocol/appium/getCurrentActivity.js index b24d18dc7a..48fb296b08 100644 --- a/lib/api/protocol/appium/getCurrentActivity.js +++ b/lib/api/protocol/appium/getCurrentActivity.js @@ -3,6 +3,21 @@ const ProtocolAction = require('../_base-action.js'); /** * Get the name of the current Android activity. * + * @example + * module.exports = { + * 'get current activity name': function (app) { + * app + * .appium.getCurrentActivity(function (result) { + * console.log('current android activity is:', result.value); + * }); + * }, + * + * 'get current activity name with ES6 async/await': async function (app) { + * const activity = await app.appium.getCurrentActivity(); + * console.log('current android activity is:', activity); + * } + * }; + * * @syntax .appium.getCurrentActivity([callback]) * @method getCurrentActivity * @param {function} [callback] Callback function which is called with the result value. diff --git a/lib/api/protocol/appium/getCurrentPackage.js b/lib/api/protocol/appium/getCurrentPackage.js index e667047e70..70d578c101 100644 --- a/lib/api/protocol/appium/getCurrentPackage.js +++ b/lib/api/protocol/appium/getCurrentPackage.js @@ -3,6 +3,21 @@ const ProtocolAction = require('../_base-action.js'); /** * Get the name of the current Android package. * + * @example + * module.exports = { + * 'get current package name': function (app) { + * app + * .appium.getCurrentPackage(function (result) { + * console.log('current android package is:', result.value); + * }); + * }, + * + * 'get current package name with ES6 async/await': async function (app) { + * const packageName = await app.appium.getCurrentPackage(); + * console.log('current android package is:', packageName); + * } + * }; + * * @syntax .appium.getCurrentPackage([callback]) * @method getCurrentPackage * @param {function} [callback] Callback function which is called with the result value. diff --git a/lib/api/protocol/appium/getGeolocation.js b/lib/api/protocol/appium/getGeolocation.js index 148e6f76ec..171a9a0825 100644 --- a/lib/api/protocol/appium/getGeolocation.js +++ b/lib/api/protocol/appium/getGeolocation.js @@ -3,6 +3,21 @@ const ProtocolAction = require('../_base-action.js'); /** * Get the current geolocation of the mobile device. * + * @example + * module.exports = { + * 'get device geolocation': function (app) { + * app + * .appium.getGeolocation(function (result) { + * console.log('current device geolocation is:', result.value); + * }); + * }, + * + * 'get device geolocation with ES6 async/await': async function (app) { + * const location = await app.appium.getGeolocation(); + * console.log('current device geolocation is:', location); + * } + * }; + * * @syntax .appium.getGeolocation([callback]) * @method getGeolocation * @param {function} [callback] Callback function which is called with the result value. diff --git a/lib/api/protocol/appium/getOrientation.js b/lib/api/protocol/appium/getOrientation.js index 20e8d740bf..1cd986a86a 100644 --- a/lib/api/protocol/appium/getOrientation.js +++ b/lib/api/protocol/appium/getOrientation.js @@ -3,6 +3,21 @@ const ProtocolAction = require('../_base-action.js'); /** * Get the current device orientation. * + * @example + * module.exports = { + * 'get current device orientation': function (app) { + * app + * .appium.getOrientation(function (result) { + * console.log('current device orientation is:', result.value); + * }); + * }, + * + * 'get current device orientation with ES6 async/await': async function (app) { + * const orientation = await app.appium.getOrientation(); + * console.log('current device orientation is:', orientation); + * } + * }; + * * @syntax .appium.getOrientation([callback]) * @method getOrientation * @param {function} callback Callback function which is called with the result value. diff --git a/lib/api/protocol/appium/hideKeyboard.js b/lib/api/protocol/appium/hideKeyboard.js index a5bb62758f..25233ec14d 100644 --- a/lib/api/protocol/appium/hideKeyboard.js +++ b/lib/api/protocol/appium/hideKeyboard.js @@ -3,6 +3,18 @@ const ProtocolAction = require('../_base-action.js'); /** * Hide soft keyboard. * + * @example + * module.exports = { + * 'hide device soft keyboard': function (app) { + * app + * .appium.hideKeyboard(); + * }, + * + * 'hide device soft keyboard with ES6 async/await': async function (app) { + * await app.appium.hideKeyboard(); + * } + * }; + * * @syntax .appium.hideKeyboard([callback]) * @method hideKeyboard * @param {function} [callback] Optional callback function to be called when the command finishes. diff --git a/lib/api/protocol/appium/isKeyboardShown.js b/lib/api/protocol/appium/isKeyboardShown.js index 3e8a9103a6..b4b03d97d8 100644 --- a/lib/api/protocol/appium/isKeyboardShown.js +++ b/lib/api/protocol/appium/isKeyboardShown.js @@ -3,6 +3,21 @@ const ProtocolAction = require('../_base-action.js'); /** * Whether or not the soft keyboard is shown. * + * @example + * module.exports = { + * 'whether keyboard is shown': function (app) { + * app + * .appium.isKeyboardShown(function (result) { + * console.log('result value of whether keyboard is shown:', result.value); + * }); + * }, + * + * 'whether keyboard is shown with ES6 async/await': async function (app) { + * const result = await app.appium.isKeyboardShown(); + * console.log('result value of whether keyboard is shown:', result); + * } + * }; + * * @syntax .appium.isKeyboardShown([callback]) * @method isKeyboardShown * @param {function} [callback] Callback function which is called with the result value. diff --git a/lib/api/protocol/appium/setGeolocation.js b/lib/api/protocol/appium/setGeolocation.js index 227b340ccd..5983a47641 100644 --- a/lib/api/protocol/appium/setGeolocation.js +++ b/lib/api/protocol/appium/setGeolocation.js @@ -3,6 +3,18 @@ const ProtocolAction = require('../_base-action.js'); /** * Set the current geolocation of the mobile device. * + * @example + * module.exports = { + * 'set geolocation to Tokyo, Japan': function (app) { + * app + * .appium.setGeolocation({latitude: 35.689487, longitude: 139.691706, altitude: 5}); + * }, + * + * 'set geolocation to Tokyo, Japan with ES6 async/await': async function (app) { + * await app.appium.setGeolocation({latitude: 35.689487, longitude: 139.691706}); + * } + * }; + * * @syntax .appium.setGeolocation({latitude, longitude, altitude}, [callback]) * @method setGeolocation * @param {object} [coordinates] `latitude` and `longitude` are required; `altitude` is optional. All should be of type `number`. diff --git a/lib/api/protocol/appium/setOrientation.js b/lib/api/protocol/appium/setOrientation.js index 845ed6ba5c..b080f60f81 100644 --- a/lib/api/protocol/appium/setOrientation.js +++ b/lib/api/protocol/appium/setOrientation.js @@ -3,6 +3,18 @@ const ProtocolAction = require('../_base-action.js'); /** * Set the current device orientation. * + * @example + * module.exports = { + * 'set orientation to LANDSCAPE': function (app) { + * app + * .appium.setOrientation('LANDSCAPE'); + * }, + * + * 'set orientation to PORTRAIT with ES6 async/await': async function (app) { + * await app.appium.setOrientation('PORTRAIT'); + * } + * }; + * * @syntax .appium.setOrientation(orientation, [callback]) * @method setOrientation * @param {string} orientation The new device orientation: `LANDSCAPE` or `PORTRAIT`. diff --git a/lib/api/protocol/appium/startActivity.js b/lib/api/protocol/appium/startActivity.js index 746e767279..a218bb2454 100644 --- a/lib/api/protocol/appium/startActivity.js +++ b/lib/api/protocol/appium/startActivity.js @@ -7,19 +7,21 @@ const ProtocolAction = require('../_base-action.js'); * * @example * module.exports = { - * 'start an android activity': function (client) { - * client.startActivity({ - * appPackage: 'com.android.chrome', - * appActivity: 'com.google.android.apps.chrome.Main' - * }); + * 'start an android activity': function (app) { + * app + * .appium.startActivity({ + * appPackage: 'com.android.chrome', + * appActivity: 'com.google.android.apps.chrome.Main' + * }); * }, * - * 'start the main Android activity and wait for onboarding activity to start': function (client) { - * client.startActivity({ - * appPackage: 'org.wikipedia', - * appActivity: 'org.wikipedia.main.MainActivity', - * appWaitActivity: 'org.wikipedia.onboarding.InitialOnboardingActivity' - * }); + * 'start the main Android activity and wait for onboarding activity to start': function (app) { + * app + * .appium.startActivity({ + * appPackage: 'org.wikipedia', + * appActivity: 'org.wikipedia.main.MainActivity', + * appWaitActivity: 'org.wikipedia.onboarding.InitialOnboardingActivity' + * }); * } * }; * diff --git a/test/src/api/protocol/testKeyboardInteraction.js b/test/src/api/protocol/testKeyboardInteraction.js index adc201a6ec..0a9d5d4787 100644 --- a/test/src/api/protocol/testKeyboardInteraction.js +++ b/test/src/api/protocol/testKeyboardInteraction.js @@ -2,8 +2,6 @@ const assert = require('assert'); const Globals = require('../../../lib/globals.js'); describe('Keyboard interaction commands', function() { - // this.timeout(150000); - before(function() { Globals.protocolBefore(); });