The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { expect } from "e2e"; |
| 2 | |
| 3 | import { test, WEB } from "./t3.ts"; |
| 4 | |
| 5 | const themeJson = (css?: string) => |
| 6 | JSON.stringify({ |
| 7 | version: 1, |
| 8 | name: "Nyx", |
| 9 | // The scenario browser is in light mode, and a one-appearance theme only fills that half. |
| 10 | appearance: "light", |
| 11 | colors: { canvas: "#f4f1ff", accent: "#6d5ae6" }, |
| 12 | ...(css ? { css } : {}), |
| 13 | }); |
| 14 | |
| 15 | const NYX_CSS = |
| 16 | ":root { --keep-both-marker: applied; } [data-settings-page-scroll] { outline: 8px solid #ff2d95; outline-offset: -8px; }"; |
| 17 | |
| 18 | test( |
| 19 | "Keep both on a theme import conflict keeps the imported theme's CSS", |
| 20 | WEB, |
| 21 | async ({ t3, app, screen, browser }) => { |
| 22 | await t3.project("demo"); |
| 23 | await t3.open("/settings/appearance"); |
| 24 | |
| 25 | const importTheme = async (json: string) => { |
| 26 | await screen.getByRole("button", "Add theme", { exact: true }).tap(); |
| 27 | const dialog = screen.getByRole("dialog", "Add a theme"); |
| 28 | await dialog.getByRole("textbox", "Theme JSON").fill(json); |
| 29 | await dialog.getByRole("button", "Add theme", { exact: true }).tap(); |
| 30 | return dialog; |
| 31 | }; |
| 32 | |
| 33 | await expect(await importTheme(themeJson())).toBeHidden(); |
| 34 | |
| 35 | const dialog = await importTheme(themeJson(NYX_CSS)); |
| 36 | await expect(dialog.getByText("Already installed")).toBeVisible(); |
| 37 | await dialog.getByRole("button", "Keep both").tap(); |
| 38 | await expect(dialog).toBeHidden(); |
| 39 | |
| 40 | await screen.getByRole("button", "Use Nyx (1) theme").tap(); |
| 41 | await app.screenshot("keep-both-copy-selected"); |
| 42 | await expect |
| 43 | .poll(() => |
| 44 | browser.evaluate(() => |
| 45 | getComputedStyle(document.documentElement).getPropertyValue("--keep-both-marker").trim(), |
| 46 | ), |
| 47 | ) |
| 48 | .toBe("applied"); |
| 49 | }, |
| 50 | ); |