Skip to content

Commit

Permalink
Add 2xl dark mode snapshots to breakpoint tests
Browse files Browse the repository at this point in the history
  • Loading branch information
obulat committed Sep 20, 2024
1 parent bd3e47f commit 7f6cd1d
Show file tree
Hide file tree
Showing 37 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion frontend/test/playwright/utils/breakpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ const makeBreakpointDescribe =
options = {}
) => {
const snapshotName = getSnapshotName(name, options.dir)
return innerExpectSnapshot(page, snapshotName, screenshotAble, options)
return innerExpectSnapshot(page, snapshotName, screenshotAble, {
...options,
useColorMode: snapshotName.includes("-2xl"),
})
}

_block({ breakpoint, expectSnapshot })
Expand Down
9 changes: 6 additions & 3 deletions frontend/test/playwright/utils/expect-snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { expect } from "@playwright/test"

import { type LanguageDirection, t } from "~~/test/playwright/utils/i18n"

import { sleep } from "~~/test/playwright/utils/navigation"

import type { Breakpoint } from "~/constants/screens"

import type {
Expand Down Expand Up @@ -80,9 +82,7 @@ export const expectSnapshot: ExpectSnapshot = async (
// Hide the theme switcher before taking the screenshot.
screenshotOptions = {
...(screenshotOptions ?? {}),
style: `#storybook-theme-switcher {
visibility: hidden;
}`,
style: `#storybook-theme-switcher { visibility: hidden; }`,
}

expect
Expand All @@ -94,6 +94,9 @@ export const expectSnapshot: ExpectSnapshot = async (
}
await turnOnDarkMode(page, dir ?? "ltr")

// Wait for the theme to change.
await sleep(100)

expect(await screenshotAble.screenshot(screenshotOptions)).toMatchSnapshot(
getSnapshotName(name, "dark"),
snapshotOptions
Expand Down
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.

0 comments on commit 7f6cd1d

Please sign in to comment.