Skip to content
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

Merged
merged 4 commits into from
Aug 16, 2023

Conversation

andrewleith
Copy link
Member

Summary | Résumé

This PR improves the the cypress GCA test suite by:

  1. Adding missing routes
  2. Adding checks for dead links across all pages
  3. Refactoring the a11y tests to keep code DRY

1. Add missing routes
2. Add checks for dead links across all pages
3. Refactor the a11y tests a bit to keep code DRY
@github-actions
Copy link

@andrewleith andrewleith marked this pull request as ready for review August 11, 2023 18:23
Comment on lines +53 to +73
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();
});
}
Copy link
Member Author

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.

Comment on lines +40 to +45
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'));
});
});
Copy link
Member Author

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)

Copy link
Contributor

@whabanks whabanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@andrewleith andrewleith merged commit 0a628ed into main Aug 16, 2023
9 checks passed
@andrewleith andrewleith deleted the feat/add-link-checking-to-gca-cypress-suite branch August 16, 2023 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants