Skip to content

Commit 7a7e403

Browse files
authored
MQE-2140: [chrome81] dragAndDrop with x and y offsets no longer works (#725)
* MQE-2143: [chrome81] dragAndDrop with x and y offsets no longer works * MQE-2140: [chrome81] dragAndDrop with x and y offsets no longer works * MQE-2140: [chrome81] dragAndDrop with x and y offsets no longer works * MQE-2140: [chrome81] dragAndDrop with x and y offsets no longer works
1 parent ad5249f commit 7a7e403

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/Magento/FunctionalTestingFramework/Module/MagentoWebDriver.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -745,23 +745,24 @@ 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());
757-
758-
$action = new WebDriverActions($this->webDriver);
759-
$action->moveToElement($snodes)->perform();
760-
$action->clickAndHold($snodes)->perform();
761-
$action->moveByOffset($travelX, $travelY)->perform();
758+
$action->moveToElement($snodes);
759+
$action->clickAndHold($snodes);
760+
$action->moveByOffset($travelX, $travelY);
762761
$action->release()->perform();
763762
} else {
764-
parent::dragAndDrop($source, $target);
763+
$action->clickAndHold($snodes);
764+
$action->moveToElement($tnodes);
765+
$action->release($tnodes)->perform();
765766
}
766767
}
767768

0 commit comments

Comments
 (0)