Fixed cypress drag command to behave correctly with d3-drag
This commit is contained in:
@@ -24,10 +24,14 @@
|
|||||||
// -- This is will overwrite an existing command --
|
// -- This is will overwrite an existing command --
|
||||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||||
|
|
||||||
|
|
||||||
Cypress.Commands.add('drag', (selector, { x, y }) => {
|
Cypress.Commands.add('drag', (selector, { x, y }) => {
|
||||||
return cy.get(selector)
|
return cy
|
||||||
.trigger('mousedown', { which: 1 })
|
.window()
|
||||||
.trigger('mousemove', { clientX: x, clientY: y })
|
.then((window) =>
|
||||||
.trigger('mouseup', { force: true });
|
cy
|
||||||
|
.get(selector)
|
||||||
|
.trigger('mousedown', { which: 1, view: window })
|
||||||
|
.trigger('mousemove', { clientX: x, clientY: y, force: true })
|
||||||
|
.trigger('mouseup', { view: window })
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user