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 window overlay and MCP integration test suites
Louis Beaumontcb9125f27eed
diff --git a/apps/screenpipe-app-tauri/e2e/tests/mcp-integration.js b/apps/screenpipe-app-tauri/e2e/tests/mcp-integration.jsnew file mode 100644index 000000000..9b028e91c--- /dev/null+++ b/apps/screenpipe-app-tauri/e2e/tests/mcp-integration.js@@ -0,0 +1,165 @@+/**+ * MCP / Claude Integration Tests+ *+ * Covers TESTING.md section 16:+ * - S16.1: Claude connect button works+ * - S16.3: Claude Desktop not installed+ * - S16.4: MCP version display+ * - S16.7: Download error logging+ *+ * Tests MCP-related UI elements and settings.+ * These are proxy tests — actual Claude Desktop integration+ * requires external app installation.+ */++describe('MCP & Claude Integration (S16)', () => {+ const API_BASE = 'http://localhost:3030';++ before(async () => {+ await browser.waitUntil(+ async () => (await browser.execute(() => document.readyState)) === 'complete',+ { timeout: 30000, timeoutMsg: 'app did not load' }+ );++ // Skip onboarding+ try {+ const skipBtn = await $('button*=skip');+ if (await skipBtn.isDisplayed()) {+ await skipBtn.click();+ await browser.pause(500);+ }+ } catch {}+ try {+ const closeBtn = await $('button svg.lucide-x');+ if (await closeBtn.isDisplayed()) {+ await closeBtn.closest('button').click();+ await browser.pause(500);+ }+ } catch {}+ });++ it('should have MCP/Claude UI in settings (S16.1)', async () => {+ await browser.execute(() => { window.location.href = '/settings'; });+ await browser.pause(2000);++ // Look for MCP or Claude references across all settings sections+ const sections = ['general', 'connections', 'ai'];+ let mcpFound = false;++ for (const section of sections) {+ await browser.execute((s) => {+ const els = document.querySelectorAll('a, button');+ for (const el of els) {+ if (el.textContent.toLowerCase().includes(s)) {+ el.click();+ break;+ }+ }+ }, section);+ await browser.pause(800);++ const text = await browser.execute(() => document.body.innerText.toLowerCase());+ if (text.includes('mcp') || text.includes('claude') ||+ text.includes('connect') || text.includes('integration')) {+ mcpFound = true;+ console.log(`MCP/Claude UI found in ${section} section`);+ break;+ }+ }++ if (!mcpFound) {+ console.log('Warning: MCP/Claude UI not found in settings');+ }++ const bodyText = await browser.execute(() => document.body.innerText);+ expect(bodyText).not.toContain('Unhandled Runtime Error');+ });++ it('should handle Claude not installed gracefully (S16.3)', async () => {+ // If there's a "connect to Claude" button, clicking it should+ // show a helpful message when Claude Desktop is not installed+ const result = await browser.execute(() => {+ const buttons = document.querySelectorAll('button');+ for (const btn of buttons) {+ const text = btn.textContent.toLowerCase();+ if (text.includes('claude') || text.includes('mcp') || text.includes('connect')) {+ // Don't actually click — just verify the button exists+ return { found: true, text: btn.textContent.trim() };+ }+ }+ return { found: false };+ });++ if (result.found) {+ console.log(`Found MCP button: "${result.text}"`);+ } else {+ console.log('No MCP connect button found (may be in different section)');+ }++ // App should be stable regardless+ const ready = await browser.execute(() => document.readyState);+ expect(ready).toBe('complete');+ });++ it('should show version info (S16.4)', async () => {+ // Check if version is displayed in settings or about section+ await browser.execute(() => { window.location.href = '/settings'; });+ await browser.pause(1000);++ const versionInfo = await browser.execute(() => {+ const text = document.body.innerText;+ // Look for version pattern like v0.1.0 or 0.1.0+ const match = text.match(/v?\d+\.\d+\.\d+/);+ return {+ found: !!match,+ version: match ? match[0] : null,+ };+ });++ if (versionInfo.found) {+ console.log(`Version found: ${versionInfo.version}`);+ } else {+ console.log('Version string not found in settings page');+ }+ });++ it('should not crash accessing pipes endpoint (S16)', async () => {+ const result = await browser.execute(async (base) => {+ try {+ const res = await fetch(`${base}/pipes/list`);+ const data = await res.json();+ return {+ status: res.status,+ ok: res.ok,+ hasError: !!data.error,+ error: data.error || null,+ };+ } catch (e) {+ return { status: 0, ok: false, error: e.message };+ }+ }, API_BASE);++ // Pipes may be disabled, but should not crash+ expect(result.status).not.toBe(500);+ console.log(`Pipes endpoint: status=${result.status}, error=${result.error || 'none'}`);+ });++ it('should handle error logging without crash (S16.7)', async () => {+ // Verify console doesn't have uncaught MCP-related errors+ const logs = await browser.getLogs('browser');+ const mcpErrors = logs.filter(log =>+ log.level === 'SEVERE' &&+ (log.message.toLowerCase().includes('mcp') ||+ log.message.toLowerCase().includes('claude'))+ );++ if (mcpErrors.length > 0) {+ console.log(`Found ${mcpErrors.length} MCP-related console error(s):`);+ mcpErrors.forEach(e => console.log(` ${e.message.slice(0, 100)}`));+ } else {+ console.log('No MCP-related console errors');+ }++ // Don't fail — just report+ });+});diff --git a/apps/screenpipe-app-tauri/e2e/tests/window-overlay.js b/apps/screenpipe-app-tauri/e2e/tests/window-overlay.jsnew file mode 100644index 000000000..e70fc0b51--- /dev/null+++ b/apps/screenpipe-app-tauri/e2e/tests/window-overlay.js@@ -0,0 +1,183 @@+/**+ * Window Overlay & Focus Tests+ *+ * Covers TESTING.md section 1:+ * - S1.12: Keyboard focus in overlay+ * - S1.13: Keyboard focus in chat+ * - S1.17: Screen recording visibility setting+ * - S1.18: Search panel focus+ * - S1.19: Ghost clicks after hide+ * - S1.20: Pinch-to-zoom works+ *+ * Tests overlay-related behavior through the WebView DOM.+ */++describe('Window Overlay & Focus (S1)', () => {+ before(async () => {+ await browser.waitUntil(+ async () => (await browser.execute(() => document.readyState)) === 'complete',+ { timeout: 30000, timeoutMsg: 'app did not load' }+ );++ // Skip onboarding+ try {+ const skipBtn = await $('button*=skip');+ if (await skipBtn.isDisplayed()) {+ await skipBtn.click();+ await browser.pause(500);+ }+ } catch {}+ try {+ const closeBtn = await $('button svg.lucide-x');+ if (await closeBtn.isDisplayed()) {+ await closeBtn.closest('button').click();+ await browser.pause(500);+ }+ } catch {}++ await browser.pause(2000);+ });++ it('should have focusable elements in main view (S1.12)', async () => {+ // Verify that interactive elements can receive focus+ const hasFocusable = await browser.execute(() => {+ const focusable = document.querySelectorAll(+ 'button, input, textarea, a[href], [tabindex]'+ );+ return focusable.length > 0;+ });+ expect(hasFocusable).toBe(true);+ });++ it('should handle Tab key for focus navigation (S1.12)', async () => {+ // Press Tab multiple times — should not crash+ for (let i = 0; i < 5; i++) {+ await browser.keys(['Tab']);+ await browser.pause(200);+ }++ const ready = await browser.execute(() => document.readyState);+ expect(ready).toBe('complete');++ // Check that something is focused+ const hasFocus = await browser.execute(() => {+ return document.activeElement !== null &&+ document.activeElement !== document.body;+ });+ // May or may not have focus depending on UI — just verify no crash+ });++ it('should have search input accessible (S1.18)', async () => {+ // Look for search input in the UI+ const searchElements = await browser.execute(() => {+ const inputs = document.querySelectorAll('input[type="text"], input[type="search"], input[placeholder*="search" i]');+ return inputs.length;+ });++ if (searchElements > 0) {+ console.log(`Found ${searchElements} search input(s)`);+ } else {+ // Search may be triggered by keyboard shortcut+ console.log('No visible search input — may need shortcut to open');+ }++ const ready = await browser.execute(() => document.readyState);+ expect(ready).toBe('complete');+ });++ it('should not have ghost click issues after navigation (S1.19)', async () => {+ // Navigate away and back — verify no stale event handlers fire+ await browser.execute(() => { window.location.href = '/settings'; });+ await browser.pause(1000);+ await browser.execute(() => { window.location.href = '/'; });+ await browser.pause(1000);++ // Click on body — should not trigger unexpected navigation or errors+ await browser.execute(() => {+ document.body.click();+ });+ await browser.pause(500);++ const bodyText = await browser.execute(() => document.body.innerText);+ expect(bodyText).not.toContain('Unhandled Runtime Error');+ });++ it('should support zoom/scale without crash (S1.20)', async () => {+ // Test CSS zoom/transform doesn't break layout+ const result = await browser.execute(() => {+ try {+ // Simulate zoom by changing viewport meta or CSS transform+ document.body.style.transform = 'scale(1.5)';+ const ready1 = document.readyState;+ document.body.style.transform = '';+ const ready2 = document.readyState;+ return { ready1, ready2, ok: true };+ } catch (e) {+ return { ok: false, error: e.message };+ }+ });++ expect(result.ok).toBe(true);++ const bodyText = await browser.execute(() => document.body.innerText);+ expect(bodyText).not.toContain('Unhandled Runtime Error');+ });++ it('should handle rapid keyboard input (S1.12)', async () => {+ // Type rapidly — should not crash+ await browser.keys(['a', 'b', 'c', 'Escape', 'ArrowLeft', 'ArrowRight']);+ await browser.pause(500);++ const ready = await browser.execute(() => document.readyState);+ expect(ready).toBe('complete');+ });++ it('should not have stale event listeners after reload (S1.19)', async () => {+ // Reload and check for proper cleanup+ await browser.execute(() => { window.location.reload(); });+ await browser.pause(3000);++ // Verify DOM is clean+ const eventInfo = await browser.execute(() => {+ return {+ ready: document.readyState,+ bodyChildren: document.body.children.length,+ hasRoot: !!document.getElementById('root') || !!document.getElementById('__next'),+ };+ });++ expect(eventInfo.ready).toBe('complete');+ expect(eventInfo.bodyChildren).toBeGreaterThan(0);+ });++ it('should handle visibility change events (S1.7-8)', async () => {+ // Simulate visibility change (like switching tabs/windows)+ const result = await browser.execute(() => {+ try {+ const event = new Event('visibilitychange');+ document.dispatchEvent(event);+ const focusEvent = new Event('focus');+ window.dispatchEvent(focusEvent);+ const blurEvent = new Event('blur');+ window.dispatchEvent(blurEvent);+ window.dispatchEvent(focusEvent); // bring back focus+ return { ok: true };+ } catch (e) {+ return { ok: false, error: e.message };+ }+ });++ expect(result.ok).toBe(true);++ await browser.pause(500);+ const ready = await browser.execute(() => document.readyState);+ expect(ready).toBe('complete');+ });++ it('should have correct document title (S1)', async () => {+ const title = await browser.execute(() => document.title);+ // App should have some title set+ expect(title).toBeTruthy();+ console.log(`Document title: "${title}"`);+ });+});