I am trying to make DnD work in Cypress and React app.
At first I was trying all examples around those with simulating by mouse events but it is not working in general in my environment. :(
I was able to write a test where I know the drag element and drop element using this code.
const dataTransfer = new DataTransfer();
cy.get(dragSelector).trigger("dragstart", {
dataTransfer,
force: true,
});
cy.get(dropSelector).trigger("drop", {
dataTransfer,
force: true,
});
And it's working well. Similar sample code I have found in Cypress cookbook.
But now I need to do DnD where I don't know the drop zone / elem. Its resizer and I need dnd by offset for example 20px on Y axis. (Resize element height by 20px)
So is it possible to do it somehow like this ?
const dataTransfer = new DataTransfer();
// drag selector is element with draggable attribute and I need move it by 20px from top to down
cy.get(dragSelector).trigger("dragstart", {
dataTransfer,
force: true,
}).trigger("drop",{...how to set drop offset if is possible...})
trigger drop event as some parameters like offsetX and offsetY or x or y and pageX or pageY ... but I was not successful.
Like I sad I am not able use it by simulating mouse events in my app from unknow reason its not working.