Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User should be able to drag and drop an element to another location on the screen #104

Closed
sswaroopgupta opened this issue Aug 9, 2018 · 13 comments
Assignees

Comments

@sswaroopgupta
Copy link
Contributor

Expected behavior
User should be able to drag and drop an element to another location on the screen

Current behavior
There is no support for the action drag and drop

Version

commit - 51de58ab2c042b63be0e5d19a79450de0cd03acd
@dinesarun
Copy link

Waiting for this feature folks.. Its needy in my case, as many steps involves drag and drop in my use case.

@NivedhaSenthil
Copy link
Member

some thoughts on api design:

case 1: Move source element into destination
await dragAndDrop(sourceSelector, into(destinationSelector))

case 2: Move source element into destination with relative to other element on the destination
await dragAndDrop(sourceSelector, into(destinationSelector), below(someOtherSelector))

case 3: Move source element into given direction by some pixel
await dragAndDrop(sourceSelector, {up:10, down:10, right: 10, left:10 })

@sswaroopgupta
Copy link
Contributor Author

sswaroopgupta commented Nov 22, 2018

Question

NivedhaSenthil added a commit that referenced this issue Nov 22, 2018
@zabil
Copy link
Member

zabil commented Nov 22, 2018

@dinesarun can you share a gif showing how you use drag and drop? Will help us think of a better API

@dinesarun
Copy link

Hi @zabil ,

Thanks in Advance.. Can you please shoot a hello mail to dinuswt22@gmail.com? Let me mail you GIF showing how I use drag and drop in my application.

And kudos for giving good intro about Taiko at Thoughtworks 'GeekNight'. That reminded me to try out this :)

NivedhaSenthil added a commit that referenced this issue Nov 27, 2018
eg: `await dragAndDrop("task 1",{top:200,right:200})`
values are given in pixels
NivedhaSenthil added a commit that referenced this issue Nov 27, 2018
@negiDharmendra negiDharmendra removed their assignment Nov 27, 2018
Apoorva-GA added a commit that referenced this issue Nov 27, 2018
@NivedhaSenthil
Copy link
Member

UPDATE: case 1 and case 3 are available in master 14cfdbc.
await dragAndDrop(sourceSelector, into(destinationSelector))
await dragAndDrop(sourceSelector, {top:10, bottom:10, right: 10, left:10 })
Currently drag and drop of HTML 5 draggable element does not work properly as the mouse simulation gets interrupted by OS controls. There is an open upstream issue for the same ChromeDevTools/devtools-protocol#130

draganddrop

@dinesarun
Copy link

UPDATE: case 1 and case 3 are available in master 14cfdbc.
await dragAndDrop(sourceSelector, into(destinationSelector))
await dragAndDrop(sourceSelector, {top:10, bottom:10, right: 10, left:10 })
Currently drag and drop of HTML 5 draggable element does not work properly as the mouse simulation gets interrupted by OS controls. There is an open upstream issue for the same ChromeDevTools/devtools-protocol#130

draganddrop

Thanks @NivedhaSenthil . Available in master branch means, it will be available in latest NPM install? Am using Windows OS.

@NivedhaSenthil
Copy link
Member

It is yet to be released. Still it can be installed via npm from github
npm install git+https://github.com/getgauge/taiko.git

@NivedhaSenthil
Copy link
Member

case 2: Move source element into destination with relative to other element on the destination
await dragAndDrop(sourceSelector, into(destinationSelector), below(someOtherSelector))

Above case won't be supported as it can be achieved by giving proximity selector for destination or by moving into position.

Issue related to HTML5 draggable elements is tracked in #279

@sswaroopgupta
Copy link
Contributor Author

Suggestion
The API can be await dragAndDrop(sourceSelector, {up:10, down:10, right: 10, left:10 }) instead of await dragAndDrop(sourceSelector, {top:10, bottom:10, right: 10, left:10 })
since the destination co-ordinates are relative to the source.

@sswaroopgupta
Copy link
Contributor Author

Discussion update

Drag and drop performs the action and need not return anything.
The test has to assert if the element is at the expected location.

@NivedhaSenthil
Copy link
Member

Updated api to accept up and down
await dragAndDrop(sourceSelector, {up:10, down:10, right: 10, left:10 })
d52fcec

@sswaroopgupta
Copy link
Contributor Author

Currently the element location can be found using evaluate(<element>, (element) => element.offsetLeft) and evaluate(<element>, (element) => element.offsetTop)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants