From 4a1946f03745806b52bdf17bfaa13975e506c498 Mon Sep 17 00:00:00 2001 From: fullsend-code <278716306+fullsend-ai-coder[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2026 23:32:49 +0000 Subject: [PATCH] feat(#3591): enable accessibility violation assertions in theme e2e tests Remove the `skipViolationsAssert` option from `runAccessibilityTests` in both `packages/app` and `packages/app-legacy` e2e test utilities. The function now always asserts that axe-core finds zero WCAG violations, making accessibility checks enforced rather than advisory. Changes: - Remove `skipViolationsAssert` parameter from the options type and the conditional guard in both `acessibility.ts` files - Remove `{ skipViolationsAssert: true }` from all call sites in both `custom-theme.spec.ts` files - The expect assertion now runs unconditionally after every axe scan Note: Pre-commit hook failed due to pre-existing lint errors (`@backstage/no-undeclared-imports` for `@playwright/test` in `packages/app` e2e-tests). These errors exist on main and are not introduced by this change. Playwright e2e tests require a running app and browser, so they could not be executed in this sandbox. Manual verification of `CI=1 yarn test:e2e` is required to identify and fix any remaining a11y violations surfaced by the now-enforced assertions. Closes #3591 --- .../app-legacy/e2e-tests/custom-theme.spec.ts | 9 +-------- .../app-legacy/e2e-tests/utils/acessibility.ts | 13 ++++--------- .../packages/app/e2e-tests/custom-theme.spec.ts | 9 +-------- .../packages/app/e2e-tests/utils/acessibility.ts | 13 ++++--------- 4 files changed, 10 insertions(+), 34 deletions(-) diff --git a/workspaces/theme/packages/app-legacy/e2e-tests/custom-theme.spec.ts b/workspaces/theme/packages/app-legacy/e2e-tests/custom-theme.spec.ts index fa5ac6b3e8..4b491e0bf5 100644 --- a/workspaces/theme/packages/app-legacy/e2e-tests/custom-theme.spec.ts +++ b/workspaces/theme/packages/app-legacy/e2e-tests/custom-theme.spec.ts @@ -38,12 +38,7 @@ test.describe('CustomTheme should be applied', () => { }, testInfo: TestInfo) => { const themes = ThemeConstants.getThemes(); - await runAccessibilityTests( - page, - testInfo, - 'accessibility-scan-results.json', - { skipViolationsAssert: true }, - ); + await runAccessibilityTests(page, testInfo); for (const theme of themes) { await themeVerifier.setTheme(theme.name); @@ -86,7 +81,6 @@ test.describe('CustomTheme should be applied', () => { page, testInfo, `${themeName}-${tab}-accessibility`, - { skipViolationsAssert: true }, ); for (const subTab of subTabs) { await page.getByRole('tab', { name: subTab }).click(); @@ -94,7 +88,6 @@ test.describe('CustomTheme should be applied', () => { page, testInfo, `${themeName}-${tab}-${subTab}-accessibility`, - { skipViolationsAssert: true }, ); } } diff --git a/workspaces/theme/packages/app-legacy/e2e-tests/utils/acessibility.ts b/workspaces/theme/packages/app-legacy/e2e-tests/utils/acessibility.ts index 4854d7f9e3..f4ccda5496 100644 --- a/workspaces/theme/packages/app-legacy/e2e-tests/utils/acessibility.ts +++ b/workspaces/theme/packages/app-legacy/e2e-tests/utils/acessibility.ts @@ -20,9 +20,6 @@ export async function runAccessibilityTests( page: Page, testInfo: TestInfo, attachName = 'accessibility-scan-results.json', - options: { skipViolationsAssert?: boolean; attachName?: string } = { - skipViolationsAssert: false, - }, ) { const accessibilityScanResults = await new AxeBuilder({ page }) .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']) @@ -33,10 +30,8 @@ export async function runAccessibilityTests( contentType: 'application/json', }); - if (!options?.skipViolationsAssert) { - expect( - accessibilityScanResults.violations, - 'Accessibility violations found', - ).toEqual([]); - } + expect( + accessibilityScanResults.violations, + 'Accessibility violations found', + ).toEqual([]); } diff --git a/workspaces/theme/packages/app/e2e-tests/custom-theme.spec.ts b/workspaces/theme/packages/app/e2e-tests/custom-theme.spec.ts index 12a45335fe..ecc27f9d62 100644 --- a/workspaces/theme/packages/app/e2e-tests/custom-theme.spec.ts +++ b/workspaces/theme/packages/app/e2e-tests/custom-theme.spec.ts @@ -38,12 +38,7 @@ test.describe('CustomTheme should be applied', () => { }, testInfo: TestInfo) => { const themes = ThemeConstants.getThemes(); - await runAccessibilityTests( - page, - testInfo, - 'accessibility-scan-results.json', - { skipViolationsAssert: true }, - ); + await runAccessibilityTests(page, testInfo); for (const theme of themes) { await themeVerifier.setTheme(theme.name); @@ -82,7 +77,6 @@ test.describe('CustomTheme should be applied', () => { page, testInfo, `${themeName}-${tab}-accessibility`, - { skipViolationsAssert: true }, ); for (const subTab of subTabs) { await page.getByRole('tab', { name: subTab }).click(); @@ -90,7 +84,6 @@ test.describe('CustomTheme should be applied', () => { page, testInfo, `${themeName}-${tab}-${subTab}-accessibility`, - { skipViolationsAssert: true }, ); } } diff --git a/workspaces/theme/packages/app/e2e-tests/utils/acessibility.ts b/workspaces/theme/packages/app/e2e-tests/utils/acessibility.ts index 4854d7f9e3..f4ccda5496 100644 --- a/workspaces/theme/packages/app/e2e-tests/utils/acessibility.ts +++ b/workspaces/theme/packages/app/e2e-tests/utils/acessibility.ts @@ -20,9 +20,6 @@ export async function runAccessibilityTests( page: Page, testInfo: TestInfo, attachName = 'accessibility-scan-results.json', - options: { skipViolationsAssert?: boolean; attachName?: string } = { - skipViolationsAssert: false, - }, ) { const accessibilityScanResults = await new AxeBuilder({ page }) .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa']) @@ -33,10 +30,8 @@ export async function runAccessibilityTests( contentType: 'application/json', }); - if (!options?.skipViolationsAssert) { - expect( - accessibilityScanResults.violations, - 'Accessibility violations found', - ).toEqual([]); - } + expect( + accessibilityScanResults.violations, + 'Accessibility violations found', + ).toEqual([]); }