Repository navigation
test(dashboard): Paste and pick mentions like a person in composer e2e - #3976
Merged
Merged
Conversation
"a pasted Slack mention becomes a mention" dispatched a scripted paste
event after six ArrowLeft presses. Lexical moves its own selection to
the DOM caret only on selectionchange, beforeinput, or a selection key
press. A scripted paste has none of these, so when the last ArrowLeft's
selectionchange had not run yet, the paste landed one character late
("ask @U456!first"). The poll on the DOM caret did not prove that the
editor saw the move.
pasteText now pastes with the clipboard and the paste shortcut, whose
key press makes Lexical read the DOM caret. An ast-grep rule keeps
dashboard e2e tests from scripting text pastes again.
The mention card tests pressed Enter or Tab once the person's row was
visible. That row can come from the search for the earlier text while
the search for the full text loads, and the menu then inserts nothing
by design. typeMention also waits until the menu is not busy.
Co-Authored-By: David Cramer <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dcramer
approved these changes
Nov 21, 2026
22 tasks done
dcramer
added a commit
that referenced
this pull request
Nov 22, 2026
…ertions (#4025) Dashboard E2E specs get around the existing geometry and sleep bans with page script, synthetic events, raw selectors, and timeout overrides. Synthetic input also flakes, as in #3976. This adds four rules to `test-architecture:check` for `packages/junior-dashboard/e2e/**/*.spec.ts`. Shared helpers such as `harness.ts`, `screenshot.ts`, and `pick-option.ts` are not specs and stay allowed. | Rule | Matches | Baseline | | --- | --- | --- | | `dashboard-spec-page-script` | `evaluate(`, `evaluateHandle(` | 298 in 55 specs | | `dashboard-spec-synthetic-event` | `dispatchEvent(` | 57 in 20 specs | | `dashboard-spec-selector` | `locator(` with a string selector | 426 in 59 specs | | `dashboard-spec-timing` | `timeout:` overrides | 38 in 17 specs | Each error message says what to use instead: a named helper outside the spec, real input, `getByRole`/`getByLabel`/`getByText`, or `page.clock`. The counts are per file in `scripts/test-architecture-baseline.json`, under new rule keys. That uses the existing per-file shrink logic: a spec that goes above its count fails, and one that drops below it must lower the entry. `baseline-growth:check` skips a rule key that is not on the base branch, since that adopts a new check (the same way `kind-behavior` was added in #3059). After this merges, the totals are compared to main like every other rule. Matches are not filtered by comments. Glob strings such as `"**/api/conversations/*/messages"` break the shared comment stripper, and the existing dashboard rules do not filter comments either. Not covered, so open for a follow-up decision: `waitForFunction`, `$eval`/`evaluateAll`, `getByTestId`, `locator(CONSTANT)`, `test.setTimeout`, and `new Promise((r) => setTimeout(r, 250))` sleeps, which the `waitForTimeout` ban misses. This PR does not fix existing violations. <!-- junior-request-attribution:start --> via @dcramer. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3Aea4dab6709a7b92a1029c38bbe76b72e --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3Aea4dab6709a7b92a1029c38bbe76b72e) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Aea4dab6709a7b92a1029c38bbe76b72e/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: David Cramer <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two flaky dashboard e2e tests in
composer-typeahead.spec.ts. Only the tests were racy. The composer has no race that a person can hit."a pasted Slack mention becomes a mention"
The paste sometimes landed one character late (
"ask @U456!first"). Lexical moves its own selection to the DOM caret only onselectionchange,beforeinput, or a selection key press. The test sent a scriptedpasteevent right after six ArrowLeft presses. When Chromium had not yet delivered the last ArrowLeft'sselectionchange, Lexical still had the earlier caret, and a scripted paste has no key press to make it read the DOM again. A real Ctrl/Cmd+V does.e2e/paste-text.ts:pasteText(page, text)writes the clipboard and pressesControlOrMeta+V. Both text-paste tests use it.e2e-text-paste-through-paste-textflagssetData("text/plain", …)in dashboard e2e files. File pastes are not affected.Mention-card tests ("a archived conversation's mention card has no Invite" and others)
These pressed Enter or Tab as soon as the person's row was visible. That row can come from the search for the earlier text while the search for the full text loads, and the menu ignores Enter and Tab on it by design. So no mention was inserted.
typeMentionhelper in the spec waits for the row and for the Mentions list to stop beingaria-busybefore the key press.via @dcramer.
--
View Session [Sentry]