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, []); });