storybook/docs/snippets/common/test-runner-dom-snapshot-testing.js.mdx
2023-11-22 21:41:43 +00:00

13 lines
351 B
Plaintext

```js
// .storybook/test-runner.js
module.exports = {
async postVisit(page, context) {
// the #storybook-root element wraps the story. In Storybook 6.x, the selector is #root
const elementHandler = await page.$('#storybook-root');
const innerHTML = await elementHandler.innerHTML();
expect(innerHTML).toMatchSnapshot();
},
};
```