Skip to content

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

Python

test(native): expose folder picker test path

yxlyxd2ba0821e889
diff --git a/apps/native/electron/navigation-visual.cjs b/apps/native/electron/navigation-visual.cjs
index 862c1a05..eb188ee9 100644
--- a/apps/native/electron/navigation-visual.cjs
+++ b/apps/native/electron/navigation-visual.cjs
@@ -19,7 +19,7 @@ async function runNavigationVisuals({win:fixtureWindow,origin,output}) {
wc.on("console-message",event=>{if(event.level>=2)console.error("Navigation renderer:",event.message);});
const wait=async c=>{for(let i=0;i<150;i++){if(await js(c))return;await sleep(50);}throw Error(`Navigation timeout: ${c}`);};
const key=async(key,extra={})=>{await js(`document.activeElement.dispatchEvent(new KeyboardEvent('keydown',${JSON.stringify({key,bubbles:true,cancelable:true,...extra})}))`);await sleep(100);};
- const pressEnter=async()=>{await testDesktop.testInput(wc,{type:'keyDown',keyCode:'Return'});await testDesktop.testInput(wc,{type:'keyUp',keyCode:'Return'});await sleep(50);};
+ const pressEnter=async()=>{await testDesktop.pressEnter(wc);await sleep(50);};
const input=async text=>{await js(`(()=>{const e=document.querySelector('textarea[aria-label="Prompt"]');e.focus();Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,'value').set.call(e,${JSON.stringify(text)});e.dispatchEvent(new Event('input',{bubbles:true}));})()`);await sleep(100);};
const tabs=()=>js(`document.querySelectorAll('[aria-label="Close tab"]').length`);
try {
diff --git a/apps/native/electron/test-desktop.cjs b/apps/native/electron/test-desktop.cjs
index f74b3633..ff8cbef0 100644
--- a/apps/native/electron/test-desktop.cjs
+++ b/apps/native/electron/test-desktop.cjs
@@ -43,4 +43,8 @@ async function testInput(wc, event) {
clickCount: event.clickCount ?? 0, modifiers,
...(type === 'mouseWheel' ? { deltaX: -(event.deltaX ?? 0), deltaY: -(event.deltaY ?? 0) } : {}) });
}
-module.exports = { ...policy, attachTestDebugger, focusTestPage, testInput };
+async function pressEnter(wc) {
+ await testInput(wc, { type: 'keyDown', keyCode: 'Return' });
+ await testInput(wc, { type: 'keyUp', keyCode: 'Return' });
+}
+module.exports = { ...policy, attachTestDebugger, focusTestPage, testInput, pressEnter };
diff --git a/apps/native/package.json b/apps/native/package.json
index 7dc5fb07..b8c2dc6e 100644
--- a/apps/native/package.json
+++ b/apps/native/package.json
@@ -23,7 +23,7 @@
"test:links": "GRAFF_VISUAL_SUITE=links bun scripts/test-visual.mjs",
"test:interactions": "GRAFF_VISUAL_SUITE=interactions bun scripts/test-visual.mjs",
"test:projects": "GRAFF_VISUAL_SUITE=projects bun scripts/test-visual.mjs",
- "test:folder-picker": "GRAFF_VISUAL_SUITE=folder-picker bun scripts/test-visual.mjs",
+ "test:folder-picker": "bun scripts/test-visual.mjs folder-picker",
"test:splits": "GRAFF_VISUAL_SUITE=splits bun scripts/test-visual.mjs",
"test:stress": "GRAFF_VISUAL_SUITE=stress bun scripts/test-visual.mjs",
"test:code": "GRAFF_VISUAL_SUITE=code bun scripts/test-visual.mjs",
diff --git a/apps/native/scripts/test-visual.mjs b/apps/native/scripts/test-visual.mjs
index 6e8f3bf6..a0517e8d 100644
--- a/apps/native/scripts/test-visual.mjs
+++ b/apps/native/scripts/test-visual.mjs
@@ -1,6 +1,7 @@
import { createRequire } from 'node:module';
const { testWindowMode } = createRequire(import.meta.url)('../electron/test-window.cjs');
import { runElectron } from './test-electron.mjs';
+if (process.argv[2]) process.env.GRAFF_VISUAL_SUITE = process.argv[2];
const ready = testWindowMode() !== 'hidden'
|| await runElectron('electron/background-regression.cjs') === 0;
if (ready) await runElectron('electron/visual-tests.cjs');