You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-157Lines changed: 3 additions & 157 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,160 +4,6 @@ A Testplane plugin that makes it easy to write [Testplane](https://github.com/ge
4
4
- Adds automatic screenshot tests for storybook stories;
5
5
- Adds an ability to write Testplane tests for storybook stories right inside of the stories.
6
6
7
-
## Installation
8
-
9
-
```bash
10
-
npm install @testplane/storybook --save-dev
11
-
```
12
-
13
-
## Usage
14
-
15
-
> ⚠️ Storybook 6.4+ is required to use this plugin.
16
-
17
-
### Storybook
18
-
19
-
If you use storybook@6, you will need to enable [buildStoriesJson](https://storybook.js.org/docs/6.4/configure/overview#feature-flags) feature in your `storybook` config:
20
-
21
-
```ts
22
-
// .storybook/main.js
23
-
exportdefault {
24
-
// ...
25
-
features: {
26
-
// ...
27
-
buildStoriesJson: true
28
-
}
29
-
}
30
-
```
31
-
32
-
You don't need to do this with storybook@7 or storybook@8.
33
-
34
-
### Testplane
35
-
36
-
Add `@testplane/storybook` plugin into your Testplane config:
37
-
38
-
```ts
39
-
// .testplane.conf.ts
40
-
exportdefault {
41
-
plugins: {
42
-
'@testplane/storybook': {},
43
-
44
-
// other Testplane plugins...
45
-
},
46
-
47
-
// other Testplane settings...
48
-
}
49
-
```
50
-
51
-
With this minimal config, you will be able to run `npx testplane --storybook` to autotest each storybook story with [Testplane assertView](https://github.com/gemini-testing/testplane#assertview) command. Testplane will open each story, wait for play function to finish (if defined), and then call `assertView` command. These tests would be generated in runtime.
| autoScreenshotStorybookGlobals | Record<string, Record<string, unknown>> | {} | Run multiple auto-screenshot tests with different [storybook globals](https://storybook.js.org/docs/7/essentials/toolbars-and-globals#globals). Only works with storybook >= 8 |
61
-
| localport | Number | 6006 | Port to launch storybook dev server on |
62
-
| remoteStorybookUrl | String | "" | URL of the remote Storybook. If specified, local storybook dev sever would not be launched |
63
-
| browserIds | Array<String \| RegExp> |[]| Array of `browserId` to run storybook tests on. By default, all of browsers, specified in Testplane config would be used |
64
-
65
-
> ⚠️ *Storybook tests performance greatly depends on [Testplane testsPerSession](https://github.com/gemini-testing/testplane#testspersession) parameter, as these tests speeds up on reusing existing sessions, so setting values around 20+ is preferred*
66
-
67
-
> ⚠️ *These tests ignore [Testplane isolation](https://github.com/gemini-testing/testplane#isolation). It would be turned off unconditionally*
68
-
69
-
#### autoScreenshotStorybookGlobals
70
-
71
-
For example, with `autoScreenshotStorybookGlobals` set to:
72
-
73
-
```json
74
-
{
75
-
"default": {},
76
-
"light theme": {
77
-
"theme": "light"
78
-
},
79
-
"dark theme": {
80
-
"theme": "dark"
81
-
}
82
-
}
83
-
```
84
-
85
-
3 autoscreenshot tests will be generated for each story, each test having its corresponding storybook globals value:
86
-
-`... Autoscreenshot default`
87
-
-`... Autoscreenshot light theme`
88
-
-`... Autoscreenshot dark theme`
89
-
90
-
## Advanced usage
91
-
92
-
If you have `ts-node` in your project, you can write your Testplane tests right inside of storybook story files:
0 commit comments