Skip to content

Commit 950d85f

Browse files
Stabilize comment geometry recovery test
1 parent b2d6ce6 commit 950d85f

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎e2e/sidecar.e2e.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,19 @@ test("an unavailable comment position keeps its compact sheet mounted until geom
828828
viewport: { width: 390, height: 300 },
829829
});
830830
let editor = content(page);
831-
await editor.locator("p").first().selectText();
831+
await editor.locator("p").first().evaluate(paragraph => {
832+
let phrase = "A selected passage keeps going.";
833+
let text = paragraph.querySelector("[data-lexical-text]")?.firstChild;
834+
if (!(text instanceof Text) || !text.data.startsWith(phrase)) {
835+
throw new Error("expected the tall passage fixture");
836+
}
837+
let range = document.createRange();
838+
range.setStart(text, 0);
839+
range.setEnd(text, phrase.length);
840+
let selection = getSelection();
841+
selection?.removeAllRanges();
842+
selection?.addRange(range);
843+
});
832844
await page.getByRole("button", { name: "Comment on this passage", exact: true }).click();
833845
let draft = page.getByRole("dialog", { name: "New comment" });
834846
await draft.getByPlaceholder("Comment on this passage…").fill("Keep the whole passage.");

0 commit comments

Comments
 (0)