not able to drag the first task in my list to 3 task
cy.get('div[data-columns="columns"]')
.find('div[data-columnContainer="columnContainer"]')
.each(($column) => {
if ($column.text().includes("Hamza Malik")) {
cy.get('div[data-taskDraggable="taskDraggable"]:nth-child(1)').drag('div[data-taskDraggable="taskDraggable"]:nth-child(3)', { force: true });
}
});
2
Answers
You can try the cypress-drag-drop plugin:
There is the
trigger()
command for simple situations, the example is hereBut this means some calculation of x-y points which is not ideal, and can break if the page layout changes.
Since you already use
cypress-drag-drop
, I suggest the selectors need changing. The code that finds your name is not affecting the drag operation.I think using
.within()
gives you better results: