From b431db8de0eb93af86ecbddb7bdf4c1bd402d3e3 Mon Sep 17 00:00:00 2001 From: usrnk1 <7547651+usrnk1@users.noreply.github.com> Date: Tue, 27 Oct 2026 20:46:13 +0100 Subject: [PATCH] chore(desktop): preserve appearance during CDP diagnostics (#59681) --- AGENTS.md | 6 ++++++ packages/app/e2e/performance/devex/desktop-startup.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index 0971dbb1c03..44d368b8e04 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,6 +10,12 @@ - The script discovers the server with `opencode service status`, injects its private local credential from `opencode service get password`, and uses the `dev` TUI storage channel so tabs and other client-local state match the installed client. - Prefer `dev:live` over plain `bun run dev` for this workflow. An implicit managed-service connection may replace the live server when the worktree client version differs; explicit `--server` warns and continues without replacing it. +## Live Desktop Diagnostics + +- When attaching Playwright to a running desktop app, use `chromium.connectOverCDP(endpoint, { noDefaults: true })`. +- Without `noDefaults`, Playwright applies light-mode media emulation during attachment. An app following the system theme then flashes light until the connection closes. The option also preserves the existing focus and other media preferences. +- Do not emulate a color scheme or reduced-motion preference on the user's live window unless explicitly requested; use an isolated test context for those scenarios. + ## TUI Stories - When a user asks for a TUI story, add a fixture-driven story under `packages/tui/src/feature-plugins/system/storybook` and register it in `index.tsx`. diff --git a/packages/app/e2e/performance/devex/desktop-startup.ts b/packages/app/e2e/performance/devex/desktop-startup.ts index e37b8c9fb0b..494dbf68004 100644 --- a/packages/app/e2e/performance/devex/desktop-startup.ts +++ b/packages/app/e2e/performance/devex/desktop-startup.ts @@ -239,7 +239,8 @@ function startDesktop(profile: Awaited>) { }), ]) - browser = await chromium.connectOverCDP(url, { timeout: 120_000 }) + // Observe the native appearance and focus instead of applying Playwright's media defaults. + browser = await chromium.connectOverCDP(url, { timeout: 120_000, noDefaults: true }) const context = browser.contexts()[0] if (!context) throw new Error("Electron did not expose a browser context")