From 90a2f99e37773b779f75498b1a4e3dfe8ca1ff64 Mon Sep 17 00:00:00 2001 From: Maggie Appleton <5599295+MaggieAppleton@users.noreply.github.com> Date: Fri, 28 Aug 2026 17:20:26 +0100 Subject: [PATCH] Stabilize comment geometry recovery test --- e2e/sidecar.e2e.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/e2e/sidecar.e2e.ts b/e2e/sidecar.e2e.ts index b08bff25..19f6e67f 100644 --- a/e2e/sidecar.e2e.ts +++ b/e2e/sidecar.e2e.ts @@ -828,7 +828,19 @@ test("an unavailable comment position keeps its compact sheet mounted until geom viewport: { width: 390, height: 300 }, }); let editor = content(page); - await editor.locator("p").first().selectText(); + await editor.locator("p").first().evaluate(paragraph => { + let phrase = "A selected passage keeps going."; + let text = paragraph.querySelector("[data-lexical-text]")?.firstChild; + if (!(text instanceof Text) || !text.data.startsWith(phrase)) { + throw new Error("expected the tall passage fixture"); + } + let range = document.createRange(); + range.setStart(text, 0); + range.setEnd(text, phrase.length); + let selection = getSelection(); + selection?.removeAllRanges(); + selection?.addRange(range); + }); await page.getByRole("button", { name: "Comment on this passage", exact: true }).click(); let draft = page.getByRole("dialog", { name: "New comment" }); await draft.getByPlaceholder("Comment on this passage…").fill("Keep the whole passage.");