Skip to content

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

test(e2e): verify Windows API loopback binding

Louis Beaumont8495ba9bf658
diff --git a/apps/screenpipe-app-tauri/e2e/README.md b/apps/screenpipe-app-tauri/e2e/README.md
index ac2f73ba6..eb34db86c 100644
--- a/apps/screenpipe-app-tauri/e2e/README.md
+++ b/apps/screenpipe-app-tauri/e2e/README.md
@@ -161,7 +161,7 @@ Saves to `e2e/videos/`.
| `home-window.spec.ts` | Opens Home window; clicks through Home, Pipes, Timeline, Help, Settings nav items |
| `timeline.spec.ts` | Navigates to Timeline; seeds a capture event; verifies at least one frame renders |
| `windows-core-recording.spec.ts` | Windows opt-in. Enables real vision recording and requires API auth, health/load, audio/device, vision, and search endpoints to stay responsive. In CI it uses `SCREENPIPE_E2E_SEED=onboarding,no-audio` so hosted runners exercise OCR without booting Whisper. When the runner exposes usable desktop frames, it also shows a foreground marker window and verifies OCR indexing/query search plus Timeline frame metadata; hosted runners without frames self-skip those capture-dependent assertions. |
-| `windows-system-integration.spec.ts` | Windows-only. Verifies isolated data dir, native DLL/WebView2 runtime, display/DPI topology, TCP listeners, process health, Defender visibility, audio service/device health, concurrent local API load, focus churn, and rapid Home-window routing |
+| `windows-system-integration.spec.ts` | Windows-only. Verifies isolated data dir, native DLL/WebView2 runtime, display/DPI topology, localhost-only API binding, process health, Defender visibility, audio service/device health, concurrent local API load, focus churn, and rapid Home-window routing |
| `hd-recording-pipeline.spec.ts` | macOS opt-in. Starts an HD timer session via `/capture/hd/start`; asserts the controller goes active, a non-empty `hd_*.mp4` chunk is written, and OCR keeps indexing during HD (high-fps + indexing decouple, #3699/#3707) |
| `settings-sections.spec.ts` | Navigates General → Recording → AI → Speakers settings; verifies content and no crash |
| `audio-fallback.spec.ts` | macOS opt-in spec for the Screenpipe Cloud → local Whisper fallback alert and `/notify` history |
diff --git a/apps/screenpipe-app-tauri/e2e/specs/windows-system-integration.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/windows-system-integration.spec.ts
index 8409c1c95..9fc45c97f 100644
--- a/apps/screenpipe-app-tauri/e2e/specs/windows-system-integration.spec.ts
+++ b/apps/screenpipe-app-tauri/e2e/specs/windows-system-integration.spec.ts
@@ -56,6 +56,12 @@ type HealthBody = {
audio_status?: string;
};
+type TimeoutFetchResult = {
+ ok: boolean;
+ status: number;
+ error?: string;
+};
+
function ps(command: string, timeout = 15_000): string {
return execFileSync(
"powershell.exe",
@@ -64,6 +70,28 @@ function ps(command: string, timeout = 15_000): string {
).trim();
}
+async function fetchStatusWithTimeout(
+ url: string,
+ timeoutMs = t(3_000),
+): Promise<TimeoutFetchResult> {
+ const controller = new AbortController();
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
+
+ try {
+ const res = await fetch(url, { signal: controller.signal });
+ await res.arrayBuffer().catch(() => undefined);
+ return { ok: res.ok, status: res.status };
+ } catch (error) {
+ return {
+ ok: false,
+ status: 0,
+ error: error instanceof Error ? error.message : String(error),
+ };
+ } finally {
+ clearTimeout(timeout);
+ }
+}
+
function apiUrl(api: LocalApi, path: string): string {
return `http://127.0.0.1:${api.port}${path}`;
}
@@ -217,6 +245,42 @@ if (-not $hits) {
expect(health.ok).toBe(true);
});
+ it("keeps the local API bound to loopback when LAN access is off", async function () {
+ if (!isWindows || !api) this.skip();
+
+ const json = ps(`
+$addresses = Get-NetIPAddress -AddressFamily IPv4 -ErrorAction SilentlyContinue |
+ Where-Object {
+ $_.IPAddress -notmatch '^127\\.' -and
+ $_.IPAddress -notmatch '^169\\.254\\.' -and
+ $_.AddressState -eq 'Preferred'
+ } |
+ Select-Object -ExpandProperty IPAddress -Unique
+if (-not $addresses) {
+ Write-Output "[]"
+} else {
+ @($addresses) | ConvertTo-Json -Compress
+}
+`);
+ const parsed = JSON.parse(json) as string | string[];
+ const addresses = Array.isArray(parsed) ? parsed : [parsed].filter(Boolean);
+ if (addresses.length === 0) this.skip();
+
+ const loopback = await fetchStatusWithTimeout(apiUrl(api, "/health"));
+ expect(loopback.ok).toBe(true);
+ expect(loopback.status).toBeLessThan(500);
+
+ for (const address of addresses.slice(0, 2)) {
+ const status = await fetchStatusWithTimeout(`http://${address}:${api.port}/health`);
+ if (status.status > 0) {
+ throw new Error(
+ `Local API unexpectedly answered on non-loopback Windows address ${address}:${api.port} with status ${status.status}`,
+ );
+ }
+ expect(status.ok).toBe(false);
+ }
+ });
+
it("reports sane Windows DPI and keeps WebView viewport usable", async function () {
if (!isWindows) this.skip();