Skip to content

Commit 5e9bebc

Browse files
committed
MQE-1185: MFTF DragAndDrop Action Is Not Using X, Y Offsets Correctly
1 parent 2f3bac7 commit 5e9bebc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -613,15 +613,15 @@ public function dragAndDrop($source, $target, $xOffset = null, $yOffset = null)
613613

614614
$action = new WebDriverActions($this->webDriver);
615615
if ($travelX >= 0 && $travelY >= 0 && $travelX <= $sWidth && $travelY <= $sHeight) {
616-
// Perform separate action steps when dragging and dropping inside the source element boundary
616+
// Move to the middle of the source element when target is inside the source boundary
617617
$action->moveToElement($sNode)->perform();
618-
$action->clickAndHold($sNode)->perform();
619-
$action->moveByOffset($travelX, $travelY)->perform();
620-
$action->release()->perform();
621618
} else {
622-
// Call dragAndDropBy otherwise
623-
$action->dragAndDropBy($sNode, $travelX, $travelY)->perform();
619+
// Move to the top left of the source element when target is outside the source boundary
620+
$action->moveToElement($sNode, -$sWidth/2, -$sHeight/2)->perform();
624621
}
622+
$action->clickAndHold($sNode)->perform();
623+
$action->moveByOffset($travelX, $travelY)->perform();
624+
$action->release()->perform();
625625
}
626626
}
627627

0 commit comments

Comments
 (0)