mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
e2e and component testing started
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
describe("Test all links", () => {
|
||||
const pages = ["tournois", "about", "contact"];
|
||||
|
||||
it("Check navbar links point to correct pathname", () => {
|
||||
cy.visit("/");
|
||||
pages.forEach((page) => {
|
||||
cy.contains(page, { matchCase: false }).click();
|
||||
cy.location("pathname").should("eq", `/${page}`); // url path matches link name
|
||||
cy.go("back");
|
||||
});
|
||||
});
|
||||
|
||||
it("Check dead links", () => {
|
||||
pages.forEach((page) => {
|
||||
cy.visit(`/${page}`);
|
||||
cy.get("a:not([href*='mailto:']").each((link) => {
|
||||
if (
|
||||
!link
|
||||
.prop("href")
|
||||
.includes("http://www.echecs.asso.fr/FicheTournoi.aspx") // ignore every external FFE tournament link
|
||||
) {
|
||||
cy.request({
|
||||
url: link.prop("href"),
|
||||
failOnStatusCode: false,
|
||||
});
|
||||
cy.log(link.prop("href"));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,21 +0,0 @@
|
||||
describe("Test all links", () => {
|
||||
// TODO traverse entire site
|
||||
it("Test all links on homepage return 200 status", () => {
|
||||
cy.visit("/");
|
||||
cy.get("a").each((page) => {
|
||||
cy.request(page.prop("href"));
|
||||
});
|
||||
});
|
||||
|
||||
it("Check navbar links point to correct pathname", () => {
|
||||
const pages = ["tournois", "about", "contact"];
|
||||
|
||||
cy.visit("/");
|
||||
|
||||
pages.forEach((page) => {
|
||||
cy.contains(page, { matchCase: false }).click();
|
||||
cy.location("pathname").should("eq", `/${page}`); // url path matches link name
|
||||
cy.go("back");
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user