Created
August 28, 2021 17:32
-
-
Save fernyb/2bc1feda9b02f186fb89f16e708a500a to your computer and use it in GitHub Desktop.
Cypress draw on canvas
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it("Draw on canvas", () => { | |
const drawLine = (x, y) => { | |
// cy.get("#canvas") | |
// .trigger("mousedown", x, y) | |
// .trigger("mousemove", x, y) | |
// .trigger("mousemove", x += 100, y) | |
// .trigger("mousemove", x += 100, y) | |
// .trigger("mousemove", x += 100, y) | |
// .trigger("mouseup", { force: true }); | |
cy.get("#canvas") | |
.trigger("mousedown", x, y) | |
.trigger("mousemove", x, y) | |
.trigger("mousemove", { offsetX: x, offsetY: y }) | |
.trigger("mousemove", { offsetX: x += 100, offsetY: y }) | |
.trigger("mousemove", { offsetX: x += 100, offsetY: y }) | |
.trigger("mouseup", { force: true }); | |
}; | |
// Cypress._.times(10, (idx) => { | |
drawLine(20, 50); | |
// }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment