Testing Framwork #17

Merged
an.di merged 83 commits from adilallo/enhancement/TestingFramework2 into main 2025-09-03 18:50:40 +00:00
2 changed files with 10 additions and 8 deletions
Showing only changes of commit afdf7ce595 - Show all commits
+1 -1
View File
@@ -1,5 +1,5 @@
import { test, expect } from "@playwright/test"; import { test, expect } from "@playwright/test";
import { injectAxe, checkA11y } from "@axe-core/playwright"; import { AxeBuilder } from "@axe-core/playwright";
test.describe("Accessibility Testing", () => { test.describe("Accessibility Testing", () => {
test.beforeEach(async ({ page }) => { 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 = {}) { export async function runA11y(page, options = {}) {
await injectAxe(page); const results = await new AxeBuilder({ page })
await checkA11y(page, undefined, { .withTags(['wcag2a', 'wcag2aa'])
detailedReport: true, .analyze();
detailedReportOptions: { html: true },
...options, if (results.violations.length > 0) {
}); console.log('Accessibility violations found:', results.violations);
throw new Error(`Found ${results.violations.length} accessibility violations`);
}
} }