graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
test: retain renderer motion evidence and await split transitions
Rach Pradhan14a4a61f2b22
diff --git a/apps/native/electron/pane-motion-observer.cjs b/apps/native/electron/pane-motion-observer.cjsindex 220e7cdf..c6cd0bca 100644--- a/apps/native/electron/pane-motion-observer.cjs+++ b/apps/native/electron/pane-motion-observer.cjs@@ -1,31 +1,32 @@-const { attachTestDebugger } = require('./test-desktop.cjs');--// Observe native animation starts, including animations that finish before the-// test process gets its next IPC turn. Do not alter playback or the app's code.+// Retain evidence from the real Web Animations API in the renderer. Hidden+// compositors do not consistently forward CDP animation lifecycle events.async function observePaneMotion(wc) {- attachTestDebugger(wc);- const started = [];- const listener = (_event, method, params) => {- if (method === 'Animation.animationStarted' && params.animation.type === 'WebAnimation')- started.push(params.animation);- };- wc.debugger.on('message', listener);- await wc.debugger.sendCommand('Animation.enable');+ await wc.executeJavaScript(`(()=>{+ const original = Element.prototype.animate;+ const state = { started: 0, finished: 0, original };+ window.__paneMotionObservation = state;+ Element.prototype.animate = function(...args) {+ const animation = original.apply(this, args);+ if (this.matches('[data-chat]') && Number(animation.effect.getTiming().duration) > 1) {+ animation.ready.then(() => { state.started++; }, () => {});+ animation.finished.then(() => { state.finished++; }, () => {});+ }+ return animation;+ };+ })()`);return {async assertStarted() {for (let attempt = 0; attempt < 100; attempt++) {- for (const animation of started.splice(0)) {- if (!(animation.source?.duration > 1) || !animation.source.backendNodeId) continue;- const { node } = await wc.debugger.sendCommand('DOM.describeNode', { backendNodeId: animation.source.backendNodeId });- if (node.attributes?.some((value, i) => i % 2 === 0 && value === 'data-chat')) return;- }+ if (await wc.executeJavaScript('window.__paneMotionObservation.started > 0 && window.__paneMotionObservation.finished > 0')) return;await new Promise(resolve => setTimeout(resolve, 50));}- throw Error('The downward drop did not start a native pane animation');+ throw Error('The downward drop did not run a native pane animation to completion');},async stop() {- wc.debugger.removeListener('message', listener);- await wc.debugger.sendCommand('Animation.disable');+ await wc.executeJavaScript(`(()=>{+ Element.prototype.animate = window.__paneMotionObservation.original;+ delete window.__paneMotionObservation;+ })()`);},};}diff --git a/apps/native/electron/split-focus-visual.cjs b/apps/native/electron/split-focus-visual.cjsindex 320ed127..a35a990e 100644--- a/apps/native/electron/split-focus-visual.cjs+++ b/apps/native/electron/split-focus-visual.cjs@@ -13,8 +13,10 @@ async function runSplitFocus({win,origin,output}) {await new Promise(r=>setTimeout(r,100));};await wc.loadURL(origin);win.setSize(1440,900);testDesktop.present(win);- await wait(`!!document.querySelector('textarea[aria-label="Prompt"]')`);- await key('d',{metaKey:true});await key('d',{metaKey:true});+ await wait(`!!document.querySelector('[data-workspace-ready="true"] textarea[aria-label="Prompt"]')`);+ await key('d',{metaKey:true});+ await wait(`document.querySelectorAll('[data-chat]').length===2`);+ await key('d',{metaKey:true});await wait(`document.querySelectorAll('[data-chat]').length===3`);const original=await ids();await js(`document.querySelectorAll('[data-chat] textarea').forEach((e,i)=>{Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,'value').set.call(e,'Draft '+i);e.dispatchEvent(new Event('input',{bubbles:true}));})`);@@ -70,7 +72,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 wc.loadURL(origin);await wait(`!!document.querySelector('textarea[aria-label="Prompt"]')`);+ 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.');}module.exports={runSplitFocus};