test(desktop): clear the explicit-picker draft with native keypresses

The explicit-picker setup in the relay-agent directory-errors spec
cleared the seeded draft with fill(""), whose programmatic selectAll can
lose the selection to ProseMirror's own selection sync and leave
"@quinn" behind in CI, exhausting retries at the picker-empty
assertion. Clear the draft with native ControlOrMeta+A and Backspace so
the editor applies both steps in its own transaction, and gate
immediately on toBeEmpty before opening the picker. Every original
directory-error, disabled-row, Tab-completion and retry-recovery
assertion is unchanged; no production code, timeout or mock change.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Signed-off-by: Logan Johnson <loganj@squareup.com>
This commit is contained in:
Logan Johnson
2026-09-09 11:37:27 -04:00
parent be1d594f46
commit f1af1b88c6

View File

@@ -1924,7 +1924,14 @@ for (const explicitPicker of [false, true]) {
const input = page.getByTestId("message-input");
await input.fill("@quinn");
if (explicitPicker) {
await input.fill("");
// Clear the draft with native select-all + Backspace instead of
// fill(""): the programmatic selectAll inside fill can lose the
// selection to ProseMirror's own selection sync and leave "@quinn"
// behind in CI. Real key events let the editor apply both steps
// itself.
await input.press("ControlOrMeta+A");
await input.press("Backspace");
await expect(input).toBeEmpty();
await page
.getByRole("button", { name: "Mention someone", exact: true })
.click();