clauderic / react-sortable-hoc

A set of higher-order components to turn any list into an animated, accessible and touch-friendly sortable list✌️
https://clauderic.github.io/react-sortable-hoc/
MIT License
10.77k stars 978 forks source link

Integration Testing #401

Open sammiwei911 opened 6 years ago

sammiwei911 commented 6 years ago

We are trying to simulate the drag and drop event, but when one item is selected(mouse on hold to it) the visibility is set to hidden. We were able to simulate drag and drop because of this reason. Is there a walk around to it. FYI, we are using driver.execute_script(js + "$('#one').simulateDragDrop({ dropTarget: '#bin'});")

TomPradat commented 4 years ago

I get a similar problem with cypress, I can't drag and drop the element (using mousedown, mousemove and mouseup).

gargroh commented 4 years ago

Did anyone find solution for it ?

shogunatealex commented 4 years ago

I was able to get around it with cypress by initiating the mousedown event and the clicking somewhere else on the screen. That will trick the mouse to move there which will cause a drag, and then trigger a mouse down event again ending the transition.

cy.get('[data-testid="draghandle3"]')
                .trigger("mousedown")

cy.getTestElement('somewhereElseOnThePage').click();

Ideal, nope, but it got the job done and correctly tested the list I was trying to test.

NOTE: To prevent unexpected side effects, click on something without an event listener, I grabbed some text on the page above my list and clicked on that. Nothing happened except my item got moved to the top of the list.