gui tests: panel-usage waits for the allowances to be read before counting the tray panel's tabs

"chromium zh: the tray panel's Usage tab" saw 4 tabs, not 3, on main.
The test counted after a fixed 400ms. The panel keeps its Allowances tab
until the quotas answer has come and holds none, which is right (an
answer not come yet isn't none), and under load that answer came after
400ms. The test now waits for the tab to be hidden first.

Run: with the quotas answer delayed 800ms (QDELAY), the old test fails
and the new one passes. panel-usage.test.cjs undelayed, chromium and
webkit, en and zh.
This commit is contained in:
yetone
2026-10-11 02:34:21 +08:00
parent 689b5b1838
commit f823a53d30
+3
View File
@@ -410,6 +410,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await x.addInitScript((t) => { try { localStorage.setItem("magpie.panelTab", t); } catch {} }, tab);
await x.route("**/*", serve(lang, [], []));
await x.goto("http://magpie.test/?mode=panel");
// the Allowances tab stays until the allowances are read and none
// are there (an answer not come yet isn't none)
await x.locator('#ptabs [data-ptab="usage"][hidden]').waitFor({ state: "attached" });
await x.waitForTimeout(400);
assert.deepEqual(failed, [], `the panel failed to load on the ${tab} tab`);
assert.equal(await x.locator("#ptabs button:not([hidden])").count(), 3, `the tabs are there on ${tab}`);