Skip to content

Testing DnD with Cypress #172

Open
Open
@joetidee

Description

I am migrating over from react-beautiful-dnd (RBD) to pragmatic-dnd (PD). I had some Cypress tests working with RBD, which were modelled on this example. However, now I am on PD, they no longer work.

I found this plugin, but this also doesn't seem to be dragging the draggable element.

I noticed a Cypress example on the PD website, but this also does not seem to be dragging the element, for example:

const options = {
      force: true,
      eventConstructor: 'DragEvent',
      // If you wanted to fake dragging particular data,
      // you can add it to this `DataTransfer` with `.setData()`
      // See: https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer
      dataTransfer: new DataTransfer(),
  };
  cy.get(subject).trigger('dragstart', options);
  cy.get(target).trigger('dragenter', options).trigger('drop', options);

Does PD work with Cypress at all? If so, do you have any examples of tests or plugins that should support it?

I'm using Cypress 13.17.0

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions