diff --git a/internal/gui/tests/README.md b/internal/gui/tests/README.md index 78ebcd7b6..180779a93 100644 --- a/internal/gui/tests/README.md +++ b/internal/gui/tests/README.md @@ -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 diff --git a/internal/gui/tests/account-arrange.test.cjs b/internal/gui/tests/account-arrange.test.cjs index f14bddf16..7fe07e7ca 100644 --- a/internal/gui/tests/account-arrange.test.cjs +++ b/internal/gui/tests/account-arrange.test.cjs @@ -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();