appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
42 lines • 1.32 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.lock = lock;
exports.unlock = unlock;
exports.isLocked = isLocked;
const bluebird_1 = __importDefault(require("bluebird"));
/**
* Lock the device (and optionally unlock the device after a certain amount of time)
*
* @param seconds - The number of seconds after which to unlock the device. Set to `0` or leave empty to require manual unlock (do not automatically unlock).
* @defaultValue 0
*/
async function lock(seconds) {
await this.proxyCommand('/wda/lock', 'POST');
if (isNaN(Number(seconds))) {
return;
}
const floatSeconds = parseFloat(String(seconds));
if (floatSeconds <= 0) {
return;
}
await bluebird_1.default.delay(floatSeconds * 1000);
await this.proxyCommand('/wda/unlock', 'POST');
}
/**
* Unlock the device
*/
async function unlock() {
await this.proxyCommand('/wda/unlock', 'POST');
}
/**
* Determine whether the device is locked
*
* @returns `true` if the device is locked, `false` otherwise
*/
async function isLocked() {
return await this.proxyCommand('/wda/locked', 'GET');
}
//# sourceMappingURL=lock.js.map