From 5222a4b12921dabfe270edfe0b109bbcdd6a2cc8 Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 24 Oct 2026 20:16:25 +0800 Subject: [PATCH] gui tests: segment-press-dialog waits for the add sheet the page opens itself With no provider, the Providers page opens its add sheet itself once /api/providers is in (app.js renderProviders), and the add button goes away. The test pressed #addProvider right after goto: when the list came first, as it does on a busy machine, the press waited 30s for a button that was gone. It was red 1 of 2 runs at f35c721c4~1 (load ~310) and 3 of 4 in the 112-file #modal run; the test now waits for the sheet's tile instead. Run: segment-press-dialog, chromium and webkit, en and zh, 3 runs in a row: 4/4 ok each. No other test that presses #addProvider has an empty list. --- internal/gui/tests/segment-press-dialog.test.cjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/gui/tests/segment-press-dialog.test.cjs b/internal/gui/tests/segment-press-dialog.test.cjs index 2ed8bd05e..7bfbdd1ca 100644 --- a/internal/gui/tests/segment-press-dialog.test.cjs +++ b/internal/gui/tests/segment-press-dialog.test.cjs @@ -54,8 +54,13 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", page.on("pageerror", (e) => errors.push(e.message)); await page.route("**/*", serve(lang)); await page.goto("http://magpie.test/?view=providers"); - await page.locator("#addProvider").click(); - await page.locator("#addSheet .tile", { hasText: "Kimi Code" }).click(); + // with no provider the page opens its add sheet itself once the list + // is in, and its add button goes away: a press before that opens it + // instead (on a slow machine the list came first, and the press + // waited for a button that was gone) + const tile = page.locator("#addSheet .tile", { hasText: "Kimi Code" }); + await tile.waitFor(); + await tile.click(); const d = page.locator("#modal .editor"); const opts = d.locator(".segs.regions .opt"); await opts.nth(3).waitFor();