Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 6.5k
test(snapshot): Migrate snapshot tests to storybook#5340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
bd8a46e80039d3cdbc4b4df79868ecbec61a2a4bd867999b648d6c916ce6923f9d9765931178506ce22b386a4580240b9bffa9a3e390c2dae121b83d7a154d620f58e79b5134bb46dfebfcabb9f6dc39f2eba81986b60f31f4530eb8c76cd5891807ca8b5abc2aeeaa86057dc17b698ff989ea9f49c166154890bbd24994763aebef5fed8db26e02a14e6377d27d83a364c3030d94653002a09e7a87dfcbc5b875eca949ceab76fbc0637d2d421b0beeba5b02b1d7e4920ada2917ddb2e175feb89a2be2016a348aa1c54271e3667d5fbf517ddfa8dd6c8b08e4f9a9278fdf4732b1c3bcca533fead6a7c9db2dcd709a59bFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // TODO: Convert this to ESM once the bug is resolved | ||
| // https://github.com/storybookjs/test-runner/issues/293 | ||
| const config = { | ||
| async postRender(page, _context) { | ||
| const rootElementId = '[data-test-id="story-root"]'; | ||
| const rootElement = await page.locator(rootElementId); | ||
| const content = await rootElement.innerHTML(); | ||
| expect(content).toBeDefined(); | ||
| expect(content).toMatchSnapshot(); | ||
| }, | ||
| }; | ||
| module.exports = config; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
| exports[`Api/DataTag Blue smoke-test 1`] = ` | ||
| <span class="DataTag_dataTag__xyqF4" | ||
| data-tag="M" | ||
| > | ||
| M | ||
| </span> | ||
| `; | ||
| exports[`Api/DataTag Red smoke-test 1`] = ` | ||
| <span class="DataTag_dataTag__xyqF4" | ||
| data-tag="E" | ||
| > | ||
| E | ||
| </span> | ||
| `; | ||
| exports[`Api/DataTag Yellow smoke-test 1`] = ` | ||
| <span class="DataTag_dataTag__xyqF4" | ||
| data-tag="C" | ||
| > | ||
| C | ||
| </span> | ||
| `; |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
| exports[`Article/Alert Default smoke-test 1`] = ` | ||
| <div class="Alert_alert__qjYPQ"> | ||
| This is an alert | ||
| </div> | ||
| `; |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
| exports[`Article/AuthorList/Author Default smoke-test 1`] = ` | ||
| <li> | ||
| <a class="Author_link__6oI83" | ||
| href="https://github.com/nodejs" | ||
| aria-label="nodejs Github - opens in new tab" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| <img alt="nodejs" | ||
| loading="lazy" | ||
| width="60" | ||
| height="60" | ||
| decoding="async" | ||
| data-nimg="1" | ||
| srcset="https://github.com/nodejs.png?size=60?w=64&q=75 1x, https://github.com/nodejs.png?size=60?w=128&q=75 2x" | ||
| src="https://github.com/nodejs.png?size=60?w=128&q=75" | ||
| style="color: transparent; background-size: cover; background-position: 50% 50%; background-repeat: no-repeat; background-image: url("/placeholder-img.png");" | ||
| > | ||
| </a> | ||
| </li> | ||
| `; | ||
| exports[`Article/AuthorList/Author WithourUsername smoke-test 1`] = ` | ||
| <li> | ||
| <a class="Author_link__6oI83" | ||
| href="https://github.com/" | ||
| aria-label=" Github - opens in new tab" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| <img alt | ||
| loading="lazy" | ||
| width="0" | ||
| height="0" | ||
| decoding="async" | ||
| data-nimg="1" | ||
| srcset="https://github.com/.png?size=0?w=16&q=75 1x" | ||
| src="https://github.com/.png?size=0?w=16&q=75" | ||
| style="color: transparent; background-size: cover; background-position: 50% 50%; background-repeat: no-repeat; background-image: url("/placeholder-img.png");" | ||
| > | ||
| </a> | ||
| </li> | ||
| `; |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import Author from './index'; | ||
| import type { Meta as MetaObj, StoryObj } from '@storybook/react'; | ||
| type Story = StoryObj<typeof Author>; | ||
| type Meta = MetaObj<typeof Author>; | ||
| export const Default: Story = { | ||
| args: { | ||
| username: 'nodejs', | ||
| size: 60, | ||
| }, | ||
| }; | ||
| export const WithourUsername: Story = { | ||
| args: { | ||
| username: '', | ||
| size: 0, | ||
| }, | ||
| }; | ||
| export default { component: Author } as Meta; |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.