Skip to content

Commit

Permalink
Lower maxDiffPixelRatio in Storybook (#4919)
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat authored Sep 20, 2024
1 parent 262a440 commit 0ad26ae
Show file tree
Hide file tree
Showing 39 changed files with 43 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const meta = {

parameters: {
height: "480px",
viewport: {
defaultViewport: "sm",
},
},

argTypes: {
Expand All @@ -29,7 +32,15 @@ export const Default = {
render: (args) => ({
components: { VSearchTypes },
setup() {
return () => h(VSearchTypes, args)
return () =>
h(
"div",
{
style: args.size === "small" ? "width: max-content;" : "",
class: "wrapper p-2",
},
[h(VSearchTypes, args)]
)
},
}),
name: "Default",
Expand Down
2 changes: 1 addition & 1 deletion frontend/test/storybook/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default defineConfig({
expect: {
toMatchSnapshot: {
// To avoid flaky tests, we allow a small amount of pixel difference.
maxDiffPixelRatio: 0.01,
maxDiffPixelRatio: 0.003,
},
},
})
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 30 additions & 6 deletions frontend/test/storybook/visual-regression/v-search-types.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,29 @@ test.describe("VSearchTypes", () => {
await expect(page.getByRole("radio").nth(0)).toBeEnabled()
})
test("medium resting", async ({ page }) => {
await expectSnapshot(page, "v-search-types-medium-at-rest", page)
await expectSnapshot(
page,
"v-search-types-medium-at-rest",
page.locator(".wrapper")
)
})

test("medium images hovered", async ({ page }) => {
await page.hover(audioButtonLocator)
await expectSnapshot(page, "v-search-types-medium-images-hovered", page)
await expectSnapshot(
page,
"v-search-types-medium-images-hovered",
page.locator(".wrapper")
)
})

test("medium focused", async ({ page }) => {
await page.keyboard.press("Tab")
await expectSnapshot(page, "v-search-types-medium-focused", page)
await expectSnapshot(
page,
"v-search-types-medium-focused",
page.locator(".wrapper")
)
})
})

Expand All @@ -39,17 +51,29 @@ test.describe("VSearchTypes", () => {
})

test("small resting", async ({ page }) => {
await expectSnapshot(page, "v-search-types-small-at-rest", page)
await expectSnapshot(
page,
"v-search-types-small-at-rest",
page.locator(".wrapper")
)
})

test("small images hovered", async ({ page }) => {
await page.hover(audioButtonLocator)
await expectSnapshot(page, "v-search-types-small-images-hovered", page)
await expectSnapshot(
page,
"v-search-types-small-images-hovered",
page.locator(".wrapper")
)
})

test("small focused", async ({ page }) => {
await page.keyboard.press("Tab")
await expectSnapshot(page, "v-search-types-small-focused", page)
await expectSnapshot(
page,
"v-search-types-small-focused",
page.locator(".wrapper")
)
})
})
})

0 comments on commit 0ad26ae

Please sign in to comment.