graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Isolate desktop interaction fixtures from recovered tabs
Rach Pradhan9351ae1e80ab
diff --git a/apps/native/electron/chat-scroll-visual.cjs b/apps/native/electron/chat-scroll-visual.cjsindex cc5d7656..c7acf9ae 100644--- a/apps/native/electron/chat-scroll-visual.cjs+++ b/apps/native/electron/chat-scroll-visual.cjs@@ -12,6 +12,7 @@ async function runChatScroll({ win, origin, output }) {}throw Error(`Chat scroll timed out: ${code}`);};+ await js(`localStorage.removeItem('graff.native.open-tabs.v1')`);await wc.loadURL(origin); win.setSize(1100, 760); testDesktop.present(win);await wait(`!!document.querySelector('[data-workspace-ready="true"] textarea[aria-label="Prompt"]')`);await js(`(() => {diff --git a/apps/native/electron/composer-interaction-visual.cjs b/apps/native/electron/composer-interaction-visual.cjsindex 4c9ec8ba..8d43ea1d 100644--- a/apps/native/electron/composer-interaction-visual.cjs+++ b/apps/native/electron/composer-interaction-visual.cjs@@ -55,6 +55,7 @@ async function runComposerInteractions({ win, origin, output }) {const windowActions = [];ipcMain.handle('window-control', (_event, action) => { windowActions.push(action); });try {+ await js(`localStorage.removeItem('graff.native.open-tabs.v1')`);await wc.loadURL(origin); win.setSize(1440, 900); testDesktop.present(win);await wait(`!!document.querySelector('textarea') && !document.querySelector('[aria-label="Choose model"]').textContent.includes('Loading')`);@@ -307,11 +308,11 @@ async function runComposerInteractions({ win, origin, output }) {await wait(`Array.from(document.querySelectorAll('[data-chat][data-focused="true"] li')).some(e=>e.textContent.includes('A follow-up worth keeping'))`);assert.equal(await draft(split), '', 'Queueing transfers the draft into its queue');fs.writeFileSync(path.join(output, 'composer-interactions.png'), (await wc.capturePage()).toPNG());+ await js('window.galleryBenchmark=false');+ await wait(`!document.querySelector('[data-chat][data-focused="true"] [aria-label="Stop"]') && !document.querySelector('[data-chat][data-focused="true"] [data-queued-prompt]')`);console.log('Composer interactions passed: portaled pointer selection, IME, shortcut ownership, per-chat drafts and uploads, split zoom, independent stop and queue.');} finally {ipcMain.removeHandler('window-control');- await wc.loadURL(origin);- await wait(`!!document.querySelector('textarea')`);}}module.exports = { runComposerInteractions };diff --git a/apps/native/electron/files-recovery-visual.cjs b/apps/native/electron/files-recovery-visual.cjsindex 88638bdf..8b3140df 100644--- a/apps/native/electron/files-recovery-visual.cjs+++ b/apps/native/electron/files-recovery-visual.cjs@@ -22,6 +22,7 @@ async function runFilesRecovery({ win, origin, output }) {const settle = () => js(`new Promise(r=>setTimeout(r,100))`);const focusTab = index => js(`document.querySelectorAll('[aria-label="Close tab"]')[${index}].parentElement.querySelector('button[aria-pressed]').click()`);+ await js(`localStorage.removeItem('graff.native.open-tabs.v1')`);await wc.loadURL(origin);await wait(`!!document.querySelector('button[aria-label="Files"]')`);const firstTab = await js(`document.querySelectorAll('[aria-label="Close tab"]').length`);diff --git a/apps/native/electron/navigation-keyboard-visual.cjs b/apps/native/electron/navigation-keyboard-visual.cjsindex 58f5091f..42d41a41 100644--- a/apps/native/electron/navigation-keyboard-visual.cjs+++ b/apps/native/electron/navigation-keyboard-visual.cjs@@ -23,6 +23,7 @@ async function runNavigationKeyboard({win, origin}) {const modalContainsFocus = () => js(`document.querySelector('[aria-modal="true"]')?.contains(document.activeElement)`);const focusDiagnostic = () => js(`JSON.stringify({hasFocus:document.hasFocus(),active:document.activeElement?.outerHTML.slice(0,2500),modal:document.querySelector('[aria-modal="true"]')?.getAttribute('aria-label')})`);+ await js(`localStorage.removeItem('graff.native.open-tabs.v1')`);await wc.loadURL(origin); testDesktop.present(win);await wait(`!!document.querySelector('[data-workspace-ready="true"] textarea[aria-label="Prompt"]')`);wc.send('desktop-action', 'new');diff --git a/apps/native/electron/navigation-prompt-focus-visual.cjs b/apps/native/electron/navigation-prompt-focus-visual.cjsindex daf2f220..904295eb 100644--- a/apps/native/electron/navigation-prompt-focus-visual.cjs+++ b/apps/native/electron/navigation-prompt-focus-visual.cjs@@ -31,6 +31,7 @@ async function runNavigationPromptFocus({ win, origin }) {await wc.debugger.sendCommand('Page.enable');const { identifier } = await wc.debugger.sendCommand('Page.addScriptToEvaluateOnNewDocument', { source: `(${installGalleryFixture.toString()})();+ localStorage.removeItem('graff.native.open-tabs.v1');const previous=window.fetch;window.fetch=async(input,options)=>{const url=new URL(String(input),location.origin);@@ -49,10 +50,12 @@ async function runNavigationPromptFocus({ win, origin }) {await click(`${sidebar} button[aria-label="Home"]`); await focused(first);for (const keyCode of 'return draft') await testDesktop.testInput(wc, { type: 'char', keyCode });await click(`${sidebar} button[aria-label="New chat"]`);+ await wait(`document.querySelector('[data-chat][data-focused="true"]')?.dataset.chat!=='${first}'`);const second = await active(); assert.notEqual(second, first); await focused(second);await click('[aria-label="Collapse sidebar"]');await wait(`!!document.querySelector('[data-session-navigation="tabs"]')`);await click('[data-workspace-toolbar] button[aria-label="New chat"]');+ await wait(`document.querySelector('[data-chat][data-focused="true"]')?.dataset.chat!=='${second}'`);const third = await active(); assert.notEqual(third, second); await focused(third);await click(tab(first)); await focused(first);assert.deepEqual(await js(`(()=>{const prompt=document.querySelector('[data-chat="${first}"] textarea[aria-label="Prompt"]');return {value:prompt.value,start:prompt.selectionStart,end:prompt.selectionEnd};})()`),@@ -62,8 +65,9 @@ async function runNavigationPromptFocus({ win, origin }) {await click('[aria-label="Expand sidebar"]');await wait(`!!document.querySelector('[data-session-navigation="sidebar"]')`);// A saved conversation moves into the open-chat list once selected.+ const beforeSavedTabs = await js(`document.querySelectorAll('[data-tab-id]').length`);await click(`${sidebar} button[title^="Focus history"]`);- await wait(`!!document.querySelector('[data-continue-snapshot]') || document.querySelectorAll('[data-tab-id]').length===4`);+ await wait(`!!document.querySelector('[data-continue-snapshot]') || document.querySelectorAll('[data-tab-id]').length>${beforeSavedTabs}`);if (await js(`!!document.querySelector('[data-continue-snapshot]')`)) await click('[data-continue-snapshot]');const saved = await active();await click(tab(first));diff --git a/apps/native/electron/projects-visual.cjs b/apps/native/electron/projects-visual.cjsindex 217302ef..04717727 100644--- a/apps/native/electron/projects-visual.cjs+++ b/apps/native/electron/projects-visual.cjs@@ -60,12 +60,14 @@ async function runProjectVisuals({ win, origin, output, pressEnter }) {await wait(`!!document.querySelector('[data-project-path="/demo/folder-42"]')`);await js(`document.querySelector('[data-project-path="/demo/folder-42"] button:last-child').click()`);await wait(`document.querySelector('[data-workspace-trigger] [title]')?.title.includes('/demo/folder-42')`);+ const folder42TabIndex = await js(`Array.from(document.querySelectorAll('[aria-label="Close tab"]')).findIndex(e=>e.parentElement.querySelector('button[aria-pressed]')?.getAttribute('aria-pressed')==='true')`);+ assert.ok(folder42TabIndex >= 0, 'The new project chat has an active tab');assert.equal(await js(`document.querySelectorAll('[aria-label="Close tab"]').length`), before + 1, 'New project chat creates exactly one tab');await js(`document.querySelector('button[aria-label="Projects"]').click()`);await wait(`!!document.querySelector('[data-project-path="/demo/folder-43"]')`);await js(`document.querySelector('[data-project-path="/demo/folder-43"] button:last-child').click()`);await wait(`document.querySelector('[data-workspace-trigger] [title]')?.title.includes('/demo/folder-43')`);- await js(`document.querySelector('[aria-label="Close tab"]').parentElement.querySelector('button[aria-pressed]').click()`);+ await js(`Array.from(document.querySelectorAll('[aria-label="Close tab"]'))[${folder42TabIndex}].parentElement.querySelector('button[aria-pressed]').click()`);await wait(`document.querySelector('[data-workspace-trigger] [title]')?.title.includes('/demo/folder-42')`);await js(`document.querySelector('button[aria-label="New chat"]').click()`);await wait(`document.querySelector('[data-workspace-trigger] [title]')?.title.includes('/demo/folder-42')`);diff --git a/apps/native/electron/split-focus-visual.cjs b/apps/native/electron/split-focus-visual.cjsindex f769bd53..95de45cc 100644--- a/apps/native/electron/split-focus-visual.cjs+++ b/apps/native/electron/split-focus-visual.cjs@@ -86,6 +86,7 @@ async function runSplitFocus({win,origin,output}) {wc.send('desktop-action','close');await wait(`document.querySelectorAll('[data-chat]').length===2`);assert.deepEqual(await ids(),[finalPanes[0],finalPanes[2]],'Native close follows keyboard pane focus even when the text cursor was in another pane');+ await js(`localStorage.removeItem('graff.native.open-tabs.v1')`);await wc.loadURL(origin);await wait(`!!document.querySelector('[data-workspace-ready="true"] textarea[aria-label="Prompt"]')`);console.log('Split interaction passed: native/DOM close routing, stable pointer/keyboard focus, preserved drafts, mouse resizing in both directions, shared toolbar.');}