Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Implement drag and drop functionality #1290

Closed
wants to merge 4 commits into from
Closed

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 grafana/k6#4346
Closes grafana/k6#4448

@CLAassistant
Copy link

CLAassistant commented Apr 29, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@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
Collaborator

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.

@inancgumus inancgumus closed this Jan 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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