Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

test: wait for stable tab pointer targets and capture renderer failures

Rach Pradhan5f2838e99fe8
diff --git a/apps/native/electron/saved-session-visual.cjs b/apps/native/electron/saved-session-visual.cjs
index fad6a511..20186e64 100644
--- a/apps/native/electron/saved-session-visual.cjs
+++ b/apps/native/electron/saved-session-visual.cjs
@@ -7,7 +7,14 @@ const { installGalleryFixture } = require('./gallery-fixture.cjs');
// Exercise the real conversation picker, decoder, transcript and composer.
// Only transport is synthetic; no provider calls or real session files.
async function runSavedSessionVisuals({ win, origin, output }) {
- const wc = win.webContents, js = source => wc.executeJavaScript(source);
+ const wc = win.webContents, js = async source => {
+ try { return await wc.executeJavaScript(source); }
+ catch (error) {
+ console.error('Saved session expression:', source);
+ fs.writeFileSync(path.join(output, 'saved-session-failed.png'), (await wc.capturePage()).toPNG());
+ throw error;
+ }
+ };
const wait = async source => {
for (let i = 0; i < 150; i++) {
if (await js(source)) return;
diff --git a/apps/native/electron/tab-drag-visual.cjs b/apps/native/electron/tab-drag-visual.cjs
index 2a568971..9ecf36c1 100644
--- a/apps/native/electron/tab-drag-visual.cjs
+++ b/apps/native/electron/tab-drag-visual.cjs
@@ -8,7 +8,20 @@ async function runTabDrag({win, origin, output}) {
const tabs=()=>js(`Array.from(document.querySelectorAll('[data-tab-id]')).map(t=>Number(t.dataset.tabId))`);
const panes=()=>js(`Array.from(document.querySelectorAll('[data-chat]')).map(t=>Number(t.dataset.chat))`);
const point=selector=>js(`(()=>{const r=document.querySelector(${JSON.stringify(selector)}).getBoundingClientRect();return {x:Math.round(r.left+r.width/2),y:Math.round(r.top+r.height/2)}})()`);
- const click=async selector=>{const p=await point(selector);for(const type of ['mouseDown','mouseUp'])await desktop.testInput(wc,{type,button:'left',clickCount:1,...p});};
+ const click=async selector=>{
+ // Hydration and workspace discovery move the tab strip after loadURL.
+ // Hit-test settled coordinates before sending one real pointer click.
+ for(let i=0;i<50;i++) {
+ const before=await point(selector);
+ await new Promise(resolve=>setTimeout(resolve,100));
+ const p=await point(selector);
+ if(before.x!==p.x||before.y!==p.y)continue;
+ if(!await js(`document.querySelector(${JSON.stringify(selector)})?.contains(document.elementFromPoint(${p.x},${p.y}))`))continue;
+ for(const type of ['mouseDown','mouseUp'])await desktop.testInput(wc,{type,button:'left',clickCount:1,...p});
+ return;
+ }
+ throw Error(`Pointer target did not settle: ${selector}`);
+ };
const focusComposer=async()=>{
// The landing composer moves when the browser closes and workspace health arrives.
// Wait for its layout, then retry only the harmless focus click if it moved again.