Skip to content

Commit

Permalink
feat: 스토리북 테스트 러너 세팅
Browse files Browse the repository at this point in the history
  • Loading branch information
ghdtjgus76 committed May 13, 2024
1 parent b5d79d9 commit e3343b6
Show file tree
Hide file tree
Showing 3 changed files with 1,662 additions and 25 deletions.
22 changes: 22 additions & 0 deletions packages/wow-ui/.storybook/test-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { TestRunnerConfig } from "@storybook/test-runner";
import { injectAxe, checkA11y } from "axe-playwright";

/*
* See https://storybook.js.org/docs/writing-tests/test-runner#test-hook-api
* to learn more about the test-runner hooks API.
*/
const config: TestRunnerConfig = {
async preVisit(page) {
await injectAxe(page);
},
async postVisit(page) {
await checkA11y(page, "#storybook-root", {
detailedReport: true,
detailedReportOptions: {
html: true,
},
});
},
};

export default config;
7 changes: 5 additions & 2 deletions packages/wow-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@
"keywords": [],
"license": "ISC",
"scripts": {
"build": "pnpm generate:build:config && rm -rf dist && rollup -c --bundleConfigAsCjs && panda cssgen --outfile dist/styles.css",
"build": "pnpm generate:build-config && rm -rf dist && rollup -c --bundleConfigAsCjs && panda cssgen --outfile dist/styles.css",
"lint": "eslint . --max-warnings 0",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"generate:build:config": "tsx ./src/scripts/generateBuildConfig.ts && prettier --write ./rollup.config.js ./package.json"
"generate:build-config": "tsx ./src/scripts/generateBuildConfig.ts && prettier --write ./rollup.config.js ./package.json",
"test-storybook": "test-storybook --watch --browsers firefox chromium webkit"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.3.3",
Expand All @@ -52,12 +53,14 @@
"@storybook/nextjs": "^7.5.3",
"@storybook/react": "^7.5.3",
"@storybook/test": "^7.6.3",
"@storybook/test-runner": "^0.18.0",
"@storybook/testing-library": "^0.2.2",
"@turbo/gen": "^1.12.4",
"@types/eslint": "^8.56.5",
"@types/node": "^20.11.24",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"axe-playwright": "^2.0.1",
"chromatic": "^11.3.0",
"eslint": "^8.57.0",
"eslint-plugin-storybook": "^0.6.15",
Expand Down
Loading

0 comments on commit e3343b6

Please sign in to comment.