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]");
|
2021-03-13 23:13:32 +01:00
|
|
|
cy.get("[alt='Help & info']");
|
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")
|
2020-11-27 14:55:23 +01:00
|
|
|
.trigger("pointerdown", {
|
|
|
|
button: 1,
|
|
|
|
clientX: 100,
|
|
|
|
clientY: 100,
|
2020-12-06 13:54:18 +01:00
|
|
|
pointerId: 1,
|
2020-11-27 14:55:23 +01:00
|
|
|
})
|
|
|
|
.trigger("pointermove", {
|
2020-07-04 14:38:15 +02:00
|
|
|
clientX: 200,
|
2020-11-27 14:55:23 +01:00
|
|
|
clientY: 200,
|
2020-12-06 13:54:18 +01:00
|
|
|
pointerId: 1,
|
2020-07-04 14:38:15 +02:00
|
|
|
force: true,
|
|
|
|
})
|
2020-11-27 14:55:23 +01:00
|
|
|
.trigger("pointerup", {
|
2020-07-04 14:38:15 +02:00
|
|
|
force: true,
|
2020-12-06 13:54:18 +01:00
|
|
|
pointerId: 1,
|
2020-11-27 14:55:23 +01:00
|
|
|
isPrimary: true,
|
2020-07-04 14:38:15 +02:00
|
|
|
});
|
|
|
|
cy.get(".board-pane").should(
|
|
|
|
"have.css",
|
|
|
|
"transform",
|
2020-11-27 14:55:23 +01:00
|
|
|
"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")
|
2020-11-27 14:55:23 +01:00
|
|
|
.trigger("pointerdown", {
|
|
|
|
button: 0,
|
2020-07-04 14:38:15 +02:00
|
|
|
clientX: 100,
|
2020-11-27 14:55:23 +01:00
|
|
|
clientY: 100,
|
2020-12-06 13:54:18 +01:00
|
|
|
pointerId: 1,
|
2020-11-27 14:55:23 +01:00
|
|
|
altKey: true,
|
|
|
|
})
|
|
|
|
.trigger("pointermove", {
|
2020-12-06 13:54:18 +01:00
|
|
|
button: 0,
|
2020-11-27 14:55:23 +01:00
|
|
|
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,
|
|
|
|
})
|
2020-11-27 14:55:23 +01:00
|
|
|
.trigger("pointerup", {
|
2020-07-04 14:38:15 +02:00
|
|
|
force: true,
|
2020-12-06 13:54:18 +01:00
|
|
|
pointerId: 1,
|
2020-11-27 14:55:23 +01:00
|
|
|
isPrimary: true,
|
2020-07-04 14:38:15 +02:00
|
|
|
});
|
|
|
|
cy.get(".board-pane").should(
|
|
|
|
"have.css",
|
|
|
|
"transform",
|
2020-11-27 14:55:23 +01:00
|
|
|
"matrix(1, 0, 0, 1, 100, -100)"
|
2020-07-04 14:38:15 +02:00
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|