cypress best practices updated

This commit is contained in:
Owen Rees
2023-06-20 08:42:03 +02:00
parent ffbc8db21d
commit f1ef7cd3f2
13 changed files with 60 additions and 91 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ describe("Test all links", () => {
cy.viewport(600, 600);
cy.visit("/");
pages.forEach((page) => {
cy.get(".hamburger-button").click();
cy.get("[data-cy='hamburger-button']").click();
cy.contains(page, { matchCase: false }).click();
cy.location("pathname").should("eq", `/${navLinkToSlug(page)}`); // url path matches link name, replacing whitespace with hyphens
cy.go("back");
+6 -6
View File
@@ -5,12 +5,12 @@ describe("Mobile Navbar", () => {
});
it("hamburger menu on mobile screens", () => {
cy.get(".mobile-menu").should("be.not.hidden");
cy.get(".desktop-menu").should("be.hidden");
cy.get("[data-cy='mobile-menu']").should("be.visible");
cy.get("[data-cy='desktop-menu']").should("be.not.visible");
});
it("hamburger button available", () => {
cy.get(".hamburger-button").should("be.visible");
cy.get("[data-cy='hamburger-button']").should("be.visible");
});
});
@@ -21,11 +21,11 @@ describe("Desktop Navbar", () => {
});
it("desktop menu on larger screens", () => {
cy.get(".mobile-menu").should("be.hidden");
cy.get(".desktop-menu").should("be.not.hidden");
cy.get("[data-cy='mobile-menu']").should("be.hidden");
cy.get("[data-cy='desktop-menu']").should("be.not.hidden");
});
it("hamburger button hidden", () => {
cy.get(".hamburger-button").should("be.not.visible");
cy.get("[data-cy='hamburger-button']").should("be.not.visible");
});
});