Skip to content

Commit

Permalink
chore: 웹 접근성 테스트 워크플로우 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ghdtjgus76 committed May 17, 2024
1 parent b1bf1f8 commit 387d23c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/a11y-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 9 additions & 21 deletions packages/wow-ui/.storybook/test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});
},
};
Expand Down

0 comments on commit 387d23c

Please sign in to comment.