Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

docs(e2e): say what injected input can never prove about the HUD

Etienne Lescotede0ad1e40ad
diff --git a/AGENTS.md b/AGENTS.md
index d7b2ec8ab..fc38e0736 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -86,10 +86,12 @@ Unit/browser tests can't exercise real capture (native screen recording, a physi
- Normal: `npm run dev` — Vite serves the renderer and `vite-plugin-electron` opens the Electron window. The main process logs `Global shortcut registered: CommandOrControl+Shift+O` when ready (Ctrl/Cmd+Shift+O toggles the HUD).
- The app is single-instance through `app.requestSingleInstanceLock()`, which keys on the `userData` path. If a leftover Electron process still holds it, a new launch quits silently (exit 0, no window) — kill leftover `electron` processes before relaunching. The lock is held by the OS and dies with the process, so there is nothing to clean up on disk. A dev build and the installed `Openscreen` resolve different `userData` paths and can run side by side.
- **From a git worktree** (no `node_modules`/native binaries): junction/symlink `node_modules` from the main checkout (deps are usually identical — check `package-lock.json`), and copy the prebuilt native capture binaries from `electron/native/bin/<platform>/` (gitignored — rebuilding needs the full VS/Xcode toolchain). Then `npm run dev` works normally.
+- **Those binaries are frozen at whenever someone last built them, and nothing warns you.** They are not rebuilt by `npm run dev` or `npm run build`, so a helper older than the native change you came to test will run happily and silently exercise the old code path — the recording succeeds, and the thing you wanted to see is simply absent. Before trusting any native result, date the binary against the commit and grep it for a string the change introduced (`strings -a wgc-capture.exe | grep fragmented-mp4`). If it is stale and you have no toolchain, test the CI-built artifact instead; a dev build cannot answer the question.
**Granting access**
- `request_access` resolves names against installed apps. A **dev build runs as `electron.exe`** (or `Electron.app`), *not* the installed `Openscreen` — grant **`electron.exe`** or the dev window stays masked in screenshots. Non-allowlisted windows are masked (solid rectangles); the screenshot note lists their process names to add.
+- **Start the app before asking for it.** `electron.exe` is not an installed app, so the resolver only finds it once the process exists *and* owns a window; ask any earlier and the call fails with `doesn't match any installed or running application` — and one unresolvable name short-circuits the whole request, including the names that would have resolved. Granting `Openscreen` instead is not a workaround: it resolves to `…\programs\openscreen\openscreen.exe`, so the dev window stays masked while the grant reports success.
**The HUD widget** (recording controller)
@@ -97,6 +99,7 @@ Unit/browser tests can't exercise real capture (native screen recording, a physi
- **On macOS 26+ content protection is auto-disabled, so the HUD *is* visible and screenshottable with no flag.** That OS never displays a content-protected window at all — not just absent from captures, but never painted, leaving a tray icon, a live renderer and nothing on screen (confirmed on macOS 26.5 / Electron 41.2.1). `applyContentProtection` therefore skips the call there and logs a warning per window; the trade-off is that the HUD can appear in recordings on that OS until the ScreenCaptureKit helper excludes our own windows via `SCContentFilter(excludingWindows:)`, which it currently passes as `[]`. `OPENSCREEN_FORCE_CONTENT_PROTECTION=1` re-enables it to re-test against a future Electron.
- The HUD is what opens the editor (clapper icon, tooltip *Open Studio*), so without that flag a whole slice of the app is unreachable from automation: killing the app to redeploy a native addon leaves you unable to reopen a project.
- Frameless, transparent, always-on-top, `skipTaskbar`, centered at the **bottom of the primary display** (`createHudOverlayWindow`, 600×160). It is **click-through** (`setIgnoreMouseEvents(true, { forward: true })`): moving the real cursor over an interactive control makes that region clickable and shows its tooltip, so `mouse_move` → screenshot → `left_click` works; a blind click on empty HUD area passes through to the desktop.
+- **Only a real OS mouse move reaches the HUD.** On Windows that `forward` option is a global `WH_MOUSE_LL` hook, and driving it is what lifts the input-transparency over a control. CDP-injected input never does: Playwright's `.click()`, `javascript_tool`-dispatched pointer events, and anything else synthesised into the renderer arrive *below* the OS hit-test, fire the DOM handler, and look like they worked — while the click-through path was never exercised at all. `tests/e2e/windows-native-checklist.spec.ts` does click HUD testids and stays green for exactly that reason; it proves renderer wiring, not reachability. Use computer-use (`mouse_move` → `left_click`), and never conclude from a passing injected click that a user could have clicked it.
- Control row (left→right): layout preset, **source** button (`Screen`/`Window` → label becomes the picked source), system-audio toggle, mic toggle, **webcam toggle** (shows the detected camera name), cursor-highlight toggle, **record**, notes, open-editor, language, minimize, close. The record button is disabled until a source is chosen (tooltip: "Please select a source to record").
**The tray icon** (bottom-right notification area)
diff --git a/tests/e2e/windows-native-checklist.spec.ts b/tests/e2e/windows-native-checklist.spec.ts
index 959b15f1d..fcda17a2a 100644
--- a/tests/e2e/windows-native-checklist.spec.ts
+++ b/tests/e2e/windows-native-checklist.spec.ts
@@ -326,6 +326,16 @@ test.describe("Windows native checklist smoke tests", () => {
// input-transparent when the hook fails to install can never be clicked again,
// which is what bricked the app in issue #266. Both halves matter — that nothing
// asks during construction, and that the renderer still does after mount.
+ //
+ // Note what this test therefore cannot do, and what no test in this file can.
+ // Only a real OS cursor move drives a WH_MOUSE_LL hook; CDP-injected input
+ // arrives below the OS hit-test, so Playwright's own `.click()` on a HUD testid
+ // — above, and in the source-selector step of the checklist test — reaches the
+ // DOM handler whether or not click-through is installed, or even working. Those
+ // clicks assert renderer wiring and nothing else. The failure #266 actually shipped
+ // (a painted, permanently inert HUD) is invisible to injected input by construction,
+ // so it belongs on the manual computer-use checklist and cannot be regression-tested
+ // here. Do not read a green run as evidence that the HUD is clickable.
test("the HUD asks for click-through instead of being born with it", async () => {
const app = await launchApp();