airboardgame/cypress/integration/board.spec.js

58 lines
1.3 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-10-28 13:42:11 +01:00
cy.contains("Test Game").parent().find(".button").click();
2020-07-04 14:38:15 +02:00
// Way board loading
cy.get(".board-pane").should(
"have.css",
"transform",
"matrix(1, 0, 0, 1, 0, -200)"
);
});
2020-10-28 13:42:11 +01:00
it("Load game page", () => {
cy.contains("Test game");
cy.get("[title=Save]");
cy.get("[title=Help]");
cy.get("[title=Information]");
cy.get("[title='Add an item']");
2020-07-04 14:38:15 +02:00
});
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)"
);
});
});