Skip to content

A problem with drag and drop #197

Description

@HarelM

I have a test which tests a scenario of a user drag-and-drop on a sortable/dragable list.
It seems that after I upgrade my code to React 19 this test starts failing.
It fails locally in every run and also fail in the CI.
See here:
maplibre/maputnik#1360

When looking at the cypress video it looks like the element is being dragged and dropped, but for some reason it returns to the original position.

When trying to play around with the dragAndDrop method the following seems to solve it:

dragAndDropWithWait: (element: string, targetElement: string) => {
      this.helper.get.elementByTestId(element).realMouseDown({ button: "left", position: "center" });
      this.helper.get.elementByTestId(element).realMouseMove(0, 10, { position: "center" });
      this.helper.get.elementByTestId(targetElement).realMouseMove(0, 0, { position: "center" })
      this.helper.when.wait(1); // seems like adding a wait of 1ms is enough to make the test pass, I tried it with different values. and also different places in this method, this is the only one needed and this is the minimal time.
      this.helper.get.elementByTestId(targetElement).realMouseUp();

This code is basically the same as the code in this library besides the wait call.
Let me know how you would like to proceed with the above information.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions