-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6371ad5
commit ea46e33
Showing
4 changed files
with
1,478 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { TestRunnerConfig } from '@storybook/test-runner'; | ||
|
||
const config: TestRunnerConfig = { | ||
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(); | ||
}, | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import initStoryshots from "@storybook/addon-storyshots"; | ||
// import initStoryshots from "@storybook/addon-storyshots"; | ||
import "jest-styled-components"; | ||
|
||
initStoryshots({ | ||
asyncJest: true, | ||
test: async ({ story, done }) => { | ||
/* The default storyshot method renders components as if they | ||
were being rendered server-side. While this is good for many components, | ||
map-based components especially benefit from rendering as if they were | ||
being rendered by a client. This results in more detailed and useful | ||
snapshots. This method renders each story as if it were being rendered | ||
by a browser, although with react syntax. A server-based render is done | ||
below. */ | ||
const jsx = await story.render(); | ||
expect(jsx).toMatchSnapshot(); | ||
done(); | ||
} | ||
}); | ||
// initStoryshots({ | ||
// asyncJest: true, | ||
// test: async ({ story, done }) => { | ||
// /* The default storyshot method renders components as if they | ||
// were being rendered server-side. While this is good for many components, | ||
// map-based components especially benefit from rendering as if they were | ||
// being rendered by a client. This results in more detailed and useful | ||
// snapshots. This method renders each story as if it were being rendered | ||
// by a browser, although with react syntax. A server-based render is done | ||
// below. */ | ||
// const jsx = await story.render(); | ||
// expect(jsx).toMatchSnapshot(); | ||
// done(); | ||
// } | ||
// }); | ||
|
||
// Also test using the default render method as it catches some changes | ||
// the new method does not | ||
initStoryshots(); | ||
// initStoryshots(); |
Oops, something went wrong.