Skip to content

Commit

Permalink
Merge pull request appium#3276 from austenke/master
Browse files Browse the repository at this point in the history
Moved location logic to location_in_view
  • Loading branch information
jlipps committed Aug 5, 2014
2 parents 01fa4f6 + 1c27b26 commit 699dfa6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions lib/server/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,11 @@ exports.getCssProperty = function (req, res) {
};

exports.getLocation = function (req, res) {
logCustomDeprecationWarning('location', 'getLocation', "location will be removed in a future version of Appium, please use location_in_view");
this.getLocationInView(req, res);
};

exports.getLocationInView = function (req, res) {
var elementId = req.params.elementId;
req.device.getLocation(elementId, getResponseHandler(req, res));
};
Expand Down Expand Up @@ -751,11 +756,12 @@ exports.setOrientation = function (req, res) {
exports.setLocation = function (req, res) {
if (req.body.latitude || req.body.longitude) {
logCustomDeprecationWarning('geolocation', 'wrongbody',
"Use of the set location method with the latitude and longitude " +
"params as top-level JSON params is deprecated and will be removed. " +
"Please update your client library to use a method that conforms " +
"to the spec");
"Use of the set location method with the latitude and longitude " +
"params as top-level JSON params is deprecated and will be removed. " +
"Please update your client library to use a method that conforms " +
"to the spec");
}

var location = req.body.location || {};
var latitude = location.latitude || req.body.latitude
, longitude = location.longitude || req.body.longitude
Expand Down
2 changes: 1 addition & 1 deletion lib/server/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = function (appium) {
rest.get('/wd/hub/session/:sessionId?/element/:elementId?/enabled', controller.elementEnabled);
rest.get('/wd/hub/session/:sessionId?/element/:elementId?/selected', controller.elementSelected);
rest.get('/wd/hub/session/:sessionId?/element/:elementId?/location', controller.getLocation);
rest.get('/wd/hub/session/:sessionId?/element/:elementId?/location_in_view', controller.getLocationInView);
rest.get('/wd/hub/session/:sessionId?/element/:elementId?/size', controller.getSize);
rest.get('/wd/hub/session/:sessionId?/element/:elementId?/pageIndex', controller.getPageIndex);
rest.get('/wd/hub/session/:sessionId?/element/:elementId?/attribute/:name', controller.getAttribute);
Expand Down Expand Up @@ -147,7 +148,6 @@ var routeNotYetImplemented = function (rest) {
rest.get('/wd/hub/session/:sessionId?/window/:windowhandle/position', controller.notYetImplemented);
rest.post('/wd/hub/session/:sessionId?/window/:windowhandle/maximize', controller.notYetImplemented);
rest.get('/wd/hub/session/:sessionId?/element/:elementId?', controller.notYetImplemented);
rest.get('/wd/hub/session/:sessionId?/element/:elementId?/location_in_view', controller.notYetImplemented);
rest.post('/wd/hub/session/:sessionId?/buttondown', controller.notYetImplemented);
rest.post('/wd/hub/session/:sessionId?/buttonup', controller.notYetImplemented);
rest.post('/wd/hub/session/:sessionId?/doubleclick', controller.notYetImplemented);
Expand Down

0 comments on commit 699dfa6

Please sign in to comment.