-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/add link checking to gca cypress suite #1646
Feat/add link checking to gca cypress suite #1646
Conversation
1. Add missing routes 2. Add checks for dead links across all pages 3. Refactor the a11y tests a bit to keep code DRY
🧪 Review environmenthttps://p2znnvfv4jgwabdvvcfyi337da0yuwhu.lambda-url.ca-central-1.on.aws/ |
for (const viewport of config.viewports) { | ||
context('A11y and HTML validation test', () => { | ||
context(`Viewport: ${viewport}px x 660px`, () => { | ||
for (const lang of langs) { | ||
const currentLang = (lang === 'en' ? 'English' : 'Francais'); | ||
context(currentLang, () => { | ||
for (const page of fullPageList) { | ||
it(`${page[lang]} passes a11y checks`, () => { | ||
// cy.viewport(viewport, 660); | ||
if (lang === 'fr') { | ||
cy.visit('/set-lang'); | ||
} | ||
cy.visit(page[lang]); | ||
|
||
cy.get('main').should('be.visible'); | ||
|
||
// check for a11y compliance | ||
cy.injectAxe(); | ||
cy.checkA11y(); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a refactor of the existing a11y test to make it DRY.
cy.get('body').within(() => { | ||
cy.get('a').each((link) => { | ||
if (link.prop('href').startsWith('mailto') || link.prop('href').startsWith('/set-lang') || link.prop('href').startsWith('#')) return; | ||
cy.request(link.prop('href')); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new test that loops through all links on a page (except mailto, language switch, and same-page links)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Summary | Résumé
This PR improves the the cypress GCA test suite by: