mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
cypress best practices updated
This commit is contained in:
@@ -4,11 +4,11 @@ import Contact from "@/app/contactez-nous/page";
|
||||
|
||||
const navbarFooterCheck = () => {
|
||||
it("includes navbar", () => {
|
||||
cy.get("nav");
|
||||
cy.get("[data-cy='navbar']");
|
||||
});
|
||||
|
||||
it("includes footer", () => {
|
||||
cy.get("footer");
|
||||
cy.get("[data-cy='footer']");
|
||||
});
|
||||
};
|
||||
|
||||
@@ -19,7 +19,9 @@ describe("Verify component mount", () => {
|
||||
});
|
||||
|
||||
it("correct h1 tags with website name included", () => {
|
||||
cy.get("h1").contains("echecs france", { matchCase: false });
|
||||
cy.get("[data-cy='header1']").contains("echecs france", {
|
||||
matchCase: false,
|
||||
});
|
||||
});
|
||||
|
||||
navbarFooterCheck();
|
||||
@@ -31,7 +33,9 @@ describe("Verify component mount", () => {
|
||||
});
|
||||
|
||||
it("correct h1 tags with page title included", () => {
|
||||
cy.get("h2").contains("qui sommes-nous", { matchCase: false });
|
||||
cy.get("[data-cy='header2']").contains("qui sommes-nous", {
|
||||
matchCase: false,
|
||||
});
|
||||
});
|
||||
|
||||
navbarFooterCheck();
|
||||
@@ -43,7 +47,9 @@ describe("Verify component mount", () => {
|
||||
});
|
||||
|
||||
it("correct h1 tags with page title included", () => {
|
||||
cy.get("h2").contains("contactez-nous", { matchCase: false });
|
||||
cy.get("[data-cy='header2']").contains("contactez-nous", {
|
||||
matchCase: false,
|
||||
});
|
||||
});
|
||||
|
||||
navbarFooterCheck();
|
||||
|
||||
@@ -10,17 +10,17 @@ describe("ThemeSwitcher component", () => {
|
||||
cy.wait(100);
|
||||
|
||||
// checking that the toggle is there and light mode is active
|
||||
cy.get(".toggle").should("exist");
|
||||
cy.get(".toggle").should(($toggle) => {
|
||||
cy.get("[data-cy='toggle']").should("exist");
|
||||
cy.get("[data-cy='toggle']").should(($toggle) => {
|
||||
const backgroundImage = $toggle.css("background-image");
|
||||
expect(backgroundImage).to.include(
|
||||
"linear-gradient(rgb(0, 255, 255), rgb(135, 206, 235)"
|
||||
);
|
||||
});
|
||||
// checking that the toggle is clickable and dark mode is active
|
||||
cy.get(".toggle").click();
|
||||
cy.get(".toggle-dark").should("exist");
|
||||
cy.get(".toggle-dark").should(($toggle) => {
|
||||
cy.get("[data-cy='toggle']").click();
|
||||
cy.get("[data-cy='toggle-dark']").should("exist");
|
||||
cy.get("[data-cy='toggle-dark']").should(($toggle) => {
|
||||
const backgroundImage = $toggle.css("background-image");
|
||||
expect(backgroundImage).to.include(
|
||||
"linear-gradient(rgb(25, 25, 112), rgb(102, 51, 153)"
|
||||
|
||||
Reference in New Issue
Block a user