Skip to content

Commit f71e3d5

Browse files
Simon Bigelmayrclaude
andcommitted
test: add Storybook smoke tests for all 57 stories
- Add @storybook/test-runner with Playwright - Add test:storybook commands to package.json - Add test-storybook job to GitHub Actions workflow - Integrate Storybook tests into validate command - Fix Tooltip story missing required date prop - Fix Button import to bypass babel-plugin-import issue All 57 story suites now pass smoke tests (121 tests total) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent e973664 commit f71e3d5

File tree

5 files changed

+2576
-118
lines changed

5 files changed

+2576
-118
lines changed

.github/workflows/validate.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,22 @@ jobs:
6060
- run: corepack enable
6161
- run: yarn install
6262
- run: yarn run storybook:build
63+
64+
test-storybook:
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v5
68+
- uses: actions/setup-node@v6
69+
with:
70+
node-version: 22
71+
- run: corepack enable
72+
- run: yarn install
73+
- name: Install Playwright
74+
run: npx playwright install --with-deps chromium
75+
- name: Build Storybook
76+
run: yarn run storybook:build
77+
- name: Serve Storybook and run tests
78+
run: |
79+
npx http-server storybook-static --port 6006 --silent &
80+
npx wait-on tcp:6006
81+
yarn run test:storybook

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
"build:es": "rollup --config --bundleConfigAsCjs",
1616
"build:ts": "tsc --declaration --declarationDir types --emitDeclarationOnly",
1717
"build": "yarn run build:clean && yarn run build:es && yarn run build:ts",
18-
"validate": "yarn run lint && yarn run typecheck && yarn run test",
18+
"validate": "yarn run lint && yarn run typecheck && yarn run test && yarn run test:storybook",
1919
"test": "jest",
2020
"test:watch": "jest --watch",
21+
"test:storybook": "test-storybook",
2122
"storybook": "storybook dev --port=6006",
2223
"storybook:build": "storybook build --quiet",
2324
"typecheck": "tsc --noEmit",
@@ -83,6 +84,7 @@
8384
"@storybook/addon-docs": "^10.0.5",
8485
"@storybook/addon-webpack5-compiler-babel": "^3.0.6",
8586
"@storybook/react-webpack5": "^10.0.5",
87+
"@storybook/test-runner": "^0.24.1",
8688
"@testing-library/dom": "^9.3.3",
8789
"@testing-library/jest-dom": "^6.6.4",
8890
"@testing-library/react": "^14.1.2",
@@ -98,6 +100,7 @@
98100
"babel-loader": "^9.1.3",
99101
"babel-plugin-import": "^1.13.8",
100102
"babel-plugin-styled-components": "^2.1.4",
103+
"concurrently": "^9.2.1",
101104
"eslint": "^8.54.0",
102105
"eslint-config-airbnb": "^19.0.4",
103106
"eslint-plugin-import": "^2.29.0",
@@ -111,6 +114,7 @@
111114
"jest-environment-jsdom": "^30.2.0",
112115
"less": "^4.2.0",
113116
"less-loader": "^11.1.3",
117+
"playwright": "^1.56.1",
114118
"prettier": "^3.1.0",
115119
"react": "^18.2.0",
116120
"react-dom": "^18.2.0",
@@ -130,6 +134,7 @@
130134
"ts-loader": "^9.5.1",
131135
"ts-node": "^10.9.1",
132136
"typescript": "^5.3.2",
137+
"wait-on": "^9.0.3",
133138
"webpack": "^5.97.0"
134139
},
135140
"packageManager": "[email protected]"

src/Button/ColoredButtons.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Button as AntdButton, ButtonProps as AntdButtonProps } from 'antd';
1+
import AntdButton from 'antd/es/button';
2+
import type { ButtonProps as AntdButtonProps } from 'antd/es/button';
23
import ButtonGroup from 'antd/es/button/button-group';
34
import * as React from 'react';
45
import styled from 'styled-components';

src/Tooltip/index.stories.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export const TooltipForDate: StoryFn<DateWithTooltipProps> =
3030
return <DateWithTooltip {...args} />;
3131
};
3232

33+
TooltipForDate.args = {
34+
date: new Date('2024-01-15T10:30:00'),
35+
};
36+
3337
export const TooltipForTrimmedText: StoryFn<TextWithTooltipIfTrimmedProps> =
3438
function TooltipForTrimmedText(args) {
3539
return <TextWithTooltipIfTrimmed {...args} />;

0 commit comments

Comments
 (0)