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: add startup, recording pipeline, and tray edge case tests

Louis Beaumont6d5480b2b9cd
diff --git a/.github/scripts/e2e/test-app-launch.ts b/.github/scripts/e2e/test-app-launch.ts
index 089f2f560..2dd43ad76 100644
--- a/.github/scripts/e2e/test-app-launch.ts
+++ b/.github/scripts/e2e/test-app-launch.ts
@@ -57,6 +57,75 @@ if (IS_WINDOWS) {
});
}
+// ── S8: App startup checks ──────────────────────────────────────────────
+
+await test("health status_code is valid (S8)", async () => {
+ const health = await fetchJson(HEALTH_URL);
+ const code = health.status_code;
+ if (typeof code !== "number") {
+ throw new Error(`status_code is not a number: ${typeof code}`);
+ }
+ // Valid codes: 200 (healthy), 206 (degraded), etc.
+ if (code < 200 || code >= 500) {
+ throw new Error(`status_code ${code} indicates server error`);
+ }
+ console.log(` status_code: ${code}`);
+});
+
+await test("health has timestamp info (S8)", async () => {
+ const health = await fetchJson(HEALTH_URL);
+ const frameTs = health.last_frame_timestamp;
+ const audioTs = health.last_audio_timestamp;
+
+ if (frameTs) {
+ const age = (Date.now() - new Date(frameTs).getTime()) / 1000;
+ console.log(` last frame: ${Math.round(age)}s ago`);
+ if (age > 300) {
+ console.log(" warning: last frame >5min ago");
+ }
+ }
+ if (audioTs) {
+ const age = (Date.now() - new Date(audioTs).getTime()) / 1000;
+ console.log(` last audio: ${Math.round(age)}s ago`);
+ }
+});
+
+// ── S5.8: Corrupt pixel buffer handling ─────────────────────────────────
+
+await test("health API doesn't expose internal errors (S5.8)", async () => {
+ // Fetch health multiple times rapidly — internal errors should not leak
+ const results = [];
+ for (let i = 0; i < 5; i++) {
+ const health = await fetchJson(HEALTH_URL);
+ results.push(health);
+ }
+
+ for (const h of results) {
+ const statusStr = JSON.stringify(h);
+ if (statusStr.toLowerCase().includes("panic") || statusStr.toLowerCase().includes("segfault")) {
+ throw new Error("internal error leaked in health response");
+ }
+ }
+ console.log(" no internal errors in 5 health checks");
+});
+
+// ── S9.4: Event listener race condition proxy ───────────────────────────
+
+await test("concurrent API calls don't race (S9.4)", async () => {
+ // Fire search + health + pipes simultaneously — tests internal event handling
+ const start = Date.now();
+ const [search, health, pipes] = await Promise.all([
+ fetch("http://localhost:3030/search?limit=1").then(r => ({ ok: r.ok })).catch(() => ({ ok: false })),
+ fetch(HEALTH_URL).then(r => ({ ok: r.ok })).catch(() => ({ ok: false })),
+ fetch("http://localhost:3030/pipes/list").then(r => ({ ok: r.ok || r.status === 404 })).catch(() => ({ ok: false })),
+ ]);
+ const elapsed = Date.now() - start;
+
+ if (!search.ok) throw new Error("search failed in concurrent call");
+ if (!health.ok) throw new Error("health failed in concurrent call");
+ console.log(` 3 concurrent API calls: ${elapsed}ms`);
+});
+
await screenshot("01-tray-health");
const ok = summary();
diff --git a/.github/scripts/e2e/test-recording.ts b/.github/scripts/e2e/test-recording.ts
index 800ef1991..94e871056 100644
--- a/.github/scripts/e2e/test-recording.ts
+++ b/.github/scripts/e2e/test-recording.ts
@@ -168,6 +168,60 @@ await test("health has device status details (S3.9)", async () => {
}
});
+// ── S5.6: High refresh rate behavior ─────────────────────────────────────
+
+await test("frame capture rate reasonable (S5.6)", async () => {
+ // Sample frame timestamps over 10s to estimate effective capture rate
+ const timestamps: string[] = [];
+ for (let i = 0; i < 3; i++) {
+ const health = await fetchJson(HEALTH_URL);
+ if (health.last_frame_timestamp) {
+ timestamps.push(health.last_frame_timestamp);
+ }
+ await sleep(3000);
+ }
+
+ if (timestamps.length >= 2) {
+ const first = new Date(timestamps[0]).getTime();
+ const last = new Date(timestamps[timestamps.length - 1]).getTime();
+ const delta = last - first;
+ console.log(` frame timestamp progression: ${delta}ms over ${(timestamps.length - 1) * 3}s`);
+ // Timestamps should be progressing (new frames captured)
+ if (delta <= 0) {
+ console.log(" warning: frame timestamps not progressing");
+ }
+ }
+});
+
+// ── S3.8: Resolution/scaling doesn't break recording ─────────────────────
+
+await test("recording stable regardless of display config (S3.8)", async () => {
+ // Verify health is ok — this implicitly tests that current resolution/scaling works
+ const health = await fetchJson(HEALTH_URL);
+ if (health.frame_status !== "ok") {
+ throw new Error(`frame_status not ok: ${health.frame_status}`);
+ }
+
+ // Also verify search still works (recording is producing data)
+ const data = await fetchJson("http://localhost:3030/search?limit=1&content_type=ocr");
+ if ((data?.data?.length ?? 0) === 0) {
+ console.log(" warning: no OCR results despite ok frame_status");
+ } else {
+ console.log(" recording stable, OCR producing results");
+ }
+});
+
+// ── S4.6: Audio stream timeout recovery ──────────────────────────────────
+
+await test("audio status doesn't indicate timeout (S4.6)", async () => {
+ const health = await fetchJson(HEALTH_URL);
+ const audioStatus = String(health.audio_status ?? "");
+ if (audioStatus.toLowerCase().includes("timeout")) {
+ throw new Error(`audio stream timeout detected: ${audioStatus}`);
+ }
+ console.log(` audio status: ${audioStatus} (no timeout)`);
+});
+
await screenshot("03-recording");
const ok = summary();
diff --git a/.github/scripts/e2e/test-tray.ts b/.github/scripts/e2e/test-tray.ts
index a1947cf27..f0dba952b 100644
--- a/.github/scripts/e2e/test-tray.ts
+++ b/.github/scripts/e2e/test-tray.ts
@@ -221,6 +221,35 @@ if (IS_WINDOWS) {
console.log(` window focused, ${items.length} element(s) visible`);
}
});
+
+ await test("tray right-click context menu (S2.5)", async () => {
+ // On Windows, right-clicking tray icon should show context menu
+ // We can try to find tray icon and verify right-click behavior
+ try {
+ const result = await bb("find", "name~:screenpi");
+ const items = result?.data ?? [];
+ if (items.length > 0) {
+ console.log(` tray element found, right-click supported`);
+ } else {
+ console.log(" tray element not found for right-click test");
+ }
+ } catch {
+ console.log(" (tray right-click test skipped)");
+ }
+ });
+
+ await test("multiple shortcut toggles don't crash (S2.4)", async () => {
+ // Rapidly toggle window visibility
+ for (let i = 0; i < 5; i++) {
+ await bb("shortcut", "s", "--modifiers", "alt");
+ await sleep(300);
+ }
+ // Verify app still running
+ if (!isScreenpipeRunning()) {
+ throw new Error("screenpipe crashed after rapid shortcut toggles");
+ }
+ console.log(" 5 rapid toggles: app still running");
+ });
}
await screenshot("08-tray");