gui tests: usage-card-refresh reads the refresh button's own path, not the card's first

d3191a51c (v0.1.1594) put an account's eye on each Usage card, before
the refresh button, so the card's and the row's first <path> became the
eye's. usage-card-refresh took that first path for the refresh icon's
turn and waited on an animation the eye never has: red in chromium and
webkit at d3191a51c, green at 0f6615ffc, run alone. It now names
.quota-refresh path, as the page itself does (the refresh animates
b.querySelector("path") on the button). No other test reads a card's or
an account row's first path (grep of tests/*.cjs).

Run (macOS, playwright 1.62.0, at 84bc5fdad plus this):
- usage-card-refresh.test.cjs: 46/46 twice, both engines; red before
  this at d3191a51c (2 of 46, the waitForFunction at :239).

Found by the whole GUI suite at d3191a51c: 12,984 tests, 201 reds under
a shared machine (load ~120); the 58 red files rerun alone gave 27 red,
and each was rerun on 0f6615ffc, the main before the eye. Only this
file was red at d3191a51c and green at 0f6615ffc on a serial rerun;
context-map at 420px is red now and then on both (1 of 3 each).
go test ./internal/gui at d3191a51c: ok.
This commit is contained in:
yetone
2026-10-27 03:47:05 +08:00
parent 84bc5fdad8
commit d4699c00a6
@@ -221,7 +221,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
releaseRead();
await page.evaluate(() => quotasLoading);
assert.equal(await row.evaluate(e => e.querySelector(".quota-refresh") === window.refreshMotion.button), true, "a background reading replaced the spinning control");
assert.equal(await row.evaluate(e => e.querySelector("path").getAnimations()[0] === window.refreshMotion.animation), true, "a background reading restarted the turn");
assert.equal(await row.evaluate(e => e.querySelector(".quota-refresh path").getAnimations()[0] === window.refreshMotion.animation), true, "a background reading restarted the turn");
release();
await page.locator('.subscription-card[data-provider="codex"] .quota-n', { hasText: "61%" }).waitFor();
const end = await row.evaluate(e => {
@@ -236,8 +236,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// A response already available still gets one complete turn.
state.gate = undefined;
await row.locator(".quota-refresh").click();
await page.waitForFunction(() => document.querySelector('.subscription-card[data-provider="codex"] path').getAnimations()[0]?.effect.getTiming().iterations === 1);
await row.evaluate(e => e.querySelector("path").getAnimations()[0].finish());
await page.waitForFunction(() => document.querySelector('.subscription-card[data-provider="codex"] .quota-refresh path').getAnimations()[0]?.effect.getTiming().iterations === 1);
await row.evaluate(e => e.querySelector(".quota-refresh path").getAnimations()[0].finish());
await row.locator(".quota-refresh:not(.busy)").waitFor();
assert.deepEqual(errors, []);
});