Skip to content

Commit d5589bd

Browse files
committed
Merge pull request appium#17 from admc/master
Adding flick like woah, without a test :-(
2 parents 7fd2f7d + dc6f624 commit d5589bd

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

app/controller.js

+15
Original file line numberDiff line numberDiff line change
@@ -312,3 +312,18 @@ exports.getScreenshot = function(req, res) {
312312
});
313313
});
314314
};
315+
316+
exports.flick = function(req, res) {
317+
var sessionid = req.params.sessionid
318+
, swipe = req.params.swipe
319+
, xSpeed = req.params.xSpeed
320+
, ySpeed = req.params.ySpeed
321+
, status = 0;
322+
323+
req.device.flick(xSpeed, ySpeed, swipe, function(err, result) {
324+
res.send({
325+
sessionId: req.appium.sessionId
326+
, status: status
327+
});
328+
});
329+
};

app/ios.js

+14
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,20 @@ IOS.prototype.getScreenshot = function(cb) {
300300
});
301301
};
302302

303+
IOS.prototype.flick = function(xSpeed, ySpeed, swipe, cb) {
304+
var command = "";
305+
if (swipe) {
306+
command = ["touchSwipeFromSpeed(", xSpeed, ",", ySpeed,")"].join('');
307+
}
308+
else {
309+
command = ["touchFlickFromSpeed(", xSpeed, ",", ySpeed,")"].join('');
310+
}
311+
312+
this.proxy(command, function(json) {
313+
cb(null, json);
314+
});
315+
};
316+
303317
module.exports = function(rest, app, udid, verbose, removeTraceDir) {
304318
return new IOS(rest, app, udid, verbose, removeTraceDir);
305319
};

app/routing.js

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ module.exports = function(appium) {
3636
rest.get('/wd/hub/session/:sessionId/orientation', controller.getOrientation);
3737
rest.post('/wd/hub/session/:sessionId/orientation', controller.setOrientation);
3838
rest.get('/wd/hub/session/:sessionId/screenshot', controller.getScreenshot);
39+
rest.post('/wd/hub/session/:sessionId/touch/flick', controller.flick);
3940
};
4041

4142
// TODO: http://cdn.memegenerator.net/instances/400x/33433130.jpg

test/functional/flick.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Someone please implement flick

0 commit comments

Comments
 (0)