airboardgame/cypress/integration/board.spec.js

60 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-07-04 14:38:15 +02:00
describe("Board interactions", () => {
beforeEach(() => {
cy.viewport(1000, 600);
cy.visit("/");
2020-07-14 21:18:21 +02:00
cy.contains("I want to play...", { timeout: 5000 }).click();
2020-07-04 14:38:15 +02:00
cy.contains("Menu").click();
cy.contains("Test game").click();
// Way board loading
cy.get(".board-pane").should(
"have.css",
"transform",
"matrix(1, 0, 0, 1, 0, -200)"
);
});
it("Load home page", () => {
cy.contains("Menu");
cy.contains("Help");
cy.contains("AirBoard");
cy.contains("Edit mode");
cy.get("input").should("have.value", "Player");
});
it("Pan board with middle click", () => {
cy.get(".board")
.trigger("mousedown", { button: 1 })
.trigger("mousemove", {
clientX: 200,
clientY: 250,
force: true,
})
.trigger("mouseup", {
force: true,
});
cy.get(".board-pane").should(
"have.css",
"transform",
"matrix(1, 0, 0, 1, -300, -250)"
);
});
it("Pan board with left click and altKey ", () => {
cy.get(".board")
.trigger("mousedown", { button: 0, altKey: true })
.trigger("mousemove", {
clientX: 100,
clientY: 150,
force: true,
})
.trigger("mouseup", {
force: true,
});
cy.get(".board-pane").should(
"have.css",
"transform",
"matrix(1, 0, 0, 1, -400, -350)"
);
});
});