diff --git a/tests/cypress/support/commands.ts b/tests/cypress/support/commands.ts index 74ae01e0..3c7555cd 100644 --- a/tests/cypress/support/commands.ts +++ b/tests/cypress/support/commands.ts @@ -49,8 +49,12 @@ declare global { Cypress.Commands.add('checkForBrokenLinks', () =>{ cy.get('a').each(link => { const href = link.prop('href') - if (href && !href.includes('example.com') && !href.includes('europa.eu')) { - cy.request(href) + if (href) { + const host = new URL(href).host; + const allowedHosts = ['example.com', 'europa.eu']; + if (!allowedHosts.includes(host)) { + cy.request(href) + } } }) })