Skip to content

A11y: add fixture and matcher for a11y tests with Axe#2462

Merged
fastfrwrd merged 23 commits intomainfrom
fastfrwrd/2457-a11y-testing
Feb 25, 2026
Merged

A11y: add fixture and matcher for a11y tests with Axe#2462
fastfrwrd merged 23 commits intomainfrom
fastfrwrd/2457-a11y-testing

Conversation

@fastfrwrd
Copy link
Contributor

@fastfrwrd fastfrwrd commented Feb 17, 2026

Implements #2457

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @grafana/plugin-e2e@3.4.0-canary.2462.22402131260.0
# or 
yarn add @grafana/plugin-e2e@3.4.0-canary.2462.22402131260.0

Copilot AI review requested due to automatic review settings February 17, 2026 19:50
@fastfrwrd fastfrwrd requested review from a team as code owners February 17, 2026 19:50
@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2026

Hello! 👋 This repository uses Auto for releasing packages using PR labels.

✨ This PR can be merged and will trigger a new minor release.
NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.

expect(report).toHaveNoA11yViolations({
// this is the complete list of a11y violations on this page today. maybe we want to do something more flake-proof here,
// but I do like that this test confirms that some violations are actually being detected
ignoredRules: ['label', 'list', 'listitem', 'page-has-heading-one'],
Copy link
Contributor Author

Choose a reason for hiding this comment

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

to see how the custom matcher outputs violations, comment out this line and run the e2es (npm run playwright:test -- --grep accessibility)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

2) [admin-wide-screen] › tests/as-admin-user/a11y/accessibility.spec.ts:4:7 › scanForA11yViolations › runs a11y audit against a basic page 

    Error: 3 Axe violations found (Threshold: 0)

    Axe Violations:
    - Rule:   Ensure every form element has a label
      ID:     label (https://dequeuniversity.com/rules/axe/4.11/label?application=playwright)
      Impact: critical
      Affected nodes:
        - <input class="" autocapitalize="none" autocomplete="off" autocorrect="off" id="react-select-2-input" spellcheck="false" tabindex="0" type="text" aria-autocomplete="list" aria-expanded="false" aria-haspopup="true" role="combobox" aria-activedescendan...="" data-testid="data-testid Dashboar..." value= ...>
    - Rule:   Ensure that lists are structured correctly
      ID:     list (https://dequeuniversity.com/rules/axe/4.11/list?application=playwright)
      Impact: serious
      Affected nodes:
        - <ul class="css-7vg4ns" aria-label="Navigation">
    - Rule:   Ensure <li> elements are used semantically
      ID:     listitem (https://dequeuniversity.com/rules/axe/4.11/listitem?application=playwright)
      Impact: serious
      Affected nodes:
        - <li class="css-njbp03">
        - <li class="css-njbp03">
        - <li class="css-njbp03">
        - <li class="css-njbp03">
        - <li class="css-njbp03">
        - <li class="css-njbp03">
        - <li class="css-njbp03">
        - <li class="css-njbp03">
        - <li class="css-njbp03">

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class accessibility (a11y) testing support to @grafana/plugin-e2e by integrating Axe with Playwright and providing an ergonomic assertion matcher for test authors.

Changes:

  • Introduces a scanForA11yViolations fixture that runs Axe scans on the current Playwright page.
  • Adds a toHaveNoA11yViolations custom matcher to produce readable assertions and output.
  • Adds an E2E spec covering the fixture + matcher behavior and wires in Axe dependencies.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
packages/plugin-e2e/tests/as-admin-user/a11y/accessibility.spec.ts Adds E2E coverage for the new fixture/matcher (and demonstrates usage).
packages/plugin-e2e/src/types.ts Exposes the new fixture type in the public PluginFixture API.
packages/plugin-e2e/src/matchers/toHaveNoA11yViolations.ts Implements the custom matcher for Axe results.
packages/plugin-e2e/src/index.ts Wires the new fixture and matcher into the exported test/expect.
packages/plugin-e2e/src/fixtures/scanForA11yViolations.ts Implements the Axe-backed fixture.
packages/plugin-e2e/package.json Adds Axe-related dependencies.
package-lock.json Lockfile updates for new dependencies.

(options?: AxeRunOptions) => Promise<AxeResults>,
PlaywrightArgs
> = async ({ page }, use, testInfo) => {
const builder = new AxeBuilder({ page }).withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa' /*'best-practice'*/]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this set of default tags can be overridden by passing options in, which is kind of demonstrated in the test. More on how to do that here: https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter-examples

fastfrwrd and others added 6 commits February 17, 2026 14:56
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…c.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…c.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@fastfrwrd fastfrwrd added minor Increment the minor version when merged enhancement New feature or request release Create a release when this pr is merged labels Feb 17, 2026
Copy link
Contributor

@sunker sunker left a comment

Choose a reason for hiding this comment

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

This looks like a great start @fastfrwrd. Added a few comments.

@fastfrwrd fastfrwrd requested a review from sunker February 20, 2026 14:48
Copy link
Contributor

@ashharrison90 ashharrison90 left a comment

Choose a reason for hiding this comment

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

lgtm 👍

let's go! 🚀

Copy link
Contributor

@sunker sunker left a comment

Choose a reason for hiding this comment

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

Just a few minor comments. I think it's fine to mark these APIs as alpha and iterate on them. We should probably avoid announcing this feature internally until it's completed though.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@fastfrwrd fastfrwrd requested a review from sunker February 23, 2026 16:01
Copy link
Contributor

@sunker sunker left a comment

Choose a reason for hiding this comment

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

🚀

@github-actions
Copy link
Contributor

Playwright test results

Image Name Version Result Report
grafana-dev 13.0.0-22400427978
grafana-enterprise 12.4.0
grafana-enterprise 12.0.10
grafana-enterprise 10.4.19
grafana-enterprise 9.3.16
grafana-enterprise 8.5.27
Troubleshooting

404 when clicking on View report

By default, the deploy-report-pages Action deploys reports to the gh-pages branch. However, you need to take an extra step to ensure that GitHub Pages can build and serve the site from this branch. To do so:

  1. Go to the Settings tab of your repository.
  2. In the left-hand sidebar, click on Pages.
  3. Under Source, select Deploy from a branch, then choose the gh-pages branch.

This action needs to be completed manually in order for your GitHub Pages site to be built and accessible from the gh-pages branch. Once configured, GitHub will automatically build and serve the site whenever new reports are deployed.

@fastfrwrd fastfrwrd merged commit a8259bf into main Feb 25, 2026
37 checks passed
@fastfrwrd fastfrwrd deleted the fastfrwrd/2457-a11y-testing branch February 25, 2026 15:21
@github-project-automation github-project-automation bot moved this from 🔬 In review to 🚀 Shipped in Grafana Catalog Team Feb 25, 2026
@grafana-plugins-platform-bot
Copy link
Contributor

🚀 PR was released in @grafana/plugin-e2e@3.4.0 🚀

@grafana-plugins-platform-bot grafana-plugins-platform-bot bot added the released This issue/pull request has been released. label Feb 25, 2026
tolzhabayev pushed a commit that referenced this pull request Feb 27, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request minor Increment the minor version when merged release Create a release when this pr is merged released This issue/pull request has been released.

Projects

Status: 🚀 Shipped

Development

Successfully merging this pull request may close these issues.

4 participants