From f802fc33014ff01d41771bc35602d9185d4cb8e1 Mon Sep 17 00:00:00 2001 From: ggbdpq Date: Sun, 25 Oct 2026 02:14:42 +0800 Subject: [PATCH] test(gui): the deprecated-subscriptions waits after a page load get 15s Under the whole suite's load, webkit zh once waited past the 5s default for the deprecation notice after the reload of Providers (#3484): a page load serves the files one by one, then /api/state is read before /api/providers before the rows, and the red passed alone right after. The notice and badge waits after a load get 15s; a load itself now has the 60s navigation timeout (#4470), and the waits inside a loaded page keep the quick 5s. The injected 6s /api/providers read that reproduces the red also showed a second snag on the same path: a reload kills the page's own background reads (the web update poll, What's new), and webkit reports each killed fetch as a page error on the page it leaves, which the errors assertion would have tripped on in just such a slow run. With every response faked here, that wording only ever means a killed read, so it is not counted as a page error. Landed (yetone): the next commit times the boot as the navigation and anchors the filter to WebKit's wording. Generated-by: GLM-5.3-Flash (ZCode) --- .../tests/deprecated-subscriptions.test.cjs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/internal/gui/tests/deprecated-subscriptions.test.cjs b/internal/gui/tests/deprecated-subscriptions.test.cjs index f226a3eab..8a9bc1daa 100644 --- a/internal/gui/tests/deprecated-subscriptions.test.cjs +++ b/internal/gui/tests/deprecated-subscriptions.test.cjs @@ -60,6 +60,13 @@ const L = { more: "插件中还有更多" }, }; +// The notice after a reload landed past the 5s default on webkit under +// the whole suite's load (#3484): the page is served file by file, then +// /api/state before /api/providers before the rows. A load itself now has +// the 60s navigation timeout (#4470); these waits after it keep 15s, +// while the ones inside a loaded page keep the quick 5s. +const boot = 15000; + for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) { for (const lang of ["en", "zh"]) { test(`${engine} ${lang}: deprecated built-in subscriptions are badged and explained`, async (t) => { @@ -70,14 +77,19 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", page.setDefaultTimeout(5000); page.setDefaultNavigationTimeout(60000); const errors = []; - page.on("pageerror", (e) => errors.push(e.message)); + // A reload kills the page's own background reads (the web update + // poll, What's new), and webkit reports each killed fetch as a page + // error on the page it leaves (#3484): with every response faked + // here that wording only ever means a killed read, not the page + // misbehaving, so it doesn't count. + page.on("pageerror", (e) => { if (!e.message.includes("due to access control checks")) errors.push(e.message); }); const calls = []; await page.route("**/*", serve(lang, calls)); await page.goto("http://magpie.test/?view=providers"); // the notice: the signed-in deprecated ones, and why const notice = page.locator("#movable .deprecation"); - await notice.waitFor(); + await notice.waitFor({ timeout: boot }); const said = await notice.innerText(); assert.ok(said.includes(w.head), `the notice doesn't name Cursor and Kiro: ${said}`); assert.ok(said.includes(w.why), "the notice doesn't say why"); @@ -116,11 +128,11 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", // Not now hides the notice, and it stays hidden on the next load await page.goto("http://magpie.test/?view=providers"); - await notice.waitFor(); + await notice.waitFor({ timeout: boot }); await notice.locator("button", { hasText: w.later }).click(); await page.locator("#movable").waitFor({ state: "hidden" }); await page.goto("http://magpie.test/?view=providers"); - await page.locator('.row.provider[data-id="cursor"] .badge.deprecated').waitFor(); + await page.locator('.row.provider[data-id="cursor"] .badge.deprecated').waitFor({ timeout: boot }); assert.equal(await page.locator("#movable").isHidden(), true, "the notice came back"); assert.deepEqual(errors, []); });