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

Implement drag and drop functionality #1290

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

allansson
Copy link

@allansson allansson commented Apr 29, 2024

What?

This PR implements drag and drop functions on Page, Frame and Locator.

Why?

There's a gap in functionality where it's not possible to easily test applications relying on the HTML drag-and-drop API:s.

Checklist

  • I have performed a self-review of my code
  • I have added tests for my changes
  • I have commented on my code, particularly in hard-to-understand areas

Related PR(s)/Issue(s)

Closes #336
Closes #1118
Closes #378

@CLAassistant
Copy link

CLAassistant commented Apr 29, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@inancgumus inancgumus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work 👍 I have a question.

func (l *Locator) DragTo(target *Locator) error {
l.log.Debugf("Locator:DragTo", "fid:%s furl:%q sel:%q target:%q", l.frame.ID(), l.frame.URL(), l.selector, target.selector)

if err := l.dragTo(target); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this just call l.frame.DragAndDrop(l.selector, ...)?

Why do we need "@@locator" in mapping.go?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this just call l.frame.DragAndDrop(l.selector, ...)?

I started out by implementing dragTo and then discovered the dragAndDrop functions on Page and Frame. I've implemented those functions, but this initial attempt hanged around. Now that those are working, I'm back to implementing dragTo on top of those functions.

Why do we need "@@locator" in mapping.go?

Since dragTo accepts a locator instance as its first argument, we need to get the selector of that other instance. I'm going to change this to be the selector and not the whole locator.

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

Successfully merging this pull request may close these issues.

Add .dragTo() to Locator API Add DragTo feature locator.dragTo(target[, options])
3 participants