Skip to content

Commit b768be0

Browse files
authored
test: add Storybook smoke tests for all 57 stories (#317)
1 parent f80dc3f commit b768be0

File tree

8 files changed

+2437
-160
lines changed

8 files changed

+2437
-160
lines changed

.github/workflows/format.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: "Format"
2+
23
on:
34
push:
45

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: "Release"
2+
23
on:
34
push:
45
branches:

.github/workflows/show.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: "Show"
2+
23
on:
34
push:
45
branches:

.github/workflows/validate.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: "Validate"
2+
23
on:
34
pull_request:
45
push:
@@ -59,4 +60,9 @@ jobs:
5960
node-version: 22
6061
- run: corepack enable
6162
- run: yarn install
63+
- run: npx playwright install --with-deps chromium
6264
- run: yarn run storybook:build
65+
- run: |
66+
npx http-server storybook-static --port 6006 --silent &
67+
npx wait-on tcp:6006
68+
yarn run test:storybook

package.json

Lines changed: 6 additions & 2 deletions
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",
@@ -111,6 +113,7 @@
111113
"jest-environment-jsdom": "^30.2.0",
112114
"less": "^4.2.0",
113115
"less-loader": "^11.1.3",
116+
"playwright": "^1.56.1",
114117
"prettier": "^3.1.0",
115118
"react": "^18.2.0",
116119
"react-dom": "^18.2.0",
@@ -130,7 +133,8 @@
130133
"ts-loader": "^9.5.1",
131134
"ts-node": "^10.9.1",
132135
"typescript": "^5.3.2",
136+
"wait-on": "^9.0.3",
133137
"webpack": "^5.97.0"
134138
},
135-
"packageManager": "yarn@4.10.3"
139+
"packageManager": "yarn@4.12.0"
136140
}

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)