From e430e2750045fe5a0012f6c57bdc5bf22d5cd93b Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 11 Nov 2026 10:07:16 +0800 Subject: [PATCH] gui tests: agent-bulk-visibility and agent-disconnect-preview leave the window's in-use signal out of the writes they count (#5982) 10c4dc109 posts /api/update/using on the window's first pointer or key event. Both files record every POST and count or compare them, so bulk visibility (10 cases: 4 posts, not 2) and disconnect previews (4 cases: the two /api/update/using posts) were red on origin/main 71a68639b, run alone on mote. The recorders now leave that path out, as provider-find's did in b96847c3d. Run: both files on mote, chromium and webkit, 5 and 2 languages: 14 of 14 ok (before, at 71a68639b: all 14 red). Not tried: the rest of the ~250 files with a strict POST recorder (#5982's open part). --- internal/gui/tests/agent-bulk-visibility.test.cjs | 3 ++- internal/gui/tests/agent-disconnect-preview.test.cjs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/gui/tests/agent-bulk-visibility.test.cjs b/internal/gui/tests/agent-bulk-visibility.test.cjs index 959b1ac77..433b21a74 100644 --- a/internal/gui/tests/agent-bulk-visibility.test.cjs +++ b/internal/gui/tests/agent-bulk-visibility.test.cjs @@ -29,7 +29,8 @@ for (const engine of process.env.BROWSER ? [process.env.BROWSER] : ['chromium', await page.route('**/*', async (route) => { const req = route.request(), url = new URL(req.url()); const json = (data) => route.fulfill({ json: data }); - if (req.method() === 'POST') posts.push([url.pathname, req.postDataJSON()]); + // the window saying it is in use (update/using) is not the page's doing + if (req.method() === 'POST' && url.pathname !== '/api/update/using') posts.push([url.pathname, req.postDataJSON()]); if (url.pathname === '/boot.js') return route.fulfill({ contentType: 'text/javascript', body: `window.bootPrefs = ${JSON.stringify({lang, theme, web:true})};` }); if (url.pathname === '/wails/runtime.js') return route.fulfill({ contentType: 'text/javascript', body: 'export const Window = {};' }); if (url.pathname === '/api/state') return json(state); diff --git a/internal/gui/tests/agent-disconnect-preview.test.cjs b/internal/gui/tests/agent-disconnect-preview.test.cjs index 6ae54b5c9..8e8f895fe 100644 --- a/internal/gui/tests/agent-disconnect-preview.test.cjs +++ b/internal/gui/tests/agent-disconnect-preview.test.cjs @@ -35,7 +35,8 @@ function serve(lang, textSize, posts) { return async (route) => { const req = route.request(), url = new URL(req.url()); const json = (data) => route.fulfill({ json: data }); - if (req.method() === "POST") posts.push(url.pathname); + // the window saying it is in use (update/using) is not the page's doing + if (req.method() === "POST" && url.pathname !== "/api/update/using") posts.push(url.pathname); if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = ${JSON.stringify({ lang, theme: "light", textSize, web: false })};` }); if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" }); if (url.pathname === "/api/state") return json(state);