SortableJS / Sortable

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
https://sortablejs.github.io/Sortable/
MIT License
29.58k stars 3.7k forks source link

Cypress test example #1775

Closed FlorianWerndl closed 4 years ago

FlorianWerndl commented 4 years ago

Hi, great library, thanks for that! I am trying to write an e2e with cypress but without any success. Maybe you can provide an example on how to write a test with cpyress.io.

What i tried so far: (I am using vue & vue draggable)

    cy.get(`[data-cy=ci-image-sort__image-wrapper-inner-${number}]`)
      .trigger('mouseover')
      .trigger('mousedown', { which: 1, force: true })
      .trigger('mousemove', x, y, { clientX: x, clientY: y, which: 1, force: true })
      .trigger('mouseup', x, y, { clientX: x, clientY: y, which: 1, force: true });

Maybe I need to use other events?

waynevanson commented 4 years ago

@FlorianWerndl

Check out this example on cypress. We haven't tested it here but it's what cypress have recommended: https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/testing-dom__drag-drop

jeansymolanza commented 4 years ago

Are there any examples for Protractor/Angular?

waynevanson commented 4 years ago

@jeansymolanza Not here. Maybe ask the team at https://github.com/SortableJS/ngx-sortablejs