-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Hiroshiba <[email protected]> Co-authored-by: Hiroshiba <[email protected]> Co-authored-by: hiroshiba <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
ab0ac07
commit cb6c597
Showing
34 changed files
with
141 additions
and
39 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
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 |
---|---|---|
|
@@ -41,3 +41,6 @@ electron-builder.yml | |
|
||
# generated licenses.json | ||
/*licenses.json | ||
|
||
# Storybook | ||
storybook-static/ |
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
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// 起動中のStorybookで様々なStoryを表示し、スクリーンショットを撮って比較するVRT。 | ||
// テスト自体はend-to-endではないが、Playwrightを使う関係でe2eディレクトリ内でテストしている。 | ||
import { test, expect } from "@playwright/test"; | ||
import z from "zod"; | ||
|
||
// Storybook 8.3.5時点でのindex.jsonのスキーマ。 | ||
// もしスキーマが変わってテストが通らなくなった場合は、このスキーマを修正する。 | ||
const storybookIndexSchema = z.object({ | ||
v: z.literal(5), | ||
entries: z.record( | ||
z.object({ | ||
type: z.string(), | ||
id: z.string(), | ||
name: z.string(), | ||
title: z.string(), | ||
tags: z.array(z.string()), | ||
}), | ||
), | ||
}); | ||
type StorybookIndex = z.infer<typeof storybookIndexSchema>; | ||
type Story = StorybookIndex["entries"][string]; | ||
|
||
// テスト対象のStory一覧を取得する。 | ||
// play-fnが付いているStoryはUnit Test用Storyとみなしてスクリーンショットを撮らない | ||
const getStoriesToTest = (index: StorybookIndex) => | ||
Object.values(index.entries).filter( | ||
(entry) => entry.type === "story" && !entry.tags.includes("play-fn"), | ||
); | ||
|
||
let index: StorybookIndex; | ||
|
||
try { | ||
index = storybookIndexSchema.parse( | ||
await fetch("http://localhost:7357/index.json").then((res) => res.json()), | ||
); | ||
} catch (e) { | ||
throw new Error(`Storybookのindex.jsonの取得に失敗しました`, { | ||
cause: e, | ||
}); | ||
} | ||
|
||
const currentStories = getStoriesToTest(index); | ||
|
||
const allStories: Record<string, Story[]> = {}; | ||
for (const story of currentStories) { | ||
if (!allStories[story.title]) { | ||
allStories[story.title] = []; | ||
} | ||
allStories[story.title].push(story); | ||
} | ||
|
||
for (const [story, stories] of Object.entries(allStories)) { | ||
test.describe(story, () => { | ||
for (const story of stories) { | ||
test(story.name, async ({ page }) => { | ||
test.skip( | ||
process.platform !== "win32", | ||
"Windows以外のためスキップします", | ||
); | ||
|
||
await page.goto(`http://localhost:7357/iframe.html?id=${story.id}`); | ||
const body = page.locator("body.sb-show-main"); | ||
await body.waitFor({ state: "visible" }); | ||
await expect(page).toHaveScreenshot(`${story.id}.png`, { | ||
fullPage: true, | ||
}); | ||
}); | ||
} | ||
}); | ||
} |
Binary file added
BIN
+6.23 KB
...ンショット.spec.mts-snapshots/components-base-basebutton--danger-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.08 KB
...ショット.spec.mts-snapshots/components-base-basebutton--default-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.23 KB
...ショット.spec.mts-snapshots/components-base-basebutton--primary-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.7 KB
...ット.spec.mts-snapshots/components-base-basecheckbox--checked-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.26 KB
...ット.spec.mts-snapshots/components-base-basecheckbox--default-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.5 KB
...pec.mts-snapshots/components-base-basedocumentview--default-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.73 KB
...ット.spec.mts-snapshots/components-base-baselistitem--default-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.27 KB
...ト.spec.mts-snapshots/components-base-baselistitem--selected-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.5 KB
...c.mts-snapshots/components-base-basenavigationview--default-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.92 KB
...ト.spec.mts-snapshots/components-base-baserowcard--clickable-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.92 KB
...ョット.spec.mts-snapshots/components-base-baserowcard--default-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.3 KB
....spec.mts-snapshots/components-base-basescrollarea--default-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.83 KB
...ショット.spec.mts-snapshots/components-base-baseswitch--checked-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.67 KB
...ット.spec.mts-snapshots/components-base-baseswitch--unchecked-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.7 KB
...ト.spec.mts-snapshots/components-base-basetextfield--default-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.67 KB
....spec.mts-snapshots/components-base-basetextfield--disabled-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.71 KB
...spec.mts-snapshots/components-base-basetextfield--has-error-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.58 KB
...ec.mts-snapshots/components-base-basetextfield--placeholder-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.7 KB
...spec.mts-snapshots/components-base-basetextfield--read-only-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.68 KB
...pec.mts-snapshots/components-base-basetogglegroup--multiple-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.68 KB
....spec.mts-snapshots/components-base-basetogglegroup--single-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.23 KB
...ponents-dialog-settingdialog-filenametemplatedialog--closed-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.3 KB
...ponents-dialog-settingdialog-filenametemplatedialog--opened-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.23 KB
...napshots/components-dialog-updatenotificationdialog--closed-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.4 KB
...napshots/components-dialog-updatenotificationdialog--opened-storybook-win32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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