diff --git a/.github/workflows/a11y-test.yml b/.github/workflows/a11y-test.yml index f1f8b57f..c6f34d18 100644 --- a/.github/workflows/a11y-test.yml +++ b/.github/workflows/a11y-test.yml @@ -16,9 +16,9 @@ jobs: fetch-depth: 0 - name: Setup Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: - node-version: 20.x + node-version: 20 - name: Install pnpm uses: pnpm/action-setup@v3 diff --git a/packages/wow-ui/.storybook/test-runner.ts b/packages/wow-ui/.storybook/test-runner.ts index a5f755c7..fc12dcc4 100644 --- a/packages/wow-ui/.storybook/test-runner.ts +++ b/packages/wow-ui/.storybook/test-runner.ts @@ -6,27 +6,15 @@ import { injectAxe, checkA11y } from "axe-playwright"; * to learn more about the test-runner hooks API. */ const config: TestRunnerConfig = { - async prepare({ page, browserContext, testRunnerConfig }) { - page.setDefaultTimeout(120 * 1000); - - const targetURL = process.env.TARGET_URL; - const iframeURL = new URL("iframe.html", targetURL).toString(); - - if (testRunnerConfig.getHttpHeaders) { - const headers = await testRunnerConfig.getHttpHeaders(iframeURL); - await browserContext.setExtraHTTPHeaders(headers); - } - - await page.goto(iframeURL, { waitUntil: "load" }).catch((err) => { - if ( - err instanceof Error && - err.message.includes("ERR_CONNECTION_REFUSED") - ) { - const errorMessage = `Could not access the Storybook instance at ${targetURL}. Are you sure it's running?\n\n${err.message}`; - throw new Error(errorMessage); - } - - throw err; + async preVisit(page) { + await injectAxe(page); + }, + async postVisit(page) { + await checkA11y(page, "#storybook-root", { + detailedReport: true, + detailedReportOptions: { + html: true, + }, }); }, };