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

dev: add a11y tests on our docs site #1192

Open
5 tasks done
daine opened this issue Oct 3, 2024 · 1 comment
Open
5 tasks done

dev: add a11y tests on our docs site #1192

daine opened this issue Oct 3, 2024 · 1 comment
Assignees
Labels
development Development tasks New | Nouveau New card, needs to be groomed

Comments

@daine
Copy link
Collaborator

daine commented Oct 3, 2024

πŸ“‡ User story

As a gcds developer, I want accessibility tests to run on our documentation website so that I can be sure it meets accessibility checks every time I update the site with a PR

βœ… Definition of Done / Outcomes

  • Done when there is a github action that runs an accessibility check
  • Done when the github action runs on a PR
  • Done when the github action runs on a deployment / when the website is published

πŸ“œ Acceptance criteria

  • Test script runs for every page, both in EN and FR, in the documentation website
  • Test script checks for dead links

πŸ“ More info

Notify has these on their CI (from Andrew L):
Here is our workflow that tests staging every 3 hours for a11y:
https://github.com/cds-snc/notification-admin/blob/main/.github/workflows/cypress-staging.yaml
We also have a full suite of tests that run on every PR (including the same a11y checks as above):
https://github.com/cds-snc/notification-admin/blob/main/.github/workflows/test-admin-deploy.yaml#L153
We wrote a little helper to wrap axe and the html validator (and a few other things that were specific to problems we encountered, like dead links) here:
https://github.com/cds-snc/notification-admin/blob/main/tests_cypress/cypress/support/commands.js#L11

Using that helper, you could scan your component pages (or wherever) like this:

const component_pages = [
    'https://design-system.alpha.canada.ca/en/components/breadcrumbs/',
    'https://design-system.alpha.canada.ca/en/components/button/',
    'https://design-system.alpha.canada.ca/en/components/card/',
    'https://design-system.alpha.canada.ca/en/components/checkbox/',
    'https://design-system.alpha.canada.ca/en/components/container/',
    'https://design-system.alpha.canada.ca/en/components/date-input/'
];

describe("Check GCDS for a11y", () => {
    component_pages.forEach((page) => {
        it(`A11Y check for ${page}`, () => {
            cy.a11yScan(page, { a11y: true, htmlValidate: true, deadLinks: false, mimeTypes: false, axeConfig: false });
        });
    });
});

image (5)

. 🚫 Out of scope
_ If possible, give precisions on what is not part of this work_

@daine daine added the New | Nouveau New card, needs to be groomed label Oct 3, 2024
@daine daine added the development Development tasks label Jan 15, 2025
@ethanWallace ethanWallace self-assigned this Jan 20, 2025
@ethanWallace
Copy link
Collaborator

Created a separate pull request to handle the component previews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Development tasks New | Nouveau New card, needs to be groomed
Projects
None yet
Development

No branches or pull requests

2 participants