gui tests: account-arrange acts once the allowances are drawn (#4468)

account-arrange's "account dragging uses the routing order in every mode"
was red alone in WebKit at 31728e29a: line 169's first Antigravity row
had no box. The app is right and the test was wrong. A signed-in
provider's editor is drawn at once and drawn again when its accounts'
allowances come in (loginUsageOf: "loads on its own and fills the rows
in when it's there"), and that redraw replaces every row. The test took
a row from the first draw; when /api/login/usage answered after it (a
busy machine, WebKit), the row it held was gone.

open() and the reload now wait for drawn(page): the first row (with a
load's minute, #4470), then the editing provider's allowance answer in
and not loading, so every action works on the rows that stay. The README
paragraph says so.

What was run (WSL magpie-desktop, Playwright 1.62.0):
- By hand: /api/login/usage answered 1.5s late, a marker set on the name
  first selected. origin/main's file: red in Chromium and WebKit, "the
  name selected is the one drawn last"; this file green in both.
- account-arrange.test.cjs, Chromium, at load ~230-258: green (the first
  run, before the first row got its load's minute; WebKit then went red
  at that 5s first wait, which this file now gives a minute).
- Both engines at load 205-245 (other sessions' suites): this file and
  origin/main's own file both run past the test's 90s budget, Chromium
  and WebKit alike (origin/main's Chromium once red at 14s instead). That
  budget under load is #2200, the same on origin/main, not changed here.

Not tried: the whole GUI suite; mote (#4125) or Windows.
This commit is contained in:
yetone
2026-10-31 02:09:18 +08:00
parent c124f87e2e
commit 62c8d21ee5
2 changed files with 18 additions and 4 deletions
+4 -2
View File
@@ -2119,8 +2119,10 @@ carried over. Every language at 1100, 520 and 360px, in Chromium and WebKit.
keys by their rows (no handle) in every routing mode, and by Alt+↑/↓: the
first row, its First mark and the order saved for routing agree, one save
goes out per drop, Escape and a failed save put the rows back, a disabled
account is not made first, and account text stays selectable. It runs in
Chromium and WebKit with an isolated API fixture:
account is not made first, and account text stays selectable. Each editor
is acted on once its accounts' allowances are in and drawn, as that answer
draws every row again (#4468). It runs in Chromium and WebKit with an
isolated API fixture:
```sh
node --test internal/gui/tests/account-arrange.test.cjs
+14 -2
View File
@@ -67,9 +67,21 @@ function fixture() {
const rows = page => page.locator(".accts [data-account-id]");
const ids = page => rows(page).evaluateAll(rs => rs.map(r => r.dataset.accountId));
const settled = page => page.waitForFunction(() => !accountArranging && !accountSaving);
// drawn: the editor's rows as they stay. A signed-in provider's editor is
// drawn at once and again when its accounts' allowances come in
// (loginUsageOf), which replaces every row; a row held from the first draw
// had no box by then (#4468, WebKit on a busy machine). It follows a
// load, so its first draw has a load's room, not a click's (#4470).
async function drawn(page) {
await rows(page).first().waitFor({ timeout: 60000 });
await page.waitForFunction(() => {
const agent = providers?.providers.find(p => p.id === editing)?.account?.agent;
return !agent || (loginUsage[agent]?.at && !loginUsage[agent].loading);
});
}
async function open(page, id) {
await page.goto(`http://magpie.test/?view=providers&edit=${id}`);
await rows(page).first().waitFor();
await drawn(page);
}
async function point(row) {
await row.scrollIntoViewIfNeeded();
@@ -124,7 +136,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.deepEqual(await ids(page), [before[1], before[0], ...before.slice(2)]);
assert.equal(f.posted.filter(p => p.action === "/api/provider/arrange").length, count + 1);
await checkFirst(page, f, id);
await page.reload(); await rows(page).first().waitFor();
await page.reload(); await drawn(page);
await checkFirst(page, f, id);
const wanted = (await ids(page))[1];
await rows(page).nth(1).getByRole("button", { name: "Make first", exact: true }).click();