https://cypress.io logo
Hello everyone, I'm struggling to change the follo...
# e2e-testing
a
Hello everyone, I'm struggling to change the following lines to one test per found link :
Copy code
it('check all links', () => {
  cy.visit('/')
  cy.get("a:not([href*='mailto:'])").each(page => {
    cy.request(page.prop('href'))
  })
});
I tried the following :
Copy code
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 ?