mirror of
https://github.com/appium/appium.git
synced 2026-05-18 17:18:50 -05:00
Added support for locking the IOS device for a number of seconds.
Removed unused code
This commit is contained in:
@@ -565,6 +565,10 @@ Android.prototype.postDismissAlert = function(cb) {
|
||||
cb(new NotYetImplementedError(), null);
|
||||
};
|
||||
|
||||
Android.prototype.lock = function(secs, cb) {
|
||||
cb(new NotYetImplementedError(), null);
|
||||
};
|
||||
|
||||
Android.prototype.getOrientation = function(cb) {
|
||||
this.proxy(["orientation", {}], cb);
|
||||
};
|
||||
|
||||
@@ -207,6 +207,13 @@ exports.reset = function(req, res) {
|
||||
req.appium.reset(getResponseHandler(req, res));
|
||||
};
|
||||
|
||||
exports.lock = function(req, res) {
|
||||
var seconds = req.body.seconds;
|
||||
if (checkMissingParams(res, {seconds: seconds})) {
|
||||
req.device.lock(seconds, getResponseHandler(req, res));
|
||||
}
|
||||
};
|
||||
|
||||
exports.deleteSession = function(req, res) {
|
||||
req.appium.stop(getResponseHandler(req, res));
|
||||
};
|
||||
@@ -852,6 +859,7 @@ var mobileCmdMap = {
|
||||
, 'findAndAct': exports.findAndAct
|
||||
, 'setValue' : exports.setValueImmediate
|
||||
, 'reset' : exports.reset
|
||||
, 'lock' : exports.lock
|
||||
, 'keyevent' : exports.keyevent
|
||||
, 'leaveWebView': exports.leaveWebView
|
||||
, 'fireEvent': exports.fireEvent
|
||||
|
||||
@@ -1442,6 +1442,10 @@ IOS.prototype.postDismissAlert = function(cb) {
|
||||
this.proxy("au.dismissAlert()", cb);
|
||||
};
|
||||
|
||||
IOS.prototype.lock = function(secs, cb) {
|
||||
this.proxy(["au.lock(", secs, ")"].join(''), cb);
|
||||
};
|
||||
|
||||
IOS.prototype.getOrientation = function(cb) {
|
||||
this.proxy("au.getScreenOrientation()", cb);
|
||||
};
|
||||
|
||||
@@ -558,6 +558,11 @@ $.extend(au, {
|
||||
return $(this.mainWindow).getActiveElement();
|
||||
}
|
||||
|
||||
, lock: function(secs) {
|
||||
var seconds = parseInt(secs, 10);
|
||||
return this.target.lockForDuration(secs);
|
||||
}
|
||||
|
||||
// Gesture functions
|
||||
|
||||
, getAbsCoords: function(startX, startY, endX, endY) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*global it:true */
|
||||
"use strict";
|
||||
|
||||
var describeWd = require("../../helpers/driverblock.js").describeForApp('UICatalog')
|
||||
, should = require('should');
|
||||
|
||||
describeWd('device lock', function(h) {
|
||||
it("should lock the device for 4 of seconds (+/- 2 secs)", function(done) {
|
||||
var before = new Date().getTime() / 1000;
|
||||
h.driver.execute("mobile: lock", [{seconds: 4}], function(err) {
|
||||
should.not.exist(err);
|
||||
var after = new Date().getTime() / 1000;
|
||||
should.ok(after - before <= 6);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user