Skip to content

Commit 9d8385f

Browse files
committed
MQE-2140: [chrome81] dragAndDrop with x and y offsets no longer works
1 parent b6a2dc6 commit 9d8385f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -745,20 +745,22 @@ public function _before(TestInterface $test)
745745
*/
746746
public function dragAndDrop($source, $target, $xOffset = null, $yOffset = null)
747747
{
748-
if ($xOffset !== null || $yOffset !== null) {
749-
$snodes = $this->matchFirstOrFail($this->baseElement, $source);
750-
$tnodes = $this->matchFirstOrFail($this->baseElement, $target);
748+
$snodes = $this->matchFirstOrFail($this->baseElement, $source);
749+
$tnodes = $this->matchFirstOrFail($this->baseElement, $target);
750+
$action = new WebDriverActions($this->webDriver);
751751

752+
if ($xOffset !== null || $yOffset !== null) {
752753
$targetX = intval($tnodes->getLocation()->getX() + $xOffset);
753754
$targetY = intval($tnodes->getLocation()->getY() + $yOffset);
754755

755756
$travelX = intval($targetX - $snodes->getLocation()->getX());
756757
$travelY = intval($targetY - $snodes->getLocation()->getY());
757758

758-
$action = new WebDriverActions($this->webDriver);
759759
$action->dragAndDropBy($snodes, $travelX, $travelY)->perform();
760760
} else {
761-
parent::dragAndDrop($source, $target);
761+
$action->clickAndHold($snodes)->perform();
762+
$action->moveToElement($tnodes)->perform();
763+
$action->release($tnodes)->perform();
762764
}
763765
}
764766

0 commit comments

Comments
 (0)