YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(e2e): drop brittle document.hasFocus() guard in window-activation spec
Louis Beaumont7aa28aec26a5
diff --git a/apps/screenpipe-app-tauri/e2e/specs/window-activation.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/window-activation.spec.tsindex a9b992330..dae406adf 100644--- a/apps/screenpipe-app-tauri/e2e/specs/window-activation.spec.ts+++ b/apps/screenpipe-app-tauri/e2e/specs/window-activation.spec.ts@@ -44,18 +44,6 @@ async function waitForAnyMainHandle(timeoutMs = t(12_000)): Promise<MainLabel> {throw new Error(`Main window handle did not appear (${MAIN_LABELS.join(", ")})`);}-async function waitForDocumentFocus(timeoutMs = t(10_000)): Promise<void> {- await browser.waitUntil(async () => {- const focused = (await browser.execute(() => document.hasFocus())) as boolean;- const hidden = (await browser.execute(() => document.hidden)) as boolean;- return focused && !hidden;- }, {- timeout: timeoutMs,- interval: 250,- timeoutMsg: "Webview never became focused (document.hasFocus=false or document.hidden=true)",- });-}-(process.platform === "darwin" ? describe : describe.skip)("Window activation (macOS)",function () {@@ -93,9 +81,10 @@ async function waitForDocumentFocus(timeoutMs = t(10_000)): Promise<void> {await waitForWindowUrl("/overlay", undefined, t(20_000));await expectSingleWindowHandle(openedMainLabel);- // Focus regression guard: when activation fails (non-activating surfaces),- // the window may exist but never becomes key, leaving the UI unresponsive.- await waitForDocumentFocus(t(20_000));+ // Focus regression guard: the keydown wait below fails fast if the webview+ // never became key. document.hasFocus() was unreliable on hosted macOS+ // runners (image 20260520+), where WKWebView doesn't always receive+ // OS-level focus even when activation is logically correct.// Capture at least one keydown event in the webview without needing a click.await browser.execute(() => {@@ -143,7 +132,6 @@ async function waitForDocumentFocus(timeoutMs = t(10_000)): Promise<void> {await browser.switchToWindow("chat");await waitForWindowUrl("/chat", undefined, t(20_000));- await waitForDocumentFocus(t(20_000));const composer = await $("form textarea");await composer.waitForExist({ timeout: t(20_000) });