adorable-kilobyte-871
09/28/2022, 10:24 AMit('check all links', () => {
cy.visit('/')
cy.get("a:not([href*='mailto:'])").each(page => {
cy.request(page.prop('href'))
})
});
I tried the following :
var links = []
it("setup", () => {
cy.visit("/")
cy.get("a:not([href*='mailto:'])").each((page) => {
links.push(page.prop("href"))
})
})
links.forEach((link) => {
it(`Checking ${link}`, () => {
cy.request(link)
})
})
But only the very first test "setup" is run and the loop does not execute any test.
What would be the good approach to do it correctly ?