Skip to content

Commit d523aa3

Browse files
author
Fizz
committed
test(desktop): clear forum source draft through the editor keymap
Playwright's fill("") on a contenteditable selects the DOM range and then presses Delete. ProseMirror handles Delete with its own selection, which may not have synced from the DOM yet, so the key can be a no-op and the empty-replacement cases of "forum source visit ... retains source draft" kept "@remotescout hello" (about 1 in 4 recent CI smoke shard 2 runs). Select with ControlOrMeta+a so ProseMirror owns the selection, and assert the replacement text before navigating away. Signed-off-by: Fizz <6be7be23ec5bba868f3e1db5ec86013d76bd1a293dce5b435a192158fec13641@buzz.block.builderlab.xyz>
1 parent 7ebf1be commit d523aa3

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎desktop/tests/e2e/forum-agent-invitation.spec.ts‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,17 @@ for (const stage of ["add", "publish"] as const) {
430430
await expect(
431431
page.getByRole("button", { name: "Remove attachment" }),
432432
).toBeVisible();
433-
if (replacement !== null)
433+
if (replacement === "") {
434+
// fill("") presses Delete over a DOM selection ProseMirror may not
435+
// have synced yet; select through the editor's own keymap instead.
436+
await page.getByTestId("message-input").click();
437+
await page.keyboard.press("ControlOrMeta+a");
438+
await page.keyboard.press("Delete");
439+
} else if (replacement !== null) {
434440
await page.getByTestId("message-input").fill(replacement);
441+
}
442+
if (replacement !== null)
443+
await expect(page.getByTestId("message-input")).toHaveText(replacement);
435444
await navigate(1);
436445
await releaseForumGate(page);
437446
expect(

0 commit comments

Comments
 (0)