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 b6fa7b9 commit 1b312d1
Show file tree
Hide file tree
Showing 262 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions frontend/test/playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const pwCommand = process.env.FASTSTART !== "false" ? "dev" : "prod:playwright"

const config: PlaywrightTestConfig = {
forbidOnly: !!process.env.CI,
snapshotPathTemplate:
"{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}",
webServer: {
command: `pnpm exec npm-run-all -p -r talkback ${pwCommand}`,
timeout: process.env.CI ? 60_000 * 5 : 60_000 * 10, // 5 minutes in CI, 10 in other envs
Expand Down
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 @@ -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

0 comments on commit 1b312d1

Please sign in to comment.