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-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", () => {
|
|
|
|
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")
|
2020-11-27 14:55:23 +01:00
|
|
|
.trigger("pointerdown", {
|
|
|
|
button: 1,
|
|
|
|
clientX: 100,
|
|
|
|
clientY: 100,
|
|
|
|
isPrimary: true,
|
|
|
|
})
|
|
|
|
.trigger("pointermove", {
|
2020-07-04 14:38:15 +02:00
|
|
|
clientX: 200,
|
2020-11-27 14:55:23 +01:00
|
|
|
clientY: 200,
|
|
|
|
isPrimary: 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-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,
|
|
|
|
isPrimary: true,
|
|
|
|
altKey: true,
|
|
|
|
})
|
|
|
|
.trigger("pointermove", {
|
|
|
|
clientX: 200,
|
|
|
|
clientY: 200,
|
|
|
|
isPrimary: 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-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
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|