From 6f4a9291922339ce85a54833779575bdebbc64b7 Mon Sep 17 00:00:00 2001 From: Sergey Plevako Date: Fri, 16 Sep 2016 16:32:44 +0100 Subject: [PATCH 1/4] Added twoFingerTap to the supported actions --- lib/commands/gesture.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/commands/gesture.js b/lib/commands/gesture.js index 11a017e71..9566f8b74 100644 --- a/lib/commands/gesture.js +++ b/lib/commands/gesture.js @@ -27,6 +27,8 @@ commands.performTouch = async function (gestures) { return await this.handleTap(gestures[0]); } else if (gestures.length === 1 && gestures[0].action === 'doubleTap') { return await this.handleDoubleTap(gestures[0]); + } else if (gestures.length === 1 && gestures[0].action === 'twoFingerTap') { + return await this.handleTwoFingerTap(gestures[0]); } else if (gestures.length === 1 && gestures[0].action === 'longpress') { return await this.handleLongPress(gestures[0]); } else if (this.isDrag(gestures)) { @@ -113,6 +115,19 @@ helpers.handleDoubleTap = async function (gesture) { return await this.proxyCommand(endpoint, 'POST'); }; +helpers.handleTwoFingerTap = async function (gesture) { + let opts = gesture.options || {}; + + if (!opts.element) { + throw new errors.BadParametersError('WDA double tap needs an element'); + } + + let el = opts.element.ELEMENT ? opts.element.ELEMENT : opts.element; + let endpoint = `/uiaElement/${el}/twoFingerTap`; + + return await this.proxyCommand(endpoint, 'POST'); +}; + helpers.handleLongPress = async function (gesture) { let opts = gesture.options || {}; From f7569f965aeb5112a4ee7bf356b54ecd149a4961 Mon Sep 17 00:00:00 2001 From: Sergey Plevako Date: Fri, 23 Sep 2016 11:57:18 +0100 Subject: [PATCH 2/4] Updated WebDriverAgent submodule --- WebDriverAgent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebDriverAgent b/WebDriverAgent index 6813e2549..a4c4f7ed2 160000 --- a/WebDriverAgent +++ b/WebDriverAgent @@ -1 +1 @@ -Subproject commit 6813e2549b684379e1b6a6ee96deb2b42f4e1a85 +Subproject commit a4c4f7ed24bb54a67d29719a57d397a5c90571af From 3818c9137fd8b16764507c393b65de6bc75f5caa Mon Sep 17 00:00:00 2001 From: Sergey Plevako Date: Wed, 2 Nov 2016 10:52:28 +0000 Subject: [PATCH 3/4] minor refactoring --- lib/commands/gesture.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/commands/gesture.js b/lib/commands/gesture.js index aa5e8a048..bd80d7748 100644 --- a/lib/commands/gesture.js +++ b/lib/commands/gesture.js @@ -25,9 +25,9 @@ commands.click = async function (el) { commands.performTouch = async function (gestures) { if (isTap(gestures)) { return await this.handleTap(gestures[0]); - } else if (gestures.length === 1 && (gestures[0] || '').action.toLowerCase() === 'doubletap') { + } else if (isDoubleTap(gestures)) { return await this.handleDoubleTap(gestures[0]); - } else if (gestures.length === 1 && (gestures[0] || '').action.toLowerCase() === 'twofingertap') { + } else if (isTwoFingerTap(gestures)) { return await this.handleTwoFingerTap(gestures[0]); } else if (isLongPress(gestures)) { return await this.handleLongPress(gestures[0]); @@ -70,6 +70,21 @@ function isTap (gestures) { return false; } +function isTwoFingerTap (gestures) { + if (gestures.length === 1 && gestures[0].action.toLowerCase() === 'twofingertap') { + return true; + } + return false; +} + + +function isDoubleTap (gestures) { + if (gestures.length === 1 && gestures[0].action.toLowerCase() === 'doubletap') { + return true; + } + return false; +} + function isLongPress (gestures) { if (gestures.length === 1 && gestures[0].action.toLowerCase() === 'longpress') { return true; From 8d8baa0bcd6fd0450d66fd6c1cec840663e37cee Mon Sep 17 00:00:00 2001 From: Sergey Plevako Date: Wed, 2 Nov 2016 11:25:36 +0000 Subject: [PATCH 4/4] minor change --- lib/commands/gesture.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/commands/gesture.js b/lib/commands/gesture.js index bd80d7748..f611f4769 100644 --- a/lib/commands/gesture.js +++ b/lib/commands/gesture.js @@ -26,11 +26,11 @@ commands.performTouch = async function (gestures) { if (isTap(gestures)) { return await this.handleTap(gestures[0]); } else if (isDoubleTap(gestures)) { - return await this.handleDoubleTap(gestures[0]); + return await this.handleDoubleTap(gestures); } else if (isTwoFingerTap(gestures)) { - return await this.handleTwoFingerTap(gestures[0]); + return await this.handleTwoFingerTap(gestures); } else if (isLongPress(gestures)) { - return await this.handleLongPress(gestures[0]); + return await this.handleLongPress(gestures); } else if (isDrag(gestures)) { return await this.handleDrag(gestures); } else if (isScroll(gestures)) {