Skip to content

docs: add playwright a11y tests for the composition app#698

Open
fateeand wants to merge 12 commits into
masterfrom
685-add-playwright-a11y-tests-for-the-composition-app
Open

docs: add playwright a11y tests for the composition app#698
fateeand wants to merge 12 commits into
masterfrom
685-add-playwright-a11y-tests-for-the-composition-app

Conversation

@fateeand

@fateeand fateeand commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Added Playwright + axe-core accessibility test coverage for the composition app (previously only individual cps-ui-kit components were scanned, not the composition app's pages/shell/flows), scanning against WCAG 2.0/2.1/2.2 A/AA + best-practice rules
  • Reorganized playwright/ into cps-ui-kit/ (with a components/ subfolder) and composition/, each with a dedicated accessibility-*.spec.ts file routed to a new accessibility Playwright project (Desktop Chrome only); added matching granular npm run test:playwright:* scripts for running any slice (composition/cps-ui-kit × all/accessibility/components)
  • Grouped accessibility test entries by component; components with multiple states/variants now nest their axe scans under a single test.describe(componentName) block via a group field on each ComponentEntry, instead of appearing as flat, hard-to-scan individual test rows
  • Replaced the old states/ComponentState pattern entirely with the group field - every state a component can be in is now its own explicit, independently pass/fail-able test entry rather than being bundled and iterated internally, since all states are meaningfully distinct examples worth seeing pass/fail on their own
  • Fixed every real accessibility issue these new scans surfaced across the library and composition app (see below), so npm run test:playwright and npm run test:pa11y are both fully green
  • Added a pa11y job to CI running pa11y-ci against all 33 composition demo pages, independent of the Playwright checks, and fixed its config so it actually fails the build on a real error (previously --threshold 1000 meant it never would) and enabled axe's target-size rule so its WCAG 2.2 coverage (2.5.8) matches what Playwright already checks
  • Updated README.md and playwright/README.md to reflect the new structure, scripts, and the two independent accessibility-testing surfaces (Playwright/axe-core vs. pa11y-ci)

Accessibility fixes found via pa11y

  • cps-chip: added ARIA role="group" on the root element
  • cps-sidebar-menu: gave nav items role="link"
  • cps-select / cps-tree-select / cps-tree-autocomplete / cps-autocomplete / cps-datepicker: made aria-controls conditional on open state, so it never references an ID that doesn't exist in the DOM (the popup isn't rendered until opened)
  • cps-tree-table: removed the empty <tfoot> which PrimeNG renders unconditionally in the non-scrollable view, which otherwise violates aria-required-children
  • cps-loader: removed "Loading..." text animation in reduced motion mode
  • Composition app shell: promoted the page title <span> to an <h1>, fixing the missing-top-level-heading violation on every route
  • table-page / tree-table-page: replaced raw color-only pass/fail indicators ([style.color] + Unicode checkmark/cross glyphs) with cps-icon + explicit ariaLabel, fixing color-contrast and non-text-content violations
  • .composition-page (root page container): gave it a real background color instead of transparent - this was the root cause of the majority of elmPartiallyObscured color-contrast false positives site-wide, since axe couldn't resolve an opaque background through the transparent scroll container
  • button-toggle-page: marked the "disabled" example preview as non-interactive so axe doesn't flag intentionally-disabled controls
  • code-example panel: fixed a scroll-following focus-ring bug where the ring appeared to detach from its element when the preview panel was scrolled

TODO on merge: add feat: resolve remaining accessibility issues to squash commit footer to generate a release PR


Release notes:

  • Add playwright a11y tests for the composition app
  • Group accessibility test entries by component
  • Resolve remaining accessibility issues, detected by pa11y

Copilot AI review requested due to automatic review settings July 7, 2026 19:17
@fateeand fateeand linked an issue Jul 7, 2026 that may be closed by this pull request
@fateeand fateeand linked an issue Jul 7, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Coverage report for library

St.
Category Percentage Covered / Total
🟡 Statements 67.88% 5647/8319
🔴 Branches 57.35% 2451/4274
🟡 Functions 68.04% 1060/1558
🟡 Lines 68.92% 5276/7655

Test suite run success

2188 tests passing in 63 suites.

Report generated by 🧪jest coverage report action from 862459e

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds end-to-end accessibility coverage for the composition app (in addition to existing component-level scans) by introducing a dedicated Playwright “accessibility” project powered by axe-core, reorganizing the Playwright test suite, and wiring an independent pa11y-ci check into CI. The PR also includes several UI-kit and composition UI updates to resolve newly surfaced accessibility violations.

Changes:

  • Introduce Playwright + axe-core accessibility scanning for both cps-ui-kit component pages and the full composition app routes (desktop + mobile viewport), with shared helpers and grouped test organization.
  • Add/adjust pa11y-ci scripts/config and a new CI job to run pa11y checks independently of Playwright.
  • Apply targeted a11y fixes across components and composition pages (ARIA semantics, conditional aria-controls, reduced motion behavior, heading structure, and non-color-only status indicators).

Reviewed changes

