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
feat: rewrite E2E tests in Bun/TypeScript
Louis Beaumont2522c861f2e3
diff --git a/.github/scripts/e2e/lib.ts b/.github/scripts/e2e/lib.tsnew file mode 100644index 000000000..b6213420f--- /dev/null+++ b/.github/scripts/e2e/lib.ts@@ -0,0 +1,253 @@+/**+ * E2E test library — shared helpers for all test scripts+ * Requires: bb (bigbrother CLI) in PATH or at ~/Documents/bigbrother/target/release/bb+ */++import { $ } from "bun";+import { existsSync, mkdirSync } from "fs";+import { join } from "path";++// ── Config ──────────────────────────────────────────────────────────────────++export const APP_NAME = "screenpipe-app";+export const HEALTH_URL = "http://localhost:3030/health";+export const SEARCH_URL = "http://localhost:3030/search";+export const TIMEOUT_SHORT = 5_000;+export const TIMEOUT_MEDIUM = 15_000;+export const TIMEOUT_LONG = 60_000;++export const ARTIFACTS_DIR =+ process.env.ARTIFACTS_DIR ??+ join("/tmp", "screenpipe-e2e", new Date().toISOString().replace(/[:.]/g, "-"));++// ── Find bb binary ─────────────────────────────────────────────────────────++const BB_PATHS = [+ "bb",+ join(process.env.HOME ?? "", "Documents/bigbrother/target/release/bb"),+ "/usr/local/bin/bb",+];++let BB = "";+for (const p of BB_PATHS) {+ try {+ const res = Bun.spawnSync([p, "--version"]);+ if (res.exitCode === 0) {+ BB = p;+ break;+ }+ } catch {}+}+if (!BB) throw new Error("bb (bigbrother) not found. Build it: cd ~/Documents/bigbrother && cargo build --release");++// ── State ───────────────────────────────────────────────────────────────────++interface TestResult {+ name: string;+ passed: boolean;+ durationMs: number;+ error?: string;+}++let results: TestResult[] = [];+let suiteName = "";++// ── Colors ──────────────────────────────────────────────────────────────────++const c = {+ red: (s: string) => `\x1b[0;31m${s}\x1b[0m`,+ green: (s: string) => `\x1b[0;32m${s}\x1b[0m`,+ cyan: (s: string) => `\x1b[0;36m${s}\x1b[0m`,+ bold: (s: string) => `\x1b[1m${s}\x1b[0m`,+ yellow: (s: string) => `\x1b[0;33m${s}\x1b[0m`,+};++// ── Core ────────────────────────────────────────────────────────────────────++export function suite(name: string) {+ suiteName = name;+ results = [];+ mkdirSync(ARTIFACTS_DIR, { recursive: true });+ console.log(`\n${c.bold(`═══ ${name} ═══`)}`);+ console.log(`artifacts: ${ARTIFACTS_DIR}`);+ console.log("");+}++export async function test(name: string, fn: () => Promise<void> | void) {+ const idx = results.length + 1;+ process.stdout.write(` ${c.bold(`[${idx}]`)} ${name} ... `);+ const start = performance.now();++ try {+ await fn();+ const dur = Math.round(performance.now() - start);+ console.log(`${c.green("PASS")} (${dur}ms)`);+ results.push({ name, passed: true, durationMs: dur });+ } catch (err: any) {+ const dur = Math.round(performance.now() - start);+ const msg = err?.message ?? String(err);+ console.log(`${c.red("FAIL")} (${dur}ms)`);+ results.push({ name, passed: false, durationMs: dur, error: msg });++ // Save failure details+ const safeName = name.replace(/[^a-zA-Z0-9]/g, "-");+ const logPath = join(ARTIFACTS_DIR, `fail-${idx}-${safeName}.log`);+ await Bun.write(logPath, msg);++ // Screenshot on failure+ try {+ await bb("screenshot", "--output", join(ARTIFACTS_DIR, `fail-${idx}.png`));+ } catch {}+ }+}++export function summary(): boolean {+ const passed = results.filter((r) => r.passed).length;+ const failed = results.filter((r) => !r.passed).length;++ console.log(`\n${c.bold("═══ results ═══")}`);+ console.log(` total: ${results.length}`);+ console.log(` passed: ${c.green(String(passed))}`);+ console.log(` failed: ${c.red(String(failed))}`);++ if (failed > 0) {+ console.log(`\n${c.red("failed tests:")}`);+ for (const r of results.filter((r) => !r.passed)) {+ console.log(` ${c.red("✗")} ${r.name}`);+ if (r.error) console.log(` ${c.yellow(r.error.slice(0, 200))}`);+ }+ }++ console.log(`\nartifacts: ${ARTIFACTS_DIR}`);+ return failed === 0;+}++// ── bb wrappers ─────────────────────────────────────────────────────────────++/** Run bb CLI and return parsed JSON output */+export async function bb(...args: string[]): Promise<any> {+ const proc = Bun.spawnSync([BB, ...args]);+ const stdout = proc.stdout.toString().trim();+ if (proc.exitCode !== 0) {+ const stderr = proc.stderr.toString().trim();+ throw new Error(`bb ${args.join(" ")} failed (exit ${proc.exitCode}): ${stderr || stdout}`);+ }+ try {+ return JSON.parse(stdout);+ } catch {+ return stdout;+ }+}++/** Assert an element exists (with optional timeout) */+export async function assertExists(selector: string, timeoutMs = TIMEOUT_SHORT) {+ const result = await bb("wait", "--selector", selector, "--app", APP_NAME, "--timeout", String(timeoutMs));+ if (!result?.success) throw new Error(`element not found: ${selector}`);+}++/** Assert an element does NOT exist */+export async function assertNotExists(selector: string) {+ try {+ const result = await bb("find", selector, "--app", APP_NAME, "--timeout", "2000");+ const count = result?.data?.length ?? 0;+ if (count > 0) throw new Error(`element should not exist but found ${count}: ${selector}`);+ } catch (err: any) {+ // find failed = element doesn't exist = good+ if (err.message?.includes("should not exist")) throw err;+ }+}++/** Find elements matching selector */+export async function find(selector: string): Promise<any[]> {+ const result = await bb("find", selector, "--app", APP_NAME);+ return result?.data ?? [];+}++/** Click an element */+export async function click(selector: string) {+ await bb("click", selector, "--app", APP_NAME);+}++/** Type text */+export async function type(text: string) {+ await bb("type", text);+}++/** Press a key */+export async function press(key: string) {+ await bb("press", key);+}++/** Keyboard shortcut */+export async function shortcut(key: string, modifiers = "cmd") {+ await bb("shortcut", key, "--modifiers", modifiers);+}++/** Scrape all text from app */+export async function scrape(): Promise<any> {+ return bb("scrape", "--app", APP_NAME);+}++/** Take screenshot */+export async function screenshot(name = "screenshot") {+ await bb("screenshot", "--output", join(ARTIFACTS_DIR, `${name}.png`));+}++/** Get accessibility tree */+export async function tree(): Promise<any> {+ return bb("tree", "--app", APP_NAME);+}++/** Sleep for ms */+export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));++// ── HTTP helpers ────────────────────────────────────────────────────────────++/** Fetch JSON from URL */+export async function fetchJson(url: string): Promise<any> {+ const res = await fetch(url);+ if (!res.ok) throw new Error(`HTTP ${res.status}: ${url}`);+ return res.json();+}++/** Assert health field equals expected value */+export async function assertHealthField(field: string, expected: string) {+ const health = await fetchJson(HEALTH_URL);+ const actual = health[field];+ if (String(actual) !== expected) {+ throw new Error(`health.${field}: expected "${expected}", got "${actual}"`);+ }+}++/** Assert search returns at least minCount results */+export async function assertSearchResults(contentType: string, minCount = 1) {+ const data = await fetchJson(`${SEARCH_URL}?limit=${minCount}&content_type=${contentType}`);+ const count = data?.data?.length ?? 0;+ if (count < minCount) {+ throw new Error(`search ${contentType}: expected >= ${minCount} results, got ${count}`);+ }+}++/** Wait for health API to respond */+export async function waitForHealth(timeoutS = 60) {+ const start = Date.now();+ while (Date.now() - start < timeoutS * 1000) {+ try {+ await fetchJson(HEALTH_URL);+ return;+ } catch {+ await sleep(2000);+ }+ }+ throw new Error(`health API did not respond within ${timeoutS}s`);+}++/** Get HTTP status code */+export async function httpStatus(url: string): Promise<number> {+ try {+ const res = await fetch(url);+ return res.status;+ } catch {+ return 0;+ }+}diff --git a/.github/scripts/e2e/run-all.ts b/.github/scripts/e2e/run-all.tsnew file mode 100644index 000000000..f41f29d7e--- /dev/null+++ b/.github/scripts/e2e/run-all.ts@@ -0,0 +1,124 @@+#!/usr/bin/env bun+/**+ * E2E test runner — runs all test suites in order+ * Usage:+ * bun .github/scripts/e2e/run-all.ts [--suite <name>]+ * bun .github/scripts/e2e/run-all.ts # runs all+ * bun .github/scripts/e2e/run-all.ts --suite api # runs only api suite+ */++import { join, dirname } from "path";+import { ARTIFACTS_DIR, HEALTH_URL } from "./lib";+import { mkdirSync } from "fs";++const c = {+ red: (s: string) => `\x1b[0;31m${s}\x1b[0m`,+ green: (s: string) => `\x1b[0;32m${s}\x1b[0m`,+ bold: (s: string) => `\x1b[1m${s}\x1b[0m`,+};++const SUITES = [+ { name: "launch", file: "test-app-launch.ts" },+ { name: "api", file: "test-api.ts" },+ { name: "window", file: "test-main-window.ts" },+ { name: "settings", file: "test-settings.ts" },+ { name: "recording", file: "test-recording.ts" },+ { name: "permissions", file: "test-permissions.ts" },+ { name: "onboarding", file: "test-onboarding.ts" },+ { name: "chat", file: "test-chat.ts" },+];++// Parse args+let filter = "";+const args = process.argv.slice(2);+for (let i = 0; i < args.length; i++) {+ if (args[i] === "--suite" && args[i + 1]) {+ filter = args[++i];+ }+}++// System info+const hostname = Bun.spawnSync(["hostname"]).stdout.toString().trim();+const osVersion = Bun.spawnSync(["sw_vers", "-productVersion"]).stdout.toString().trim();+const chip = Bun.spawnSync(["sysctl", "-n", "machdep.cpu.brand_string"]).stdout.toString().trim();+const memBytes = parseInt(Bun.spawnSync(["sysctl", "-n", "hw.memsize"]).stdout.toString().trim());+const memGB = Math.round(memBytes / 1073741824);++console.log(c.bold("╔══════════════════════════════════════╗"));+console.log(c.bold("║ screenpipe e2e test runner ║"));+console.log(c.bold("╚══════════════════════════════════════╝"));+console.log("");+console.log(`artifacts: ${ARTIFACTS_DIR}`);+console.log(`time: ${new Date().toLocaleString()}`);+console.log(`host: ${hostname}`);+console.log(`os: ${osVersion}`);+console.log(`chip: ${chip}`);+console.log(`memory: ${memGB}GB`);+console.log("");++mkdirSync(ARTIFACTS_DIR, { recursive: true });++// Preflight: check app is running+const pgrep = Bun.spawnSync(["pgrep", "-f", "screenpipe"]);+if (pgrep.exitCode !== 0) {+ console.log(c.red("error: screenpipe is not running"));+ console.log("start the app first, then run tests");+ process.exit(1);+}++// Preflight: check health+try {+ await fetch(HEALTH_URL);+} catch {+ console.log(c.red("warning: health API not responding, waiting 30s..."));+ await new Promise((r) => setTimeout(r, 30_000));+ try {+ await fetch(HEALTH_URL);+ } catch {+ console.log(c.red("error: health API still not responding"));+ process.exit(1);+ }+}++const scriptDir = dirname(new URL(import.meta.url).pathname);+let passed = 0;+let failed = 0;+const failedNames: string[] = [];++for (const s of SUITES) {+ if (filter && s.name !== filter) continue;++ console.log(`\n${c.bold(`━━━ suite: ${s.name} ━━━`)}`);++ const proc = Bun.spawnSync(["bun", join(scriptDir, s.file)], {+ env: { ...process.env, ARTIFACTS_DIR },+ stdout: "inherit",+ stderr: "inherit",+ });++ if (proc.exitCode === 0) {+ passed++;+ } else {+ failed++;+ failedNames.push(s.name);+ }+}++console.log("");+console.log(c.bold("╔══════════════════════════════════════╗"));+console.log(c.bold("║ final results ║"));+console.log(c.bold("╚══════════════════════════════════════╝"));+console.log("");+console.log(` suites run: ${passed + failed}`);+console.log(` suites passed: ${c.green(String(passed))}`);+console.log(` suites failed: ${c.red(String(failed))}`);++if (failedNames.length > 0) {+ console.log(`\n${c.red("failed suites:")}`);+ for (const name of failedNames) {+ console.log(` ${c.red("✗")} ${name}`);+ }+}++console.log(`\nartifacts: ${ARTIFACTS_DIR}`);+process.exit(failed > 0 ? 1 : 0);diff --git a/.github/scripts/e2e/test-api.ts b/.github/scripts/e2e/test-api.tsnew file mode 100644index 000000000..200e545c3--- /dev/null+++ b/.github/scripts/e2e/test-api.ts@@ -0,0 +1,81 @@+import {+ suite, test, summary, fetchJson, assertHealthField,+ assertSearchResults, httpStatus, HEALTH_URL, SEARCH_URL,+} from "./lib";++const BASE = "http://localhost:3030";++suite("REST API");++await test("GET /health", async () => {+ const res = await fetch(`${BASE}/health`);+ if (!res.ok) throw new Error(`status ${res.status}`);+});++await test("GET /search (ocr)", async () => {+ const res = await fetch(`${BASE}/search?limit=1&content_type=ocr`);+ if (!res.ok) throw new Error(`status ${res.status}`);+});++await test("GET /search (audio)", async () => {+ const res = await fetch(`${BASE}/search?limit=1&content_type=audio`);+ if (!res.ok) throw new Error(`status ${res.status}`);+});++await test("GET /search (query)", async () => {+ const res = await fetch(`${BASE}/search?limit=1&q=test`);+ if (!res.ok) throw new Error(`status ${res.status}`);+});++await test("GET /search (pagination)", async () => {+ const res = await fetch(`${BASE}/search?limit=5&offset=0`);+ if (!res.ok) throw new Error(`status ${res.status}`);+});++await test("search response structure", async () => {+ const data = await fetchJson(`${BASE}/search?limit=1`);+ if (!("data" in data)) throw new Error("missing 'data' field");+ if (!("pagination" in data)) throw new Error("missing 'pagination' field");+ if (!Array.isArray(data.data)) throw new Error("data is not an array");+});++await test("health response structure", async () => {+ const data = await fetchJson(`${BASE}/health`);+ for (const field of ["status", "status_code", "frame_status", "audio_status", "message"]) {+ if (!(field in data)) throw new Error(`missing '${field}' field`);+ }+});++await test("GET /pipes/list", async () => {+ const status = await httpStatus(`${BASE}/pipes/list`);+ // 200, 403 (auth), or 404 are fine — not 500+ if (status === 500) throw new Error("server error 500");+ if (status === 0) throw new Error("connection refused");+});++await test("search with date range", async () => {+ const today = new Date().toISOString().split("T")[0] + "T00:00:00Z";+ const res = await fetch(`${BASE}/search?limit=1&start_time=${today}`);+ if (!res.ok) throw new Error(`status ${res.status}`);+});++await test("5 concurrent requests", async () => {+ const results = await Promise.all(+ Array.from({ length: 5 }, () => fetch(`${BASE}/search?limit=1`))+ );+ const failures = results.filter((r) => !r.ok);+ if (failures.length > 0) throw new Error(`${failures.length}/5 requests failed`);+});++await test("large search limit (100)", async () => {+ const res = await fetch(`${BASE}/search?limit=100&content_type=ocr`);+ if (!res.ok) throw new Error(`status ${res.status}`);+});++await test("invalid content type (!500)", async () => {+ const status = await httpStatus(`${BASE}/search?content_type=invalid`);+ if (status === 500) throw new Error("server returned 500 on invalid content_type");+});++const ok = summary();+process.exit(ok ? 0 : 1);diff --git a/.github/scripts/e2e/test-app-launch.ts b/.github/scripts/e2e/test-app-launch.tsnew file mode 100644index 000000000..9d1420158--- /dev/null+++ b/.github/scripts/e2e/test-app-launch.ts@@ -0,0 +1,33 @@+import { suite, test, summary, screenshot, assertExists, assertHealthField } from "./lib";++suite("app launch & health");++await test("app process running", async () => {+ const proc = Bun.spawnSync(["pgrep", "-f", "screenpipe"]);+ if (proc.exitCode !== 0) throw new Error("screenpipe process not found");+});++await test("health API responds", async () => {+ const res = await fetch("http://localhost:3030/health");+ if (!res.ok) throw new Error(`health returned ${res.status}`);+});++await test("health status healthy", () => assertHealthField("status", "healthy"));+await test("health frame_status ok", () => assertHealthField("frame_status", "ok"));+await test("health audio_status ok", () => assertHealthField("audio_status", "ok"));++await test("tray icon exists", () => assertExists("role:AXMenuBarItem AND name~:status"));+await test("tray shows recording", () => assertExists("title:● recording"));+await test("tray version present", () => assertExists("title~:version"));+await test("tray settings item", () => assertExists("role:AXMenuItem AND title:settings"));+await test("tray quit item", () => assertExists("role:AXMenuItem AND title:quit screenpipe"));+await test("tray changelog item", () => assertExists("role:AXMenuItem AND title:changelog"));+await test("tray show screenpipe", () => assertExists("title~:show screenpipe"));+await test("tray stop recording", () => assertExists("role:AXMenuItem AND title:stop recording"));+await test("tray start recording", () => assertExists("role:AXMenuItem AND title:start recording"));+await test("tray send feedback", () => assertExists("role:AXMenuItem AND title:send feedback"));++await screenshot("01-tray-health");++const ok = summary();+process.exit(ok ? 0 : 1);diff --git a/.github/scripts/e2e/test-chat.ts b/.github/scripts/e2e/test-chat.tsnew file mode 100644index 000000000..c35a18ac8--- /dev/null+++ b/.github/scripts/e2e/test-chat.ts@@ -0,0 +1,32 @@+import {+ suite, test, summary, screenshot, assertExists,+ shortcut, find, click, sleep, TIMEOUT_MEDIUM,+} from "./lib";++suite("chat");++await test("navigate to chat area", async () => {+ await shortcut("s", "cmd,ctrl");+ await sleep(2000);+ await assertExists("role:AXWebArea", TIMEOUT_MEDIUM);+});++await test("chat page loads", async () => {+ // Verify webview is functional+ await assertExists("role:AXWebArea", TIMEOUT_MEDIUM);+});++await test("window not crashed", () => assertExists("role:AXWindow"));++await test("can focus text input", async () => {+ const textAreas = await find("role:AXTextArea").catch(() => []);+ if (textAreas.length > 0) {+ await click("role:AXTextArea");+ }+ // No text area found = might be on timeline page, that's ok+});++await screenshot("05-chat");++const ok = summary();+process.exit(ok ? 0 : 1);diff --git a/.github/scripts/e2e/test-main-window.ts b/.github/scripts/e2e/test-main-window.tsnew file mode 100644index 000000000..ce7083d41--- /dev/null+++ b/.github/scripts/e2e/test-main-window.ts@@ -0,0 +1,56 @@+import {+ suite, test, summary, screenshot, assertExists, shortcut, bb,+ press, scrape, sleep, TIMEOUT_MEDIUM,+} from "./lib";++suite("main window UI");++await test("open main window (⌃⌘S)", async () => {+ // Activate app first to ensure shortcut is received+ await bb("activate", "screenpipe-app");+ await sleep(500);+ await shortcut("s", "cmd,ctrl");+ await sleep(3000);+ await assertExists("role:AXWebArea", TIMEOUT_MEDIUM);+});++await test("window has webview", () => assertExists("role:AXWebArea"));++await test("search button exists", () => assertExists("title~:search"));++await test("timeline has time labels", async () => {+ const result = await scrape();+ const texts: string[] = (result?.data?.items ?? []).map((i: any) => i.text ?? "");+ const hasTime = texts.some((t) => /\d{1,2}\s*(AM|PM)/i.test(t));+ if (!hasTime) throw new Error("no time labels found in timeline");+});++await test("timeline has app labels", async () => {+ const result = await scrape();+ const texts: string[] = (result?.data?.items ?? []).map((i: any) => i.text ?? "");+ const meaningful = texts.filter((t) => t.length > 2 && !["text", "static text", "group", "button"].includes(t));+ if (meaningful.length < 3) throw new Error(`only ${meaningful.length} meaningful texts`);+});++await test("notifications region exists", () => assertExists("title~:Notifications"));++await test("open search panel (⌃⌘K)", async () => {+ await shortcut("k", "cmd,ctrl");+ await sleep(1000);+ await assertExists("role:AXTextField", TIMEOUT_MEDIUM);+});++await test("close search panel (Esc)", async () => {+ await press("Escape");+ await sleep(1000);+});++await test("screenpipe menu exists", () => assertExists("role:AXMenuBarItem AND title:screenpipe"));+await test("edit menu exists", () => assertExists("role:AXMenuBarItem AND title:Edit"));+await test("about menu item", () => assertExists("role:AXMenuItem AND title:About screenpipe"));+await test("check for updates item", () => assertExists("title~:Check for Updates"));++await screenshot("02-main-window");++const ok = summary();+process.exit(ok ? 0 : 1);diff --git a/.github/scripts/e2e/test-onboarding.ts b/.github/scripts/e2e/test-onboarding.tsnew file mode 100644index 000000000..ba286e453--- /dev/null+++ b/.github/scripts/e2e/test-onboarding.ts@@ -0,0 +1,43 @@+import {+ suite, test, summary, screenshot, assertExists, click,+ press, scrape, sleep, TIMEOUT_MEDIUM,+} from "./lib";++suite("onboarding flow");++await test("trigger onboarding from tray", async () => {+ // Use app menu bar (tray AXPress unreliable)+ await click("role:AXMenuBarItem AND title:screenpipe");+ await sleep(500);+ // Onboarding might be a menu item or we trigger via tray+ // Try finding the onboarding tray item directly+ try {+ await click("role:AXMenuItem AND title:onboarding");+ } catch {+ // Fall back to pressing escape and trying tray+ await press("Escape");+ await sleep(500);+ }+ await sleep(3000);+ await assertExists("role:AXWebArea", TIMEOUT_MEDIUM);+});++await test("onboarding has skip/content", async () => {+ const result = await scrape();+ const texts: string[] = (result?.data?.items ?? []).map((i: any) => (i.text ?? "").toLowerCase());+ const allText = texts.join(" ");+ const keywords = ["skip", "next", "continue", "get started", "welcome", "screenpipe", "setup"];+ if (!keywords.some((kw) => allText.includes(kw))) {+ throw new Error(`no onboarding keywords found in: ${allText.slice(0, 200)}`);+ }+});++await test("onboarding screenshot", () => screenshot("onboarding-step1"));++await test("close onboarding", async () => {+ await press("Escape");+ await sleep(1000);+});++const ok = summary();+process.exit(ok ? 0 : 1);diff --git a/.github/scripts/e2e/test-permissions.ts b/.github/scripts/e2e/test-permissions.tsnew file mode 100644index 000000000..310b795a0--- /dev/null+++ b/.github/scripts/e2e/test-permissions.ts@@ -0,0 +1,35 @@+import {+ suite, test, summary, screenshot, assertHealthField,+ shortcut, scrape, tree, sleep,+} from "./lib";++suite("permissions");++await test("no permission banner when granted", async () => {+ await shortcut("s", "cmd,ctrl");+ await sleep(2000);+ const result = await scrape();+ const texts: string[] = (result?.data?.items ?? []).map((i: any) => (i.text ?? "").toLowerCase());+ const allText = texts.join(" ");+ const warningKeywords = ["permission", "grant", "missing", "denied", "allow"];+ for (const kw of warningKeywords) {+ if (allText.includes(kw) && (allText.includes("grant") || allText.includes("missing") || allText.includes("denied"))) {+ throw new Error(`permission warning found: "${kw}" in UI text`);+ }+ }+});++await test("screen recording permission", () => assertHealthField("frame_status", "ok"));+await test("microphone permission", () => assertHealthField("audio_status", "ok"));++await test("accessibility permission", async () => {+ const result = await tree();+ if (!result?.success) throw new Error("cannot read accessibility tree");+ const count = result?.data?.element_count ?? 0;+ if (count < 5) throw new Error(`only ${count} elements — accessibility may not be granted`);+});++await screenshot("04-permissions");++const ok = summary();+process.exit(ok ? 0 : 1);diff --git a/.github/scripts/e2e/test-recording.ts b/.github/scripts/e2e/test-recording.tsnew file mode 100644index 000000000..f0800a406--- /dev/null+++ b/.github/scripts/e2e/test-recording.ts@@ -0,0 +1,61 @@+import {+ suite, test, summary, screenshot, assertExists,+ assertHealthField, assertSearchResults, fetchJson,+ waitForHealth, sleep, HEALTH_URL, TIMEOUT_MEDIUM,+} from "./lib";++suite("recording pipeline");++await test("health API up", () => waitForHealth(30));+await test("OCR frames exist", () => assertSearchResults("ocr", 1));+await test("audio chunks exist", () => assertSearchResults("audio", 1));++await test("recent frame timestamp (<5min)", async () => {+ const health = await fetchJson(HEALTH_URL);+ const ts = health.last_frame_timestamp;+ if (!ts) throw new Error("no last_frame_timestamp");+ const age = (Date.now() - new Date(ts).getTime()) / 1000;+ if (age > 300) throw new Error(`frame too old: ${Math.round(age)}s ago`);+});++await test("recent audio timestamp (<2min)", async () => {+ const health = await fetchJson(HEALTH_URL);+ const ts = health.last_audio_timestamp;+ if (!ts) throw new Error("no last_audio_timestamp");+ const age = (Date.now() - new Date(ts).getTime()) / 1000;+ if (age > 120) throw new Error(`audio too old: ${Math.round(age)}s ago`);+});++await test("search returns text", async () => {+ const data = await fetchJson("http://localhost:3030/search?limit=1&content_type=ocr");+ const results = data?.data ?? [];+ if (results.length === 0) throw new Error("no OCR results");+});++await test("monitors detected in health", async () => {+ const health = await fetchJson(HEALTH_URL);+ const details = health.device_status_details ?? "";+ if (!details) throw new Error("no device_status_details");+});++await test("recording state visible in tray", async () => {+ await assertExists("title~:recording");+});++await test("health stays healthy after 10s", async () => {+ await sleep(10_000);+ await assertHealthField("status", "healthy");+});++await test("frames still fresh after wait", async () => {+ const health = await fetchJson(HEALTH_URL);+ const ts = health.last_frame_timestamp;+ if (!ts) throw new Error("no last_frame_timestamp");+ const age = (Date.now() - new Date(ts).getTime()) / 1000;+ if (age > 300) throw new Error(`frame too old: ${Math.round(age)}s ago`);+});++await screenshot("03-recording");++const ok = summary();+process.exit(ok ? 0 : 1);diff --git a/.github/scripts/e2e/test-settings.ts b/.github/scripts/e2e/test-settings.tsnew file mode 100644index 000000000..4aeed1f92--- /dev/null+++ b/.github/scripts/e2e/test-settings.ts@@ -0,0 +1,45 @@+import {+ suite, test, summary, screenshot, assertExists, click,+ shortcut, sleep, TIMEOUT_MEDIUM,+} from "./lib";++suite("settings page");++async function openSettings() {+ await click("role:AXMenuBarItem AND title:screenpipe");+ await sleep(500);+ // "Settings..." (with ellipsis) is the exact menu item title+ await click("role:AXMenuItem AND title:Settings...");+ await sleep(3000);+}++async function navigateTo(label: string) {+ await click(`role:AXStaticText AND name~:${label}`);+ await sleep(1000);+}++async function assertLoaded() {+ await assertExists("role:AXWebArea", TIMEOUT_MEDIUM);+}++await test("open settings", async () => {+ await openSettings();+ await assertLoaded();+});++const sections = ["General", "Recording", "AI", "Shortcuts", "Account", "Disk", "Connections", "Feedback"];+for (const section of sections) {+ await test(`${section.toLowerCase()} section loads`, async () => {+ await navigateTo(section);+ await assertLoaded();+ await screenshot(`settings-${section.toLowerCase()}`);+ });+}++await test("close settings", async () => {+ await shortcut("w", "cmd");+ await sleep(1000);+});++const ok = summary();+process.exit(ok ? 0 : 1);