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
test: add overlay, permissions, lifecycle, and DB edge case tests
Louis Beaumont38091d11ec7d
diff --git a/.github/scripts/e2e/test-main-window.ts b/.github/scripts/e2e/test-main-window.tsindex 097ae09d2..224eed0a6 100644--- a/.github/scripts/e2e/test-main-window.ts+++ b/.github/scripts/e2e/test-main-window.ts@@ -57,7 +57,7 @@ if (IS_MACOS) {if (IS_WINDOWS) {// On Windows, Tauri app uses WebView2 which may not expose full UIA tree// when the window is in tray mode. We test what we can access.- await test("show main window via shortcut", async () => {+ await test("show main window via shortcut (S1.1)", async () => {const s = shortcuts.showApp;await shortcut(s.key, s.modifiers);await sleep(3000);@@ -69,6 +69,46 @@ if (IS_WINDOWS) {if (elements.length === 0) throw new Error("no screenpipe elements found");});+ await test("overlay toggle on/off (S1.4-5)", async () => {+ const s = shortcuts.showApp;+ // Toggle on+ await shortcut(s.key, s.modifiers);+ await sleep(1000);+ // Toggle off+ await shortcut(s.key, s.modifiers);+ await sleep(1000);+ // Toggle on again+ await shortcut(s.key, s.modifiers);+ await sleep(1000);++ // App should still be responsive+ const result = await bb("find", "name~:screenpi");+ const elements = result?.data ?? [];+ if (elements.length === 0) {+ console.log(" warning: window not found after toggle");+ } else {+ console.log(` overlay toggle: ${elements.length} element(s) after toggle`);+ }+ });++ await test("no blink on show (S1.7)", async () => {+ // Show window and verify it appears without intermediate blank+ const s = shortcuts.showApp;+ await shortcut(s.key, s.modifiers);+ await sleep(500);+ // Take screenshot immediately — if window blinks, screenshot will show blank+ await screenshot("02-no-blink-check");+ await sleep(500);+ });++ await test("Escape key does not crash (S1.14)", async () => {+ await bb("press", "Escape");+ await sleep(500);+ // App should still be alive+ const result = await bb("find", "name~:screenpi");+ // Window may have hidden — that's OK, just shouldn't crash+ });+await test("take screenshot after show", async () => {await screenshot("02-main-window-shown");});diff --git a/.github/scripts/e2e/test-permissions.ts b/.github/scripts/e2e/test-permissions.tsindex dbccce2b1..5ccc7d7ac 100644--- a/.github/scripts/e2e/test-permissions.ts+++ b/.github/scripts/e2e/test-permissions.ts@@ -33,21 +33,46 @@ if (IS_MACOS) {}if (IS_WINDOWS) {- await test("screen recording permission", () => assertHealthField("frame_status", "ok"));+ await test("screen recording permission (S6.1)", () => assertHealthField("frame_status", "ok"));- await test("bb can enumerate windows", async () => {+ await test("bb can enumerate windows (S6.1)", async () => {const result = await bb("apps");const apps = result?.data ?? [];if (apps.length === 0) throw new Error("bb cannot list any windows");});- await test("bb can take screenshot", async () => {+ await test("bb can take screenshot (S6.1)", async () => {await screenshot("permissions-screenshot-test");});- await test("bb keyboard input works", async () => {+ await test("bb keyboard input works (S6.1)", async () => {await bb("press", "Escape");});++ await test("no permission banner visible (S6.4)", async () => {+ // On Windows, there's no macOS-style permission banner+ // but we verify the app doesn't show its own permission error+ const { fetchJson, HEALTH_URL } = await import("./lib");+ const health = await fetchJson(HEALTH_URL);+ if (health.frame_status !== "ok") {+ console.log(` warning: frame_status=${health.frame_status} — may indicate permission issue`);+ }+ // App should not be showing a "permission denied" state+ if (health.status === "error" && String(health.message ?? "").toLowerCase().includes("permission")) {+ throw new Error("permission error detected in health status");+ }+ console.log(" no permission errors detected");+ });++ await test("app can access filesystem for DB (S6.1)", async () => {+ // Verify app has filesystem permission by checking search works+ const { fetchJson } = await import("./lib");+ const data = await fetchJson("http://localhost:3030/search?limit=1");+ if (!data?.data) {+ throw new Error("search failed — possible filesystem permission issue");+ }+ console.log(" filesystem access OK (search works)");+ });}await screenshot("04-permissions");diff --git a/apps/screenpipe-app-tauri/e2e/tests/app-lifecycle.js b/apps/screenpipe-app-tauri/e2e/tests/app-lifecycle.jsindex 24c4b4108..39fbc88d7 100644--- a/apps/screenpipe-app-tauri/e2e/tests/app-lifecycle.js+++ b/apps/screenpipe-app-tauri/e2e/tests/app-lifecycle.js@@ -180,4 +180,97 @@ describe('App Lifecycle', () => {const ready2 = await browser.execute(() => document.readyState);expect(ready2).toBe('complete');});++ it('should have version info accessible (S8.7)', async () => {+ // Check if app exposes version info via Tauri API+ const versionInfo = await browser.execute(async () => {+ try {+ if (window.__TAURI__) {+ const version = await window.__TAURI__.app.getVersion();+ return { version, hasTauri: true };+ }+ return { version: null, hasTauri: false };+ } catch {+ return { version: null, hasTauri: false, error: true };+ }+ });++ if (versionInfo.version) {+ console.log(`App version: ${versionInfo.version}`);+ } else {+ console.log('Version info not accessible via Tauri API');+ }++ // App should still be stable+ const ready = await browser.execute(() => document.readyState);+ expect(ready).toBe('complete');+ });++ it('should handle window resize without crash (S1.10)', async () => {+ // Get current size+ const size = await browser.execute(() => ({+ width: window.innerWidth,+ height: window.innerHeight,+ }));++ // Trigger resize event+ await browser.execute(() => {+ window.dispatchEvent(new Event('resize'));+ });+ await browser.pause(500);++ const ready = await browser.execute(() => document.readyState);+ expect(ready).toBe('complete');++ const bodyText = await browser.execute(() => document.body.innerText);+ expect(bodyText).not.toContain('Unhandled Runtime Error');+ });++ it('should not have XSS in search results (S9.5)', async () => {+ // Try injecting script tags via search — should be safely handled+ const result = await browser.execute(async () => {+ const res = await fetch('http://localhost:3030/search?q=%3Cscript%3Ealert(1)%3C%2Fscript%3E&limit=1');+ return { ok: res.ok, status: res.status };+ });++ // Should not crash server+ expect(result.status).not.toBe(500);++ // DOM should not execute injected scripts+ const alertFired = await browser.execute(() => {+ // Check if any alert dialog was triggered+ return typeof window.__xss_test === 'undefined';+ });+ expect(alertFired).toBe(true);+ });++ it('should have localStorage accessible (S10.3)', async () => {+ // Settings persistence relies on localStorage/Tauri store+ const storageWorks = await browser.execute(() => {+ try {+ localStorage.setItem('e2e_test', 'works');+ const val = localStorage.getItem('e2e_test');+ localStorage.removeItem('e2e_test');+ return val === 'works';+ } catch {+ return false;+ }+ });+ expect(storageWorks).toBe(true);+ });++ it('should handle multiple rapid navigations without crash (S8.6)', async () => {+ const routes = ['/', '/settings', '/', '/settings', '/', '/settings', '/'];+ for (const route of routes) {+ await browser.execute((r) => { window.location.href = r; }, route);+ await browser.pause(500);+ }++ await browser.pause(2000);+ const ready = await browser.execute(() => document.readyState);+ expect(ready).toBe('complete');++ const bodyText = await browser.execute(() => document.body.innerText);+ expect(bodyText).not.toContain('Unhandled Runtime Error');+ });});diff --git a/apps/screenpipe-app-tauri/e2e/tests/db-stress.js b/apps/screenpipe-app-tauri/e2e/tests/db-stress.jsindex a1b1e917a..4a35dabd7 100644--- a/apps/screenpipe-app-tauri/e2e/tests/db-stress.js+++ b/apps/screenpipe-app-tauri/e2e/tests/db-stress.js@@ -168,4 +168,53 @@ describe('Database & Stability (S9)', () => {const failures = apiResults.filter(r => !r.ok);expect(failures.length).toBe(0);});++ it('should handle search with empty query (S9.5)', async () => {+ const result = await browser.execute(async (base) => {+ const res = await fetch(`${base}/search?q=&limit=5`);+ return { ok: res.ok, status: res.status };+ }, API_BASE);++ // Empty query should not crash+ expect(result.status).not.toBe(500);+ });++ it('should handle search with very long query (S9.5)', async () => {+ const longQuery = 'a'.repeat(1000);+ const result = await browser.execute(async (base, q) => {+ try {+ const res = await fetch(`${base}/search?q=${encodeURIComponent(q)}&limit=1`);+ return { ok: res.ok, status: res.status };+ } catch (e) {+ return { ok: false, status: 0 };+ }+ }, API_BASE, longQuery);++ // Should not crash server — 400 or empty results OK+ expect(result.status).not.toBe(500);+ });++ it('should handle search with negative offset (S9.5)', async () => {+ const result = await browser.execute(async (base) => {+ const res = await fetch(`${base}/search?offset=-1&limit=5`);+ return { ok: res.ok, status: res.status };+ }, API_BASE);++ // Should handle gracefully+ expect(result.status).not.toBe(500);+ });++ it('should handle health endpoint under concurrent load (S9.2)', async () => {+ const results = await browser.execute(async (base) => {+ const promises = Array.from({ length: 20 }, () =>+ fetch(`${base}/health`)+ .then(r => ({ ok: r.ok, status: r.status }))+ .catch(() => ({ ok: false, status: 0 }))+ );+ return Promise.all(promises);+ }, API_BASE);++ const failures = results.filter(r => !r.ok);+ expect(failures.length).toBeLessThan(2);+ });});