Skip to content

Commit

Permalink
test(e2e): add colorscheme tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Stéphane authored and stephane-r committed Dec 8, 2023
1 parent ec0adf3 commit fb2a27d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions e2e/colorScheme.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { expect, test } from "@playwright/test";

test("colorscheme interface", async ({ page }) => {
await page.goto("localhost:3000");

await expect(
page.locator("html[data-mantine-color-scheme=light]"),
).toBeVisible();

await page.getByRole("button", { name: "Toggle color scheme" }).click();

await expect(
page.locator("html[data-mantine-color-scheme=light]"),
).not.toBeVisible();
await expect(
page.locator("html[data-mantine-color-scheme=dark]"),
).toBeVisible();

await expect(page).toHaveScreenshot();
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/ColorScheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const ColorScheme = memo(() => {
style={{ height: 36, width: 36 }}
onClick={() => toggleColorScheme()}
title="Toggle color scheme"
aria-label="Toggle color scheme"
>
{colorScheme === "dark" ? (
<IconSun size={18} />
Expand Down

0 comments on commit fb2a27d

Please sign in to comment.