Skip to content

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

Python

test: await desktop input and retain independent CI coverage

Rach Pradhanf0da7c822e06
diff --git a/.github/workflows/desktop.yml b/.github/workflows/desktop.yml
index c2c00017..9f7e354f 100644
--- a/.github/workflows/desktop.yml
+++ b/.github/workflows/desktop.yml
@@ -61,33 +61,43 @@ jobs:
env:
GRAFF_ELECTRON_FOREGROUND: '1'
- run: bun run build
+ id: gui
- name: Foreground GUI suite including native fullscreen
run: bun run test:visual
env:
GRAFF_ELECTRON_FOREGROUND: '1'
- name: Foreground pointer tab drag and split regressions
+ if: ${{ !cancelled() && steps.gui.conclusion == 'success' }}
run: bun run test:tab-drag
env:
GRAFF_ELECTRON_FOREGROUND: '1'
GRAFF_VISUAL_OUTPUT: ../../zig-out/native-tab-drag
- uses: ./.github/actions/setup-codegraff-zig
+ id: zig
+ if: ${{ !cancelled() && steps.gui.conclusion == 'success' }}
- name: Build the actual ACP worker
+ id: worker
+ if: ${{ !cancelled() && steps.zig.conclusion == 'success' }}
run: zig build
working-directory: .
- name: Production front-end failure and recovery with native input when permitted
+ if: ${{ !cancelled() && steps.worker.conclusion == 'success' }}
run: bun run test:frontend
env:
GRAFF_ELECTRON_FOREGROUND: '1'
GRAFF_FRONTEND_OS_INPUT: '1'
- name: Production inline HTML tool and saved replay
+ if: ${{ !cancelled() && steps.worker.conclusion == 'success' }}
run: bun run test:html-tool
env:
GRAFF_FRONTEND_OUTPUT: ../../zig-out/html-tool-test
- name: Terminal project handoff into the production GUI
+ if: ${{ !cancelled() && steps.worker.conclusion == 'success' }}
run: bun run test:cli
env:
GRAFF_FRONTEND_OUTPUT: ../../zig-out/cli-test
- name: Bounded mixed split and memory stress
+ if: ${{ !cancelled() && steps.worker.conclusion == 'success' }}
run: bun run test:split-stress
env:
GRAFF_FRONTEND_OUTPUT: ../../zig-out/split-stress
diff --git a/apps/native/electron/stress-visual.cjs b/apps/native/electron/stress-visual.cjs
index b95ed1ae..ef44e6dd 100644
--- a/apps/native/electron/stress-visual.cjs
+++ b/apps/native/electron/stress-visual.cjs
@@ -8,9 +8,15 @@ const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
async function runStressVisuals({win: fixtureWindow, origin, output, fullscreen = true}) {
const win = testDesktop.createWindow({width:1000,height:760,titleBarStyle:'hiddenInset',webPreferences:{preload:path.join(__dirname,'preload.cjs'),sandbox:true,contextIsolation:true,nodeIntegration:false,backgroundThrottling:false}});
installWindowState(win);
- const js = code => win.webContents.executeJavaScript(code);
+ const js = async code => {
+ try { return await win.webContents.executeJavaScript(code); }
+ catch (error) { console.error('Stress expression:', code); throw error; }
+ };
const wait = async expression => {for(let i=0;i<200;i++){if(await js(expression))return;await sleep(50);}throw Error(`Stress timeout: ${expression}`);};
- const click = async selector => {await js(`document.querySelector(${JSON.stringify(selector)}).click()`);await sleep(60);};
+ const click = async selector => {
+ await wait(`!!document.querySelector(${JSON.stringify(selector)})`);
+ await js(`document.querySelector(${JSON.stringify(selector)}).click()`);await sleep(60);
+ };
const select = async name => {await click(`[data-stress-case="${name}"]`); await js('document.fonts.ready.then(()=>true)');};
const metrics=[];
const bounds=async()=>{
diff --git a/apps/native/electron/test-desktop.cjs b/apps/native/electron/test-desktop.cjs
index 5d113619..e0160aae 100644
--- a/apps/native/electron/test-desktop.cjs
+++ b/apps/native/electron/test-desktop.cjs
@@ -16,8 +16,11 @@ async function focusTestPage(wc) {
}
const modifierBits = list => (list ?? []).reduce((bits, name) => bits | ({ alt: 1, control: 2, ctrl: 2, meta: 4, shift: 8 }[name] ?? 0), 0);
async function testInput(wc, event) {
- if (policy.foreground) { wc.sendInputEvent(event); return; }
await focusTestPage(wc);
+ // Await Chromium dispatch in both window modes. sendInputEvent returns before
+ // the renderer has handled it, letting subsequent layout assertions race it.
+ // Real macOS pointer/keyboard coverage uses ComputerUse in the native suite.
+ attachTestDebugger(wc);
const modifiers = modifierBits(event.modifiers);
if (event.type === 'char') return wc.debugger.sendCommand('Input.dispatchKeyEvent', { type: 'char', text: event.keyCode, modifiers });
if (event.type.startsWith('key')) {