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
add data-test-ids and negative path tests
Anshgrover23d2f088ce3d15
diff --git a/apps/screenpipe-app-tauri/app/home/page.tsx b/apps/screenpipe-app-tauri/app/home/page.tsxindex aea97b29f..8b1c891be 100644--- a/apps/screenpipe-app-tauri/app/home/page.tsx+++ b/apps/screenpipe-app-tauri/app/home/page.tsx@@ -789,6 +789,7 @@ function SettingsPageContent() {{appGroup.map((section) => (<buttonkey={section.id}+ data-testid={`settings-nav-${section.id}`}onClick={() => {setModalSection(section.id);setActiveSection(section.id);@@ -823,6 +824,7 @@ function SettingsPageContent() {{dataGroup.map((section) => (<buttonkey={section.id}+ data-testid={`settings-nav-${section.id}`}onClick={() => {setModalSection(section.id);setActiveSection(section.id);@@ -857,6 +859,7 @@ function SettingsPageContent() {{accountGroup.map((section) => (<buttonkey={section.id}+ data-testid={`settings-nav-${section.id}`}onClick={() => {setModalSection(section.id);setActiveSection(section.id);diff --git a/apps/screenpipe-app-tauri/components/pipe-store.tsx b/apps/screenpipe-app-tauri/components/pipe-store.tsxindex d174832ee..7b54756a5 100644--- a/apps/screenpipe-app-tauri/components/pipe-store.tsx+++ b/apps/screenpipe-app-tauri/components/pipe-store.tsx@@ -336,6 +336,7 @@ export function PipeStoreView() {{tabs.map(({ key, label }) => (<buttonkey={key}+ data-testid={`tab-${key}`}onClick={() => setActiveTab(key)}className={cn("pb-3 text-sm font-medium transition-colors duration-150 border-b-2 -mb-px",@@ -836,6 +837,7 @@ function PipeCard({return (<div+ data-testid={`pipe-card-${pipe.slug}`}onClick={onClick}className="border border-border bg-card hover:bg-accent/50 transition-colors duration-150 rounded-none p-5 cursor-pointer group flex flex-col">@@ -846,6 +848,7 @@ function PipeCard({</div><Buttonsize="sm"+ data-testid="pipe-install-btn"variant={isInstalled && !hasUpdate ? "outline" : "default"}className={cn("h-7 px-3 text-xs font-semibold rounded-none uppercase tracking-wide flex-shrink-0",diff --git a/apps/screenpipe-app-tauri/components/ui/toaster.tsx b/apps/screenpipe-app-tauri/components/ui/toaster.tsxindex e2233852a..dcbd54a82 100644--- a/apps/screenpipe-app-tauri/components/ui/toaster.tsx+++ b/apps/screenpipe-app-tauri/components/ui/toaster.tsx@@ -18,7 +18,10 @@ export function Toaster() {{toasts.map(function ({ id, title, description, action, ...props }) {return (<Toast key={id} {...props}>- <div className="grid gap-1">+ <div+ className="grid gap-1"+ data-testid={props.variant === "destructive" ? "toast-error" : "toast-success"}+ >{title && <ToastTitle>{title}</ToastTitle>}{description && (<ToastDescription>{description}</ToastDescription>diff --git a/apps/screenpipe-app-tauri/e2e/specs/pipes.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/pipes.spec.tsindex 72e0d68ad..5ff860a9d 100644--- a/apps/screenpipe-app-tauri/e2e/specs/pipes.spec.ts+++ b/apps/screenpipe-app-tauri/e2e/specs/pipes.spec.ts@@ -8,17 +8,16 @@ import { saveScreenshot } from '../helpers/screenshot-utils.js';/*** Pipes: Discover → Install (no-connection pipe) → Play+ * + negative paths: install failure, connection-required modal, cleanup*- * Full happy-path test for the Pipes section on Windows:- * 1. Navigate to Pipes section- * 2. Switch to the Discover tab- * 3. Find the first store pipe that requires NO connections, click GET- * → app auto-switches to My Pipes tab (onInstalled callback)- * 4. Confirm the pipe row is visible in My Pipes list- * 5. Scroll + hover the pipe row to reveal the play button, then click it+ * Selectors use data-testid throughout — no text matching that breaks on copy change.+ * pipe-store.tsx → data-testid="tab-{key}" on tab buttons+ * → data-testid="pipe-card-{slug}" on each card div+ * → data-testid="pipe-install-btn" on the GET/INSTALLED button*/let installedPipeName = '';+let connectionPipeSlug = '';describe('Pipes: discover → install → play', function () {this.timeout(120_000);@@ -28,6 +27,18 @@ describe('Pipes: discover → install → play', function () {await openHomeWindow();});+ after(async () => {+ // Cleanup: uninstall the pipe so state doesn't leak to the next run+ if (installedPipeName) {+ try {+ await fetch(`http://localhost:3030/pipes/${installedPipeName}`, { method: 'DELETE' });+ console.log(`[pipes-spec] cleaned up pipe "${installedPipeName}"`);+ } catch {+ // best-effort+ }+ }+ });+// ─── Step 1: open Pipes section ───────────────────────────────────────────it('navigates to Pipes section', async () => {@@ -42,35 +53,165 @@ describe('Pipes: discover → install → play', function () {expect(existsSync(filepath)).toBe(true);});- // ─── Step 2: switch to Discover tab ──────────────────────────────────────+ // ─── Step 2: switch to Discover tab (data-testid, not text) ──────────────it('switches to the Discover tab', async () => {- const discoverTab = await $('button=Discover');+ const discoverTab = await $('[data-testid="tab-discover"]');await discoverTab.waitForExist({ timeout: 8_000 });await discoverTab.click();- // Wait for at least one GET button to appear (pipe grid loaded)+ // Wait for at least one install button to appear in the gridawait browser.waitUntil(async () => {- const btns = await $$('button=GET');- return btns.length > 0;+ return await $$('[data-testid="pipe-install-btn"]').length > 0;},- { timeout: 20_000, timeoutMsg: 'Discover tab: no GET buttons appeared (store grid not loaded)' }+ { timeout: 20_000, timeoutMsg: 'Discover tab: no pipe-install-btn appeared (store grid not loaded)' });const filepath = await saveScreenshot('pipes-discover-tab');expect(existsSync(filepath)).toBe(true);});+ // ─── Negative: install a non-existent slug → UI shows error, no crash ────++ it('shows an error toast when install fails, does not crash', async () => {+ // Intercept window.fetch so any POST to /pipes/store/install returns 503.+ // This triggers React's handleInstall catch block which calls+ // toast({ variant: "destructive" }) — testing the actual UI error path,+ // not just the backend API.+ await browser.execute(() => {+ const orig = window.fetch.bind(window);+ (window as any).__origFetch = orig;+ window.fetch = (input: RequestInfo | URL, init?: RequestInit) => {+ if (String(input).includes('/pipes/store/install')) {+ return Promise.resolve(+ new Response(JSON.stringify({ error: 'store unavailable (e2e simulated)' }), {+ status: 503,+ headers: { 'Content-Type': 'application/json' },+ })+ );+ }+ return orig(input, init);+ };+ });++ try {+ // Wait for the Discover grid to be populated — the store API must be+ // reachable for this test. Hard-fail if it isn't: that signals an+ // infrastructure problem, not a code problem.+ await browser.waitUntil(+ async () => (await $$('[data-testid="pipe-install-btn"]').length) > 0,+ { timeout: 15_000, timeoutMsg: 'No pipe-install-btn found — store API unreachable or Discover grid not loaded' }+ );++ // Click any GET button — interceptor makes it fail inside handleInstall+ const anyGetBtn = await $('[data-testid="pipe-install-btn"]');+ await anyGetBtn.click();++ // handleInstall catches the 503 and calls toast({ variant: "destructive" }).+ // toaster.tsx sets data-testid="toast-error" on the inner <div> for+ // destructive toasts. NOTE: requires a fresh binary build after toaster.tsx+ // changes — the binary embeds frontend assets at compile time.+ const toastError = await $('[data-testid="toast-error"]');+ await toastError.waitForExist({ timeout: 8_000 });++ // App must still be alive after the error — verify the Discover tab+ // content is intact. section-pipes is only mounted on the my-pipes tab+ // so we check the tab bar instead (always in DOM on the pipes page).+ const discoverTab = await $('[data-testid="tab-discover"]');+ expect(await discoverTab.isExisting()).toBe(true);++ await saveScreenshot('pipes-install-error');+ } finally {+ // Restore fetch regardless of pass/fail so subsequent tests are clean+ await browser.execute(() => {+ if ((window as any).__origFetch) {+ window.fetch = (window as any).__origFetch;+ delete (window as any).__origFetch;+ }+ });+ }+ });++ // ─── Negative: pipe that requires connections → modal appears, no auto-run++ it('shows connection modal for a pipe that requires connections', async () => {+ // Find a pipe whose permissions.allow_connections === true+ const connSlug: string | null = await browser.executeAsync((done: (v: string | null) => void) => {+ fetch('http://localhost:3030/pipes/store?sort=popular')+ .then((r) => r.json())+ .then((json) => {+ const list: any[] = Array.isArray(json) ? json : (json.data || json.pipes || []);+ const pipe = list.find((p: any) => p.permissions?.allow_connections === true);+ done(pipe ? (pipe.slug as string) : null);+ })+ .catch(() => done(null));+ });++ if (!connSlug) {+ // No connection-required pipe in current store — skip gracefully+ console.log('[pipes-spec] no connection-required pipe found, skipping modal test');+ return;+ }++ connectionPipeSlug = connSlug;+ console.log(`[pipes-spec] connection-required pipe: "${connSlug}"`);++ // Click the install button on that specific card+ const card = await $(`[data-testid="pipe-card-${connSlug}"]`);+ if (!(await card.isExisting())) {+ // Card may not be in the current viewport/page — skip+ console.log('[pipes-spec] connection pipe card not visible in current view, skipping');+ return;+ }++ const installBtn = await card.$('[data-testid="pipe-install-btn"]');+ const btnText = await installBtn.getText();++ // Only proceed if it's actually a GET (not already installed)+ if (btnText.trim() !== 'GET') {+ console.log('[pipes-spec] connection pipe already installed, skipping modal test');+ return;+ }++ await installBtn.click();++ // After install, the connection modal OR "My Pipes" tab should appear.+ // Either the modal opens (PostInstallConnectionsModal) or the tab switches.+ // The modal renders a dialog with role="dialog" or an element containing "connections".+ await browser.waitUntil(+ async () => {+ const body = (await browser.execute(() => document.body.innerText || '')) as string;+ // Modal copy mentions "connection" or "setup"; My Pipes tab shows "scheduled"+ return body.toLowerCase().includes('connection') || body.includes('scheduled');+ },+ { timeout: 15_000, timeoutMsg: 'Connection modal or My Pipes tab did not appear after installing connection-required pipe' }+ );++ await saveScreenshot('pipes-connection-modal');++ // Clean up: delete the pipe if it was installed+ await browser.executeAsync((slug: string, done: () => void) => {+ fetch(`http://localhost:3030/pipes/${slug}`, { method: 'DELETE' })+ .catch(() => {})+ .finally(() => done());+ }, connSlug);+ });+// ─── Step 3: find a no-connection pipe, click GET ─────────────────────────- // After clicking GET the app installs the pipe and onInstalled() auto-switches- // to My Pipes tab — we never see the "INSTALLED" badge, that's expected.it('finds a pipe with no connections requirement, clicks GET, auto-switches to My Pipes', async () => {- // Use browser.execute with a synchronous return so we avoid the async- // Promise-serialisation bug (browser.execute(async fn) returns [object Object]).- // We start the fetch then poll for the result.- const slug: string | null = await browser.executeAsync((done: (result: string | null) => void) => {+ // Switch back to Discover tab (previous test may have left us on My Pipes)+ const discoverTab = await $('[data-testid="tab-discover"]');+ if (await discoverTab.isExisting()) {+ await discoverTab.click();+ await browser.waitUntil(+ async () => await $$('[data-testid="pipe-install-btn"]').length > 0,+ { timeout: 15_000 }+ );+ }++ const slug: string | null = await browser.executeAsync((done: (v: string | null) => void) => {fetch('http://localhost:3030/pipes/store?sort=popular').then((r) => r.json()).then((json) => {@@ -87,38 +228,27 @@ describe('Pipes: discover → install → play', function () {.catch(() => done(null));});- expect(slug).not.toBeNull();- console.log(`[pipes-spec] installing pipe slug: "${slug}"`);-- // slug IS the installed pipe name (backend returns data.name || slug, they match)- installedPipeName = slug!;-- // Click the GET button on the matching card (match by h4 title that includes slug)- const clicked = await browser.execute((targetSlug: string) => {- // Find a card whose h4 text matches or contains the slug (titles may be capitalised)- const allCards = Array.from(document.querySelectorAll<HTMLElement>('div.border'));- for (const card of allCards) {- const h4 = card.querySelector('h4');- const cardText = h4?.textContent?.toLowerCase() ?? '';- const slugNorm = targetSlug.toLowerCase().replace(/-/g, ' ');- if (cardText.includes(slugNorm) || cardText.replace(/\s+/g, '-').includes(targetSlug.toLowerCase())) {- const getBtn = Array.from(card.querySelectorAll<HTMLButtonElement>('button')).find(- (b) => b.textContent?.trim() === 'GET' && !b.disabled- );- if (getBtn) { getBtn.click(); return true; }- }- }- // Fallback: click the first enabled GET button on the page- const fallback = Array.from(document.querySelectorAll<HTMLButtonElement>('button')).find(- (b) => b.textContent?.trim() === 'GET' && !b.disabled- );- if (fallback) { fallback.click(); return true; }- return false;- }, slug!);+ // Hard fail — no fallback to a random pipe+ if (!slug) throw new Error('No no-connection pipe found in store; cannot proceed');+ console.log(`[pipes-spec] installing: "${slug}"`);+ installedPipeName = slug;++ // Find the specific card by slug testid and click its install button+ const card = await $(`[data-testid="pipe-card-${slug}"]`);+ await card.waitForExist({ timeout: 8_000 });+ await card.scrollIntoView({ block: 'center' });++ const installBtn = await card.$('[data-testid="pipe-install-btn"]');+ await installBtn.waitForExist({ timeout: 5_000 });++ const btnText = await installBtn.getText();+ if (btnText.trim() !== 'GET') {+ throw new Error(`Expected GET button but found "${btnText}" for pipe "${slug}" — already installed?`);+ }- expect(clicked).toBe(true);+ await installBtn.click();- // Wait for My Pipes tab content — PipesSection renders "scheduled (N)" sub-tabs+ // After GET click the app auto-switches to My Pipes (onInstalled callback)await browser.waitUntil(async () => {const text = (await browser.execute(() => document.body.innerText || '')) as string;@@ -131,19 +261,17 @@ describe('Pipes: discover → install → play', function () {expect(existsSync(filepath)).toBe(true);});- // ─── Step 4: confirm pipe row is listed ──────────────────────────────────+ // ─── Step 4: confirm pipe row is visible in My Pipes ─────────────────────it('shows the installed pipe in My Pipes list', async () => {- // The pipe row button text == pipe.config.name == slug- // It could be under "scheduled" or "manual" sub-tab; try both.- const foundInCurrent = await browser.execute((name: string) => {+ const found = await browser.execute((name: string) => {return Array.from(document.querySelectorAll<HTMLButtonElement>('button')).some((b) => b.textContent?.trim() === name);}, installedPipeName);- if (!foundInCurrent) {- // Switch to manual sub-tab and retry- const manualTab = await $('button*=manual');+ if (!found) {+ // Try manual sub-tab+ const manualTab = await $('[data-testid="tab-my-pipes"] ~ * button*=manual, button*=manual');if (await manualTab.isExisting()) {await manualTab.click();await browser.pause(500);@@ -164,27 +292,21 @@ describe('Pipes: discover → install → play', function () {expect(existsSync(filepath)).toBe(true);});- // ─── Step 5: hover the pipe row to reveal the play button, then click ────- // The play button has `opacity-0 group-hover:opacity-100`. We must move the- // mouse cursor over the row so the hover state activates, then click the button.+ // ─── Step 5: hover the row to reveal play button, click it ───────────────it('plays the installed pipe', async () => {- // Find the pipe row element via its name button- const pipeNameBtnEl = await $(`button=${installedPipeName}`);- await pipeNameBtnEl.waitForExist({ timeout: 8_000 });+ const pipeNameBtn = await $(`button=${installedPipeName}`);+ await pipeNameBtn.waitForExist({ timeout: 8_000 });- // Scroll the row into view so moveTo() works reliably- await pipeNameBtnEl.scrollIntoView({ block: 'center', inline: 'center' });+ await pipeNameBtn.scrollIntoView({ block: 'center', inline: 'center' });await browser.pause(200);- // Move cursor to the row — triggers CSS group-hover, reveals play button- await pipeNameBtnEl.moveTo();- await browser.pause(400); // wait for opacity transition (150ms in CSS)+ // Hover to trigger group-hover CSS → opacity-0 → opacity-100 on play button+ await pipeNameBtn.moveTo();+ await browser.pause(400);- // Click the now-visible play button inside the same group divconst played = await browser.execute((name: string) => {- const allBtns = Array.from(document.querySelectorAll<HTMLButtonElement>('button'));- for (const nameBtn of allBtns) {+ for (const nameBtn of Array.from(document.querySelectorAll<HTMLButtonElement>('button'))) {if (nameBtn.textContent?.trim() !== name) continue;const row = nameBtn.closest<HTMLElement>('div.group');if (!row) continue;@@ -194,19 +316,15 @@ describe('Pipes: discover → install → play', function () {return true;}}- // Fallback: any run-pipe button on the page- const any = document.querySelector<HTMLButtonElement>('button[title="run pipe"]');- if (any && !any.disabled) { any.click(); return true; }return false;}, installedPipeName);+ // No fallback — if we can't find the play button for the installed pipe, fail explicitlyexpect(played).toBe(true);- // Wait for running state: stop button appears, or body text contains "running"await browser.waitUntil(async () => {- const stopBtns = await $$('button[title="stop pipe"]');- if (stopBtns.length > 0) return true;+ if (await $$('button[title="stop pipe"]').length > 0) return true;const body = (await browser.execute(() => document.body.innerText || '')) as string;return body.toLowerCase().includes('running');},diff --git a/apps/screenpipe-app-tauri/e2e/specs/settings-sections.spec.ts b/apps/screenpipe-app-tauri/e2e/specs/settings-sections.spec.tsindex b62eb2763..2796a9ac1 100644--- a/apps/screenpipe-app-tauri/e2e/specs/settings-sections.spec.ts+++ b/apps/screenpipe-app-tauri/e2e/specs/settings-sections.spec.ts@@ -9,25 +9,26 @@ import { saveScreenshot } from '../helpers/screenshot-utils.js';/*** Settings Sections E2E*- * Covers the key settings subsections that users rely on most:- * - General (landing section after clicking Settings nav)- * - Recording (capture FPS, monitor/mic selection)- * - AI (model presets)- * - Speakers (speaker identification)+ * Covers the key settings subsections using data-testid selectors so copy+ * changes never break the tests.*- * Windows-specific: verifies each section mounts without a JS crash, which- * has historically regressed on Windows due to COM / DPI issues (TESTING.md §14).+ * home/page.tsx → data-testid="settings-nav-{section.id}" on every sidebar button+ *+ * Happy paths:+ * - General, Recording, AI, Speakers all mount without a crash+ *+ * Negative paths:+ * - Backend unreachable: Settings sections show graceful fallback, no white crash+ * - Rapid navigation: clicking all sections quickly must not leave a blank page*/-/** Click the Settings nav button and wait for the general settings section. */+/** Click nav-settings, wait for section-settings-general to mount. */async function openSettings(): Promise<void> {const navSettings = await $('[data-testid="nav-settings"]');- await navSettings.waitForExist({ timeout: 10000 });+ await navSettings.waitForExist({ timeout: 10_000 });await navSettings.click();- await browser.pause(500);-const generalSection = await $('[data-testid="section-settings-general"]');- await generalSection.waitForExist({ timeout: 8000 });+ await generalSection.waitForExist({ timeout: 8_000 });}describe('Settings sections', () => {@@ -37,93 +38,124 @@ describe('Settings sections', () => {await openSettings();});+ // ─── Happy paths ──────────────────────────────────────────────────────────+it('renders General settings without a crash', async () => {const section = await $('[data-testid="section-settings-general"]');- await section.waitForExist({ timeout: 5000 });+ await section.waitForExist({ timeout: 5_000 });- // No runtime crash banner- const bodyText = await browser.execute(() => document.body.innerText || '');- expect(bodyText).not.toContain('Unhandled Runtime Error');+ const body = (await browser.execute(() => document.body.innerText || '')) as string;+ expect(body).not.toContain('Unhandled Runtime Error');const filepath = await saveScreenshot('settings-general');expect(existsSync(filepath)).toBe(true);});it('navigates to Recording settings and renders capture controls', async () => {- // The settings sidebar uses text links/buttons — find "recording" entry- await browser.execute(() => {- const els = Array.from(document.querySelectorAll('button, a'));- const el = els.find(- (e) =>- e.textContent?.toLowerCase().includes('recording') &&- !e.closest('[data-testid="nav-settings"]')- ) as HTMLElement | undefined;- el?.click();- });- await browser.pause(1000);+ const navRecording = await $('[data-testid="settings-nav-recording"]');+ await navRecording.waitForExist({ timeout: 8_000 });+ await navRecording.click();+ await browser.pause(800);- // Recording section should mention FPS, monitor, or capture- const pageText = (await browser.execute(() => document.body.innerText.toLowerCase())) as string;- const hasRecordingContent =- pageText.includes('fps') ||- pageText.includes('monitor') ||- pageText.includes('capture') ||- pageText.includes('recording');- expect(hasRecordingContent).toBe(true);+ const body = (await browser.execute(() => document.body.innerText.toLowerCase())) as string;+ const hasContent = body.includes('fps') || body.includes('monitor') ||+ body.includes('capture') || body.includes('recording');+ expect(hasContent).toBe(true);const filepath = await saveScreenshot('settings-recording');expect(existsSync(filepath)).toBe(true);});it('navigates to AI settings and renders model/preset controls', async () => {- await browser.execute(() => {- const els = Array.from(document.querySelectorAll('button, a'));- const el = els.find(- (e) =>- (e.textContent?.toLowerCase().includes('ai') ||- e.textContent?.toLowerCase().includes('model')) &&- !e.closest('[data-testid="nav-settings"]')- ) as HTMLElement | undefined;- el?.click();- });- await browser.pause(1000);+ const navAi = await $('[data-testid="settings-nav-ai"]');+ await navAi.waitForExist({ timeout: 8_000 });+ await navAi.click();+ await browser.pause(800);- const pageText = (await browser.execute(() => document.body.innerText.toLowerCase())) as string;- const hasAiContent =- pageText.includes('model') ||- pageText.includes('preset') ||- pageText.includes('openai') ||- pageText.includes('ollama') ||- pageText.includes('api key');- expect(hasAiContent).toBe(true);+ const body = (await browser.execute(() => document.body.innerText.toLowerCase())) as string;+ const hasContent = body.includes('model') || body.includes('preset') ||+ body.includes('openai') || body.includes('ollama') || body.includes('api key');+ expect(hasContent).toBe(true);const filepath = await saveScreenshot('settings-ai');expect(existsSync(filepath)).toBe(true);});- it('navigates to Speakers settings section', async () => {- await browser.execute(() => {- const els = Array.from(document.querySelectorAll('button, a'));- const el = els.find((e) =>- e.textContent?.toLowerCase().includes('speaker')- ) as HTMLElement | undefined;- el?.click();- });- await browser.pause(1000);+ it('navigates to Speakers settings and mounts section container', async () => {+ const navSpeakers = await $('[data-testid="settings-nav-speakers"]');+ await navSpeakers.waitForExist({ timeout: 8_000 });+ await navSpeakers.click();- // The speakers section has its own data-testidconst speakersSection = await $('[data-testid="section-settings-speakers"]');- await speakersSection.waitForExist({ timeout: 6000 });+ await speakersSection.waitForExist({ timeout: 6_000 });const filepath = await saveScreenshot('settings-speakers');expect(existsSync(filepath)).toBe(true);});- it('page stays crash-free after navigating all sections (Windows COM/DPI regression)', async () => {- // Re-open settings to ensure the page is still stable- await openSettings();- const bodyText = await browser.execute(() => document.body.innerText || '');- expect(bodyText).not.toContain('Unhandled Runtime Error');- expect(bodyText).not.toContain('Application error');+ // ─── Negative: rapid navigation must not crash ────────────────────────────++ it('survives rapid section switching without a blank crash (Windows COM/DPI regression)', async () => {+ // Click through every section quickly — this has historically caused a white+ // blank render on Windows due to COM apartment threading issues (TESTING.md §14).+ const sectionIds = ['general', 'recording', 'ai', 'display', 'shortcuts', 'speakers', 'privacy', 'storage'];+ for (const id of sectionIds) {+ const btn = await $(`[data-testid="settings-nav-${id}"]`);+ if (await btn.isExisting()) {+ await btn.click();+ await browser.pause(150);+ }+ }++ // After rapid nav, go back to general and assert no crash+ const navGeneral = await $('[data-testid="settings-nav-general"]');+ await navGeneral.click();+ await browser.pause(500);++ const body = (await browser.execute(() => document.body.innerText || '')) as string;+ expect(body).not.toContain('Unhandled Runtime Error');+ expect(body).not.toContain('Application error');++ await saveScreenshot('settings-rapid-nav');+ });++ // ─── Negative: backend health check failure → graceful degradation ────────++ it('page stays alive and crash-free after a failed backend API call', async () => {+ // We cannot kill the screenpipe backend in e2e, but we can verify the UI+ // does not white-screen when a fetch returns non-200. Intercept fetch to+ // return 503 for the health endpoint, then confirm settings is still rendered.+ await browser.execute(() => {+ const orig = window.fetch.bind(window);+ (window as any).__origFetch = orig;+ window.fetch = (input: RequestInfo | URL, init?: RequestInit) => {+ if (String(input).includes('/health')) {+ return Promise.resolve(new Response('{}', { status: 503 }));+ }+ return orig(input, init);+ };+ });++ try {+ // Re-navigate to general settings to trigger a health fetch under the interceptor+ const navGeneral = await $('[data-testid="settings-nav-general"]');+ await navGeneral.click();+ await browser.pause(600);++ const body = (await browser.execute(() => document.body.innerText || '')) as string;+ expect(body).not.toContain('Unhandled Runtime Error');+ expect(body).not.toContain('Application error');++ // Settings section must still be in the DOM — no blank white crash+ const section = await $('[data-testid="section-settings-general"]');+ expect(await section.isExisting()).toBe(true);+ } finally {+ await browser.execute(() => {+ if ((window as any).__origFetch) {+ window.fetch = (window as any).__origFetch;+ delete (window as any).__origFetch;+ }+ });+ }});});