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)
This commit is contained in:
@@ -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, []);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user