diff --git a/scripts/test-web-console-page-cards.mjs b/scripts/test-web-console-page-cards.mjs index 903fca3..f640c8d 100644 --- a/scripts/test-web-console-page-cards.mjs +++ b/scripts/test-web-console-page-cards.mjs @@ -225,6 +225,11 @@ test("a redraw keeps your place: the scroll and the focused field survive an age }, }); + // The answer box's editor mounts after the first draw and may redraw the + // card: wait for it before scrolling, so no redraw can replace the card + // between the scroll and the agent's post. + await itemCard(s.page, "q1").locator(".md-host .cm-content").first().waitFor(); + // Reading a question part-way down: the card scrolls itself. const card = itemCard(s.page, "q1"); assert.equal(await scrollCard(card, 400), 400, "the question card scrolls"); diff --git a/scripts/test-web-console-page-help.mjs b/scripts/test-web-console-page-help.mjs index e42c561..0784382 100644 --- a/scripts/test-web-console-page-help.mjs +++ b/scripts/test-web-console-page-help.mjs @@ -179,7 +179,8 @@ test("the Welcome shows on a first dashboard, saves that it was seen, and Help's await s.page.getByRole("button", { name: "Start building" }).click(); await welcome.waitFor({ state: "hidden" }); // Saved with the other looks, so it holds for the next page too. - await s.page.waitForFunction(async () => ((await (await fetch("/looks")).json()).looks || {}).welcomeSeen === true); + // Polled from here: waitForFunction does not wait on an async predicate, so it passed before the POST landed. + assert.ok(await until(() => s.page.evaluate(async () => ((await (await fetch("/looks")).json()).looks || {}).welcomeSeen === true)), "the Welcome being seen was saved"); await s.page.reload({ waitUntil: "domcontentloaded" }); await drawn(s.page);