From 3da7be59f9be3f68a436cb17dc7bca7e4d7bd2a9 Mon Sep 17 00:00:00 2001
From: Kevin Kozan <kkozan@magento.com>
Date: Mon, 28 Jan 2019 09:38:28 -0600
Subject: [PATCH 1/2] Revert "MQE-1185: MFTF DragAndDrop Action Is Not Using X,
 Y Offsets Correctly"

This reverts commit 2fe867cf0f9afa7a207c9aed8d0bc097c4d4f504.
---
 .../Module/MagentoWebDriver.php               | 32 ++++++++-----------
 1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
index a15ed757e..93e6a5968 100644
--- a/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
+++ b/src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php
@@ -599,29 +599,23 @@ public function _before(TestInterface $test)
      */
     public function dragAndDrop($source, $target, $xOffset = null, $yOffset = null)
     {
-        if ($xOffset === null && $yOffset === null) {
-            parent::dragAndDrop($source, $target);
-        } else {
-            $sNode = $this->matchFirstOrFail($this->baseElement, $source);
-            $tNode = $this->matchFirstOrFail($this->baseElement, $target);
+        if ($xOffset !== null || $yOffset !== null) {
+            $snodes = $this->matchFirstOrFail($this->baseElement, $source);
+            $tnodes = $this->matchFirstOrFail($this->baseElement, $target);
 
-            $sHeight = $sNode->getSize()->getHeight();
-            $sWidth = $sNode->getSize()->getWidth();
+            $targetX = intval($tnodes->getLocation()->getX() + $xOffset);
+            $targetY = intval($tnodes->getLocation()->getY() + $yOffset);
 
-            $travelX = intval($tNode->getLocation()->getX() - $sNode->getLocation()->getX() + $xOffset);
-            $travelY = intval($tNode->getLocation()->getY() - $sNode->getLocation()->getY() + $yOffset);
+            $travelX = intval($targetX - $snodes->getLocation()->getX());
+            $travelY = intval($targetY - $snodes->getLocation()->getY());
 
             $action = new WebDriverActions($this->webDriver);
-            if ($travelX >0 && $travelY >0 && $travelX < $sWidth && $travelY < $sHeight) {
-                // Perform separate action steps when dragging and dropping inside the source element boundary
-                $action->moveToElement($sNode)->perform();
-                $action->clickAndHold($sNode)->perform();
-                $action->moveByOffset($travelX, $travelY)->perform();
-                $action->release()->perform();
-            } else {
-                // Call dragAndDropBy otherwise
-                $action->dragAndDropBy($sNode, $travelX, $travelY)->perform();
-            }
+            $action->moveToElement($snodes)->perform();
+            $action->clickAndHold($snodes)->perform();
+            $action->moveByOffset($travelX, $travelY)->perform();
+            $action->release()->perform();
+        } else {
+            parent::dragAndDrop($source, $target);
         }
     }
 

From 2953a241ccb530cfafc8630b87268937160533c8 Mon Sep 17 00:00:00 2001
From: Kevin Kozan <kkozan@magento.com>
Date: Mon, 28 Jan 2019 09:40:01 -0600
Subject: [PATCH 2/2] MQE-1185: MFTF DragAndDrop Action Is Not Using X, Y
 Offsets Correctly

- Removing fix line from ChangeLog
---
 CHANGELOG.md | 1 -
 1 file changed, 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 804ed527b..2dc01e00a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,7 +17,6 @@ Magento Functional Testing Framework Changelog
 * Fixed an issue where a test's `<after>` would run twice with Codeception `2.4.x`
 * Fixed an issue where tests using `extends` would not correctly override parent test steps
 * Test actions can now send an empty string to parameterized selectors.
-* Refactored `dragAndDrop` test action to correctly use given `x` and `y` arguments.
 
 ### GitHub Issues/Pull requests:
 * [#297](https://github.com/magento/magento2-functional-testing-framework/pull/297) -- Allow = to be part of the secret value