https://github.com/ericclemmons/storybook-har-addon
https://github.com/ericclemmons/storybook-har-addon
Last synced: 18 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ericclemmons/storybook-har-addon
- Owner: ericclemmons
- License: gpl-3.0
- Created: 2022-10-02T20:19:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-04T18:21:01.000Z (over 2 years ago)
- Last Synced: 2025-04-06T07:15:44.664Z (19 days ago)
- Size: 35.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Mock Storybook
Record & mock your stories with
[HAR][har] files.## Installation
```shell
pnpm add mock-storybook --dev
``````js
// .storybook/preview.js
export const loaders = withMocks({})([
...
])
```````
Then, in your story:
```js
Story.parameters = {
mock: {
har: require('./path/to.har'),
handlers: []
}
}
````## Local Workflow
1. Automate your story with a `.play()` function via [Interactions][interactions].
1. Capture a `.har` file:### Manually
See [How to get a HAR capture](https://toolbox.googleapps.com/apps/har_analyzer/)
### Automatically
1. Setup [`test-storybook`][test-storybook]
1. Run `test-storybook`
1. TODO – Automatically capture `.har` relative to story?[har]: https://en.wikipedia.org/wiki/HAR_(file_format)
[interactions]: https://storybook.js.org/addons/@storybook/addon-interactions
[test-storybook]: https://storybook.js.org/addons/@storybook/testing-react