Skip to content

drag and drop bug #4134

@ducle91

Description

@ducle91

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

  1. use dragAndDrop function in your test.
  2. place your mouse somewhere from the target selector.
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs InvestigationIssues that require more information on the problem.help wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions