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

Add a11y test job running against key pages (#14773) #14862

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

alexgibson
Copy link
Member

@alexgibson alexgibson commented Jul 22, 2024

One-line summary

Adds a new Playwright a11y test suite, powered via Axe Core.

Significant changes and points to review

These initial tests are against a small-ish set of our key, most high-traffic pages. The test runs will fail for now and that's fine. They will not block deployments, and will instead run once per-day against www-dev and report via Slack. We can expand the number of pages this test suite covers as we work through issues it identifies.

Issue / Bugzilla link

#14773

Testing

  • cd tests/playwright && npm ci && npm run install-deps
  • npm run a11y-tests

Once the test run completes, it should fail (which is expected).

The resulting failures will be captured as HTML reports and saved in ./tests/playwright/test-reports-a11y/. You can open these files in your browser and read more information about each issue.

Copy link

codecov bot commented Jul 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.33%. Comparing base (b7e331d) to head (95f6e59).
Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14862   +/-   ##
=======================================
  Coverage   77.33%   77.33%           
=======================================
  Files         161      161           
  Lines        8344     8344           
=======================================
  Hits         6453     6453           
  Misses       1891     1891           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alexgibson alexgibson force-pushed the playwright-ally branch 3 times, most recently from 32d831e to 169e16f Compare July 25, 2024 13:52
@alexgibson alexgibson added the Frontend HTML, CSS, JS... client side stuff label Jul 29, 2024
@four-keys-mozilla four-keys-mozilla bot temporarily deployed to test July 29, 2024 14:10 Inactive
@alexgibson alexgibson force-pushed the playwright-ally branch 2 times, most recently from 910c5ee to 1b3c9ce Compare July 29, 2024 14:46
@alexgibson alexgibson changed the title Add a11y test job running against home page (#14773) Add a11y test job running against home/about pages (#14773) Jul 30, 2024
@alexgibson alexgibson force-pushed the playwright-ally branch 7 times, most recently from de41ea2 to 8927c7b Compare July 31, 2024 13:25
Copy link
Contributor

@janbrasna janbrasna left a comment

Choose a reason for hiding this comment

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

Do the tests pass currently? I'm getting (besides color contrast, heading order etc.):

CRITICAL: Elements Must Only Use Allowed ARIA Attributes More Info
Fix the following: ARIA attribute is not allowed: aria-expanded="false" for <div class="c-navigation-items" id="c-navigation-items" data-testid="navigation-menu-items" aria-expanded="false">

(So this would be better resolved first? Adding a button role, or marking up menu, menubar, menuitem roles and using aria-haspopup too?)

Also, nit:

tests/playwright/specs/a11y/components.spec.js Outdated Show resolved Hide resolved
@alexgibson
Copy link
Member Author

Do the tests pass currently?

Oh this will absolutely fail at first and that's very intentional. We'll likely have a lot of small a11y issues that the tests identify, but we can get to those after we have this job running and reporting correctly.

@alexgibson alexgibson force-pushed the playwright-ally branch 5 times, most recently from 394b106 to 354fb8e Compare August 1, 2024 15:56
@alexgibson alexgibson changed the title Add a11y test job running against home/about pages (#14773) Add a11y test job running against key pages (#14773) Aug 1, 2024
@alexgibson alexgibson added Needs Review Awaiting code review P3 Third level priority - Nice to have labels Aug 19, 2024
@alexgibson alexgibson marked this pull request as ready for review August 19, 2024 09:06
@alexgibson alexgibson added the Review: XS Code review time: up to 30min label Aug 19, 2024
@stephaniehobson stephaniehobson self-assigned this Aug 22, 2024
tag: '@a11y'
},
() => {
test.use({ viewport: { width: 360, height: 780 } });
Copy link
Contributor

Choose a reason for hiding this comment

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

Excited to have mobile specific tests 🔥

Copy link
Contributor

@stephaniehobson stephaniehobson left a comment

Choose a reason for hiding this comment

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

R+ :accessibility:


// Open Firefox menu
await expect(firefoxMenu).not.toBeVisible();
await firefoxLink.click();
Copy link
Contributor

Choose a reason for hiding this comment

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

Enhancement/Thought: Since these are a11y tests it would be good to test that keyboard navigation works but it's not a blocker for this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd probably consider those to be functional tests as opposed to something specific to the a11y test job, but it would be a good bit of extra coverage agreed 👍

@stephaniehobson stephaniehobson merged commit b572136 into mozilla:main Aug 22, 2024
5 checks passed
@alexgibson alexgibson deleted the playwright-ally branch August 23, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frontend HTML, CSS, JS... client side stuff Needs Review Awaiting code review P3 Third level priority - Nice to have Review: XS Code review time: up to 30min
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants