@@ -745,20 +745,22 @@ public function _before(TestInterface $test)
745
745
*/
746
746
public function dragAndDrop ($ source , $ target , $ xOffset = null , $ yOffset = null )
747
747
{
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 );
751
751
752
+ if ($ xOffset !== null || $ yOffset !== null ) {
752
753
$ targetX = intval ($ tnodes ->getLocation ()->getX () + $ xOffset );
753
754
$ targetY = intval ($ tnodes ->getLocation ()->getY () + $ yOffset );
754
755
755
756
$ travelX = intval ($ targetX - $ snodes ->getLocation ()->getX ());
756
757
$ travelY = intval ($ targetY - $ snodes ->getLocation ()->getY ());
757
758
758
- $ action = new WebDriverActions ($ this ->webDriver );
759
759
$ action ->dragAndDropBy ($ snodes , $ travelX , $ travelY )->perform ();
760
760
} else {
761
- parent ::dragAndDrop ($ source , $ target );
761
+ $ action ->clickAndHold ($ snodes )->perform ();
762
+ $ action ->moveToElement ($ tnodes )->perform ();
763
+ $ action ->release ($ tnodes )->perform ();
762
764
}
763
765
}
764
766
@@ -933,7 +935,6 @@ public function makeScreenshot($name = null)
933
935
if (!is_dir ($ debugDir )) {
934
936
mkdir ($ debugDir , 0777 );
935
937
}
936
- $ screenName = $ debugDir . DIRECTORY_SEPARATOR . $ name . '.png ' ;
937
938
$ this ->_saveScreenshot ($ screenName );
938
939
$ this ->debug ("Screenshot saved to $ screenName " );
939
940
AllureHelper::addAttachmentToCurrentStep ($ screenName , 'Screenshot ' );
0 commit comments