Skip to content

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

Python

test(gui): await completed browser navigation before editing address

justrach70b7025d3c22
diff --git a/apps/native/electron/browser-address-visual.cjs b/apps/native/electron/browser-address-visual.cjs
index 74789702..2366a7f1 100644
--- a/apps/native/electron/browser-address-visual.cjs
+++ b/apps/native/electron/browser-address-visual.cjs
@@ -21,7 +21,14 @@ async function runBrowserAddress({ wc, browser, destination, guard, wait }) {
};
await submit(query);
await wait(() => searches.length === 1, 'ordinary words reach the search URL');
- await wait(() => browser.tabs.get(browser.visible)?.view?.webContents.getURL() === destination + '/', 'search fixture loaded');
+ await wait(() => {
+ const page = browser.tabs.get(browser.visible)?.view?.webContents;
+ return page && !page.isLoading() && page.getURL() === destination + '/';
+ }, 'search fixture finished loading');
+ // Navigation completion publishes several info updates and the open result.
+ // Let the address consume those before editing it for the rejection case.
+ await wait(`(()=>{const address=document.querySelector('input[aria-label="Address"]');return address.value===${JSON.stringify(destination + '/')} && address.closest('aside').querySelector('header')?.textContent.includes('Link destination fixture')})()`);
+ await js('new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve)))');
assert.deepEqual(searches, [expected]);
assert.equal(await js(`!!document.querySelector('aside [role="alert"]')`), false, 'Search terms do not show Invalid URL');
// Check scheme rejection in the real IPC path without treating it as a search.