gui tests: providers-fetching-retry gives the poll rtView, and the groups page reads

80ae904c2 made providersWhileFetching ask rtView(view), a top-level
const in app.js, so the Routing groups page polls the providers as
Routing does. The test lifts the function into a vm by itself and
didn't have rtView, so its Gateway and "another page" cases threw
ReferenceError (red on WSL in the full GUI run). The real app was
never affected; rtView is defined before the function.

The test now lifts the rtView line from app.js as it does
providersPage, and two cases say a poll under Routing and under the
groups page reads.

Run on WSL magpie-desktop (Node 22): providers-fetching-retry 13 of
13. Broken by hand: with rtView only "routing", "a poll under the
groups page reads" is red, 12 of 13. Only this test lifts a function
that calls rtView (grep of the tests for providersWhileFetching,
loadProvidersNow and show lifts).
This commit is contained in:
yetone
2026-11-07 01:53:07 +08:00
parent 400b66ec34
commit 2ce44dc285
@@ -30,6 +30,9 @@ const providersSource = lift("function providersWhileFetching() {");
// a plugin's page that reads with Providers (the Gateway page) is polled too
const pageLine = source.match(/^const providersPage = .*$/m);
assert.ok(pageLine, "app.js no longer has providersPage");
// Routing and its groups page read the providers too
const rtLine = source.match(/^const rtView = .*$/m);
assert.ok(rtLine, "app.js no longer has rtView");
// values cross the vm's realm boundary (its Object is not the test's), so what
// is handed to assert is copied into this one first
@@ -45,6 +48,7 @@ let view = "providers", editing = null, adding = false;
const magpie = { page: (v) => (v === "gateway" ? { loads: "providers" } : undefined) };
`,
pageLine[0],
rtLine[0],
`
const document = { hidden: false };
let providers = { fetching: true, providers: [], gateway: { calls: 0 } };
@@ -140,6 +144,18 @@ test("a poll under the Gateway page, a plugin's page that reads with Providers,
assert.equal(p.pending(), 1);
});
for (const v of ["routing", "groups"]) {
test(`a poll under the ${v} page reads`, async () => {
const p = page();
p.refuses();
p.arm();
p.set("view", v);
await p.fire();
assert.equal(plain(p.counts()).api, 1, "it read nothing under " + v);
assert.equal(p.pending(), 1);
});
}
for (const [guard, set] of [
["another page", (p) => p.set("view", "agents")],
["an open editor", (p) => p.set("editing", "p1")],