Fix axe-core imports: Use AxeBuilder API for newer version
CI Pipeline / canary (pull_request) Successful in 0s
CI Pipeline / test (20) (pull_request) Successful in 2m7s
CI Pipeline / test (18) (pull_request) Successful in 2m9s
CI Pipeline / e2e (webkit) (pull_request) Has been cancelled
CI Pipeline / visual-regression (pull_request) Has been cancelled
CI Pipeline / performance (pull_request) Has been cancelled
CI Pipeline / storybook (pull_request) Has been cancelled
CI Pipeline / lint (pull_request) Has been cancelled
CI Pipeline / build (pull_request) Has been cancelled
CI Pipeline / e2e (firefox) (pull_request) Has been cancelled
CI Pipeline / e2e (chromium) (pull_request) Has been cancelled

This commit is contained in:
adilallo
2025-08-29 22:35:22 -06:00
parent e44d7c1b92
commit afdf7ce595
2 changed files with 10 additions and 8 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from "@playwright/test";
import { injectAxe, checkA11y } from "@axe-core/playwright";
import { AxeBuilder } from "@axe-core/playwright";
test.describe("Accessibility Testing", () => {
test.beforeEach(async ({ page }) => {
+9 -7
View File
@@ -1,10 +1,12 @@
import { injectAxe, checkA11y } from "@axe-core/playwright";
import { AxeBuilder } from "@axe-core/playwright";
export async function runA11y(page, options = {}) {
await injectAxe(page);
await checkA11y(page, undefined, {
detailedReport: true,
detailedReportOptions: { html: true },
...options,
});
const results = await new AxeBuilder({ page })
.withTags(['wcag2a', 'wcag2aa'])
.analyze();
if (results.violations.length > 0) {
console.log('Accessibility violations found:', results.violations);
throw new Error(`Found ${results.violations.length} accessibility violations`);
}
}