airboardgame/cypress/integration/board.spec.js

82 lines
1.8 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-12-20 15:33:40 +01:00
cy.contains("0 Test game").parent().find("img").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-11-07 20:40:54 +01:00
cy.get(".item")
.first()
.children()
.first()
.should("have.css", "transform", "none");
2020-07-04 14:38:15 +02:00
});
2020-10-28 13:42:11 +01:00
it("Load game page", () => {
2020-12-20 15:33:40 +01:00
cy.contains("0 Test game");
2021-02-18 23:08:49 +01:00
cy.get("[alt=Save]");
cy.get("[alt=Help]");
cy.get("[alt=Information]");
2020-10-28 13:42:11 +01:00
cy.get("[title='Add an item']");
2020-07-04 14:38:15 +02:00
});
it("Pan board with middle click", () => {
cy.get(".board")
.trigger("pointerdown", {
button: 1,
clientX: 100,
clientY: 100,
2020-12-06 13:54:18 +01:00
pointerId: 1,
})
.trigger("pointermove", {
2020-07-04 14:38:15 +02:00
clientX: 200,
clientY: 200,
2020-12-06 13:54:18 +01:00
pointerId: 1,
2020-07-04 14:38:15 +02:00
force: true,
})
.trigger("pointerup", {
2020-07-04 14:38:15 +02:00
force: true,
2020-12-06 13:54:18 +01:00
pointerId: 1,
isPrimary: true,
2020-07-04 14:38:15 +02:00
});
cy.get(".board-pane").should(
"have.css",
"transform",
"matrix(1, 0, 0, 1, 100, -100)"
2020-07-04 14:38:15 +02:00
);
});
it("Pan board with left click and altKey ", () => {
cy.get(".board")
.trigger("pointerdown", {
button: 0,
2020-07-04 14:38:15 +02:00
clientX: 100,
clientY: 100,
2020-12-06 13:54:18 +01:00
pointerId: 1,
altKey: true,
})
.trigger("pointermove", {
2020-12-06 13:54:18 +01:00
button: 0,
clientX: 200,
clientY: 200,
2020-12-06 13:54:18 +01:00
pointerId: 1,
altKey: true,
2020-07-04 14:38:15 +02:00
force: true,
})
.trigger("pointerup", {
2020-07-04 14:38:15 +02:00
force: true,
2020-12-06 13:54:18 +01:00
pointerId: 1,
isPrimary: true,
2020-07-04 14:38:15 +02:00
});
cy.get(".board-pane").should(
"have.css",
"transform",
"matrix(1, 0, 0, 1, 100, -100)"
2020-07-04 14:38:15 +02:00
);
});
});