-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Environment (please complete the following information):
- WebdriverIO version: 5.10.7
- Mode: WDIO Test Runner
- Node.js version: e.g. 8.16.0
- NPM version: 6.4.1
- Browser name and version: Chrome 75
- Platform name and version: MacOS 10.14
- Additional wdio packages used (if applicable): @wdio/spec reporter, @wdio/selenium-standalone service, @wdio/dot-reporter, @wdio/cli, @wdi0/mocha-framework
Config of WebdriverIO
standard, no major configurations.
Describe the bug
When using $(selector).dragAndDrop(target) The function was able to grab the selector. However the dragging and dropping is not behaving correctly. Instead of dragging and dropping on the target, it is dragging and dropping on the location of the mouse. Which defeats the purpose of dragging and dropping on the target. Looking at the dragAndDrop() function in the source code I noticed something was a bit off as well.
/**
* W3C way of handle the drag and drop action
*/
return this.performActions([{
type: 'pointer',
id: 'finger1',
parameters: { pointerType: 'mouse' },
actions: [
{ type: 'pointerMove', duration: 0, x: sourceX, y: sourceY },
{ type: 'pointerDown', button: ACTION_BUTTON },
{ type: 'pause', duration: 10 }, // emulate human pause
{ type: 'pointerMove', duration, origin: 'pointer', x: targetX, y: targetY },
{ type: 'pointerUp', button: ACTION_BUTTON }
]
}]).then(() => this.releaseActions())
The second pointerMove is using origin pointer. So I wonder if that is what causing the dropping to happen on the mouse coordinate instead.
To Reproduce
- use dragAndDrop function in your test.
- place your mouse somewhere from the target selector.
- You will notice that it will try to drag and drop the selector where the mouse is located.
Expected behavior
It should be able to drag a selector to a target selector.