From 387d23c50d739b11e155c1cfd30459b4a5df59a3 Mon Sep 17 00:00:00 2001 From: ghdtjgus76 Date: Fri, 17 May 2024 17:53:54 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EC=9B=B9=20=EC=A0=91=EA=B7=BC?= =?UTF-8?q?=EC=84=B1=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=9B=8C=ED=81=AC?= =?UTF-8?q?=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/a11y-test.yml | 4 +-- packages/wow-ui/.storybook/test-runner.ts | 30 +++++++---------------- 2 files changed, 11 insertions(+), 23 deletions(-) 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, + }, }); }, };