Skip to content

Commit af48714

Browse files
committed
MQE-1185: MFTF DragAndDrop Action Is Not Using X, Y Offsets Correctly
- bug fix
1 parent f0779ac commit af48714

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -600,17 +600,11 @@ public function dragAndDrop($source, $target, $xOffset = null, $yOffset = null)
600600
$snodes = $this->matchFirstOrFail($this->baseElement, $source);
601601
$tnodes = $this->matchFirstOrFail($this->baseElement, $target);
602602

603-
$targetX = intval($tnodes->getLocation()->getX() + $xOffset);
604-
$targetY = intval($tnodes->getLocation()->getY() + $yOffset);
605-
606-
$travelX = intval($targetX - $snodes->getLocation()->getX());
607-
$travelY = intval($targetY - $snodes->getLocation()->getY());
603+
$travelX = intval($tnodes->getLocation()->getX() - $snodes->getLocation()->getX() + $xOffset);
604+
$travelY = intval($tnodes->getLocation()->getY() - $snodes->getLocation()->getY() + $yOffset);
608605

609606
$action = new WebDriverActions($this->webDriver);
610-
$action->moveToElement($snodes)->perform();
611-
$action->clickAndHold($snodes)->perform();
612-
$action->moveByOffset($travelX, $travelY)->perform();
613-
$action->release()->perform();
607+
$action->dragAndDropBy($snodes, $travelX, $travelY)->perform();
614608
} else {
615609
parent::dragAndDrop($source, $target);
616610
}

0 commit comments

Comments
 (0)