Copilot reviewed 33 out of 35 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
README.md Updates repo documentation for the new accessibility testing surfaces and scripts.
projects/cps-ui-kit/src/lib/components/cps-tree-table/cps-tree-table.component.ts Adds workaround to remove PrimeNG’s empty <tfoot> that violates ARIA requirements.
projects/cps-ui-kit/src/lib/components/cps-tree-select/cps-tree-select.component.html Makes aria-controls conditional on open state to avoid referencing missing IDs.
projects/cps-ui-kit/src/lib/components/cps-tree-autocomplete/cps-tree-autocomplete.component.html Makes aria-controls conditional on open state to avoid referencing missing IDs.
projects/cps-ui-kit/src/lib/components/cps-sidebar-menu/cps-sidebar-menu.component.html Adds explicit link role to improve nav semantics for router-link items.
projects/cps-ui-kit/src/lib/components/cps-select/cps-select.component.html Makes aria-controls conditional on open state to avoid referencing missing IDs.
projects/cps-ui-kit/src/lib/components/cps-loader/cps-loader.component.scss Adjusts reduced-motion behavior to remove text animation while keeping progress indication.
projects/cps-ui-kit/src/lib/components/cps-datepicker/cps-datepicker.component.html Makes ariaControls conditional on open state to avoid referencing missing IDs.
projects/cps-ui-kit/src/lib/components/cps-chip/cps-chip.component.html Adds role="group" for improved accessibility semantics.
projects/cps-ui-kit/src/lib/components/cps-autocomplete/cps-autocomplete.component.html Makes aria-controls conditional on open state to avoid referencing missing IDs.
projects/composition/src/styles.scss Sets an opaque body background to reduce contrast false-positives through transparency.
projects/composition/src/app/pages/tree-table-page/tree-table-page.component.ts Imports CpsIconComponent for icon-based boolean indicators.
projects/composition/src/app/pages/tree-table-page/tree-table-page.component.html Replaces color-only + glyph indicators with cps-icon + ariaLabel.
projects/composition/src/app/pages/table-page/table-page.component.ts Imports CpsIconComponent for icon-based boolean indicators.
projects/composition/src/app/pages/table-page/table-page.component.html Replaces color-only + glyph indicators with cps-icon + ariaLabel.
projects/composition/src/app/pages/sidebar-menu-page/sidebar-menu-page.component.html Adds an accessible label to the sidebar menu example.
projects/composition/src/app/pages/button-toggle-page/button-toggle-page.component.html Marks disabled preview as non-interactive to avoid intentional-disabled control violations.
projects/composition/src/app/components/code-example/code-example.component.scss Updates typography and adjusts focus styling to avoid scroll/focus-ring visual issues.
projects/composition/src/app/components/code-example/code-example.component.html Promotes example label heading level for improved document structure.
projects/composition/src/app/app.component.scss Ensures heading styling inherits existing toolbar typography.
projects/composition/src/app/app.component.html Promotes page title to an h1 to satisfy top-level heading requirements.
playwright/README.md Documents new Playwright structure, scripts, and the accessibility project routing.
playwright/fixtures/composition-components.ts Refactors component/page registry to support grouped entries and exports page route list.
playwright/fixtures/axe-test.ts Removes the old axe fixture in favor of shared helpers.
playwright/fixtures/axe-helpers.ts Adds shared axe-core Playwright fixture + helper utilities (formatting, waits).
playwright/cps-ui-kit/components/cps-table.spec.ts Fixes fixture file path after Playwright folder reorganization.
playwright/cps-ui-kit/components/cps-scheduler.spec.ts Adds functional Playwright coverage for scheduler flows and cron generation.
playwright/cps-ui-kit/components/cps-autocomplete.spec.ts Adds functional Playwright coverage for autocomplete interactions.
playwright/cps-ui-kit/accessibility-cps-ui-kit.spec.ts Adds grouped, per-component axe scans (desktop + mobile viewport).
playwright/composition/accessibility-composition.spec.ts Adds full-page axe scans per route + shell interactive state and focus-flow coverage.
playwright/a11y-matrix-generator.js Removes the old matrix generator tooling.
playwright.config.ts Routes “accessibility” specs into a dedicated Playwright project and excludes them from functional runs.
package.json Adds granular Playwright scripts and replaces legacy a11y scripts with pa11y equivalents.
.pa11yci Tightens pa11y config (remove ineffective threshold, enable target-size rule, adjust hidden elements).
.github/workflows/cps-shared-ui-checkers.yml Adds a dedicated pa11y CI job to run pa11y-ci against the composition pages.

Comment thread package.json Outdated
Comment on lines +30 to +33
/**
* Groups consecutive entries sharing the same `group` so their tests can be
* nested under a shared test.describe block.
*/
Comment on lines +899 to +901

this._removeEmptyFooter();
}
Comment on lines +915 to +917
if (tfoot && tfoot.childElementCount === 0) {
this.renderer.removeChild(tfoot.parentNode, tfoot);
}
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Playwright test results

passed  240 passed

Details

stats  240 tests across 5 suites
duration  8 minutes, 32 seconds
commit  862459e
info  For details, download the Playwright report

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.

Add playwright a11y tests for the composition app Group accessibility test entries by component

2 participants