test(gui): deprecated-subscriptions times the page's boot as its navigation (#3484)
Follow-up to ggbdpq's change before this one. Looking for an app-side cause behind the WebKit zh red found none. With ?view=providers the view comes before lastView, and renderProviders draws #movable synchronously once /api/providers is read. Run alone, the notice is up 20 to 40ms after the load event. What the 5s wait covered is the boot that follows goto's load event: /api/state, then /api/providers, then the rows. Under the whole suite's load that boot ran past a limit meant for one action on a loaded page. ggbdpq's 15s had no basis beyond being longer. The boot is the second half of the navigation, so it gets the navigation's minute, which #4470 gave every page.goto. The waits inside a loaded page keep 5s. The pageerror filter matched "due to access control checks" anywhere, in either engine. It is now anchored to WebKit and to "Fetch API cannot load …", as title-bar-tools and usage-fold have it (#1350). Broken by hand on mote: with /api/providers held 6s in the test's serve, webkit zh is red at a 5s wait ("locator.waitFor: Timeout 5000ms exceeded … #movable .deprecation") and green at this 60s. Run at the pushed head on mote (load ~115): - deprecated-subscriptions.test.cjs, chromium and webkit, en and zh: 4/4 (13 files, 189 cases, 187 pass. The 2 reds are signin-proxy's webkit zh and zh-TW at 380px, red alone at origin/main41b5c0f19(#4643). internal/gui/assets is the same at573b21f4b). - go test ./... -timeout 45m on mote with this branch on41b5c0f19: 83 packages ok. internal/gui is red on TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and TestMainWindowCorners (#3949), both red alone at41b5c0f19too, and on TestColdTurnsTaken (#4510). internal/update is red on TestRelaunchOpenTriedAgain (#3881). The last two pass alone at41b5c0f19and here. Rebased onf856d381a: agent, gateway, plugin, provider and sessions ok, gui red on #4514 and #3949 only, gofmt -l clean, go vet ok for linux (nogui), windows and darwin. Rebased onbb478f0e5: agent and gateway ok, gui the same. The last rebase, onto573b21f4b, brings in only internal/gui/providers*.go and internal/provider/models.go, which this branch doesn't touch Not tried: the whole GUI suite. Nothing here makes the app's boot faster; under load it is as slow as before.
This commit is contained in:
@@ -60,12 +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;
|
||||
// The notice after a load is the page's own boot, not an action on a
|
||||
// loaded page (#3484): goto returns at the load event, and only then are
|
||||
// /api/state and /api/providers read and the rows drawn. Under the whole
|
||||
// suite's load that boot ran past the 5s default meant for actions; it is
|
||||
// timed as the navigation it finishes (60s, #4470), while the waits inside
|
||||
// a loaded page keep the quick 5s.
|
||||
const boot = 60000;
|
||||
|
||||
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
|
||||
for (const lang of ["en", "zh"]) {
|
||||
@@ -78,11 +79,12 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
page.setDefaultNavigationTimeout(60000);
|
||||
const errors = [];
|
||||
// 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); });
|
||||
// poll, What's new), and WebKit reports each killed fetch as a page
|
||||
// error on the page it leaves (#1350, #3484): not this test's.
|
||||
page.on("pageerror", (e) => {
|
||||
if (engine === "webkit" && /^Fetch API cannot load .* due to access control checks/.test(e.message)) return;
|
||||
errors.push(e.message);
|
||||
});
|
||||
const calls = [];
|
||||
await page.route("**/*", serve(lang, calls));
|
||||
await page.goto("http://magpie.test/?view=providers");
|
||||
|
||||
Reference in New Issue
Block a user