diff --git a/frontend/test/playwright/utils/breakpoints.ts b/frontend/test/playwright/utils/breakpoints.ts index bcec6fc6e71..3234c9412fa 100644 --- a/frontend/test/playwright/utils/breakpoints.ts +++ b/frontend/test/playwright/utils/breakpoints.ts @@ -1,26 +1,15 @@ -import { test, Expect, Page, Locator } from "@playwright/test" +import { test } from "@playwright/test" import type { LanguageDirection } from "~~/test/playwright/utils/i18n" -import { expectSnapshot as innerExpectSnapshot } from "~~/test/playwright/utils/expect-snapshot" +import { + type ExpectSnapshot, + expectSnapshot as innerExpectSnapshot, +} from "~~/test/playwright/utils/expect-snapshot" import { VIEWPORTS } from "~/constants/screens" import type { Breakpoint } from "~/constants/screens" -type ScreenshotAble = Page | Locator - -type ExpectSnapshot = ( - page: Page, - name: string, - s: T, - config?: { - dir?: LanguageDirection - options?: Parameters[0] - snapshotOptions?: Parameters["toMatchSnapshot"]>[0] - useColorMode?: boolean - } -) => Promise - type BreakpointBlock = (options: { breakpoint: Breakpoint expectSnapshot: ExpectSnapshot @@ -95,11 +84,11 @@ const makeBreakpointDescribe = return `${name}${dirString}-${breakpoint}` as const } - const expectSnapshot = async ( - page: Page, - name: string, - screenshotAble: T, - options: Parameters[3] = {} + const expectSnapshot: ExpectSnapshot = async ( + page, + name, + screenshotAble, + options = {} ) => { const snapshotName = getSnapshotName(name, options.dir) return innerExpectSnapshot(page, snapshotName, screenshotAble, options) diff --git a/frontend/test/playwright/visual-regression/pages/errors.spec.ts b/frontend/test/playwright/visual-regression/pages/errors.spec.ts index 98666da72e8..d62bc04185b 100644 --- a/frontend/test/playwright/visual-regression/pages/errors.spec.ts +++ b/frontend/test/playwright/visual-regression/pages/errors.spec.ts @@ -34,7 +34,7 @@ breakpoints.describeXl(({ breakpoint, expectSnapshot }) => { // eslint-disable-next-line playwright/no-networkidle await page.waitForLoadState("networkidle") await expectSnapshot(page, "generic-error-ltr", page, { - options: { fullPage: true }, + screenshotOptions: { fullPage: true }, }) }) } @@ -60,7 +60,7 @@ breakpoints.describeXl(({ breakpoint, expectSnapshot }) => { await page.waitForLoadState("networkidle") await expectSnapshot(page, "generic-error-ltr", page, { - options: { fullPage: true }, + screenshotOptions: { fullPage: true }, }) }) } @@ -81,7 +81,7 @@ for (const searchType of supportedSearchTypes) { await goToSearchTerm(page, `SearchPage500error`, { searchType }) await expectSnapshot(page, "generic-error-ltr", page, { - options: { fullPage: true }, + screenshotOptions: { fullPage: true }, }) }) }) @@ -106,7 +106,7 @@ for (const searchType of supportedSearchTypes) { await expectSnapshot(page, "generic-error", page, { dir, - options: { + screenshotOptions: { fullPage: true, }, }) diff --git a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts index 2507df1485c..94555efd4b6 100644 --- a/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts +++ b/frontend/test/playwright/visual-regression/pages/pages-single-result.spec.ts @@ -47,7 +47,7 @@ for (const mediaType of supportedMediaTypes) { page, { dir, - options: { fullPage: true }, + screenshotOptions: { fullPage: true }, snapshotOptions: { maxDiffPixelRatio: 0.01 }, } ) @@ -70,7 +70,7 @@ for (const dir of languageDirections) { await sleep(500) await expectSnapshot(page, "full-page-report", page, { dir, - options: { fullPage: true }, + screenshotOptions: { fullPage: true }, snapshotOptions: { maxDiffPixelRatio: undefined, maxDiffPixels: 2 }, }) }) diff --git a/frontend/test/playwright/visual-regression/pages/pages.spec.ts b/frontend/test/playwright/visual-regression/pages/pages.spec.ts index 9db2bfa4dca..50a13f248e3 100644 --- a/frontend/test/playwright/visual-regression/pages/pages.spec.ts +++ b/frontend/test/playwright/visual-regression/pages/pages.spec.ts @@ -40,8 +40,8 @@ for (const contentPage of contentPages) { await page.mouse.move(150, 150) await expectSnapshot(page, contentPage, page, { dir, - options: { fullPage: true }, - snapshotOptions: { maxDiffPixelRatio: 0.005 }, + screenshotOptions: { fullPage: true }, + snapshotOptions: { maxDiffPixelRatio: 0.01 }, }) }) }) diff --git a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-ltr-md-light-linux.png b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-ltr-md-light-linux.png index 035e0229c7e..57bd75d75b8 100644 Binary files a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-ltr-md-light-linux.png and b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-ltr-md-light-linux.png differ diff --git a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-ltr-xs-light-linux.png b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-ltr-xs-light-linux.png index 78c3c4f8c4d..f1ad166e4d6 100644 Binary files a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-ltr-xs-light-linux.png and b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-ltr-xs-light-linux.png differ diff --git a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-2xl-light-linux.png b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-2xl-light-linux.png index 0b0af74409c..7100302883e 100644 Binary files a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-2xl-light-linux.png and b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-2xl-light-linux.png differ diff --git a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-lg-light-linux.png b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-lg-light-linux.png index 7e94a88e2f3..1b2616bee80 100644 Binary files a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-lg-light-linux.png and b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-lg-light-linux.png differ diff --git a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-md-light-linux.png b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-md-light-linux.png index 06ff84c7deb..ed1a7366c71 100644 Binary files a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-md-light-linux.png and b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-md-light-linux.png differ diff --git a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-sm-light-linux.png b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-sm-light-linux.png index d1341443a34..1f8affacc4f 100644 Binary files a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-sm-light-linux.png and b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-sm-light-linux.png differ diff --git a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-xl-light-linux.png b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-xl-light-linux.png index 56c7e575b68..3c7421c94e7 100644 Binary files a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-xl-light-linux.png and b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-xl-light-linux.png differ diff --git a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-xs-light-linux.png b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-xs-light-linux.png index 91f89469449..b3c16cfd210 100644 Binary files a/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-xs-light-linux.png and b/frontend/test/storybook/visual-regression/v-collection-header.spec.ts-snapshots/VCollectionHeaders-rtl-xs-light-linux.png differ