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.
This commit is contained in:
yetone
2026-10-24 20:16:25 +08:00
parent 3d56822d41
commit 5222a4b129
@@ -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();