Skip to content

Commit

Permalink
Rename all snapshots to "-light"
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Sep 12, 2024
1 parent bb6b148 commit f120c95
Show file tree
Hide file tree
Showing 562 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions frontend/test/playwright/utils/breakpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type ExpectSnapshot = <T extends ScreenshotAble>(

type BreakpointBlock = (options: {
getConfigValues: (name: string) => {
name: `${typeof name}-${Breakpoint}.png`
name: `${typeof name}-${Breakpoint}-light.png`
}
breakpoint: Breakpoint
expectSnapshot: ExpectSnapshot
Expand Down Expand Up @@ -88,7 +88,7 @@ const makeBreakpointDescribe =
})

const getConfigValues = (name: string) => ({
name: `${name}-${breakpoint}.png` as const,
name: `${name}-${breakpoint}-light.png` as const,
})

const expectSnapshot = async <T extends ScreenshotAble>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test.describe("content report form", () => {

await button.click()

await expectSnapshot("content-report", page, undefined, {
await expectSnapshot("content-report-ltr", page, undefined, {
maxDiffPixelRatio: 0.1,
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ for (const dir of languageDirections) {
// To make the tests consistent, set the played area to the same position
await page.mouse.click(170, 650)

await expectSnapshot(`global-audio-player-on-search-${dir}.png`, page)
await expectSnapshot(`global-audio-player-on-search-${dir}`, page)
})
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test.describe.configure({ mode: "parallel" })
const headerSelector = ".main-header"

for (const dir of languageDirections) {
test.describe(`header-${dir}`, () => {
test.describe(dir, () => {
breakpoints.describeEvery(({ breakpoint, expectSnapshot }) => {
test.beforeEach(async ({ page }) => {
await preparePageForTests(page, breakpoint, { dismissFilter: false })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ test.describe("layout color is set correctly", () => {
await page.waitForURL(/ar\/search/)
await expect(getH1(page, "Cat")).toBeVisible()

expect(await page.screenshot()).toMatchSnapshot("search-page-rtl-lg.png")
expect(await page.screenshot()).toMatchSnapshot(
"search-page-rtl-lg-light.png"
)
})

test("change language on homepage and go to content page", async ({
Expand All @@ -97,7 +99,7 @@ test.describe("layout color is set correctly", () => {
await page.mouse.move(100, 100)

expect(await page.screenshot({ fullPage: true })).toMatchSnapshot(
"about-ltr-lg.png",
"about-ltr-lg-light.png",
{ maxDiffPixelRatio: 0.01 }
)
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/test/storybook/utils/expect-snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const expectSnapshot = async (
locator: Locator | Page,
options?: ExpectSnapshotOptions
) => {
const snapshotName = `${name}.png`
const snapshotName = `${name}-light.png`
return expect(
await locator.screenshot(options?.screenshotOptions)
).toMatchSnapshot(snapshotName, options?.snapshotOptions)
Expand Down
Diff not rendered.
Loading

0 comments on commit f120c95

Please sign in to comment.