From f823a53d30513beee1d5f04560df2814d6464133 Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 11 Oct 2026 01:09:43 +0800 Subject: [PATCH] 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. --- internal/gui/tests/panel-usage.test.cjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/gui/tests/panel-usage.test.cjs b/internal/gui/tests/panel-usage.test.cjs index cbac56c9a..da1671596 100644 --- a/internal/gui/tests/panel-usage.test.cjs +++ b/internal/gui/tests/panel-usage.test.cjs @@ -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}`);