Skip to content

fix(jest): Update eventDisplay test for TanStack Query timing#114734

Merged
ryan953 merged 1 commit intomasterfrom
seer/fix/jest-event-display-test-timing
May 4, 2026
Merged

fix(jest): Update eventDisplay test for TanStack Query timing#114734
ryan953 merged 1 commit intomasterfrom
seer/fix/jest-event-display-test-timing

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry Bot commented May 4, 2026

The eventDisplay.spec.tsx test renders an event with tags was failing with a TestingLibraryElementError because screen.findByText('mock-tag', {selector: 'div'}) timed out.

This issue stemmed from the upgrade to TanStack Query v5.96 (commit 3561a70), which introduced an extra microtask delay in query resolution. The EventTagsTree component, used by EventDisplay, renders a loading indicator while its useDetailedProject query is pending.

Although the test already used findByText, the new async timing meant the tag element was not consistently present in the DOM within the default timeout. This PR wraps the assertion in waitFor to explicitly wait for the DOM to update after the asynchronous project data has loaded, aligning with the pattern used to address similar timing issues across other tests during the TanStack Query upgrade.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes JEST-21HV

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 4, 2026
@ryan953 ryan953 marked this pull request as ready for review May 4, 2026 16:56
@ryan953 ryan953 requested review from a team as code owners May 4, 2026 16:56
@ryan953 ryan953 requested a review from a team May 4, 2026 16:57
@ryan953 ryan953 added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label May 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.40%

@ryan953 ryan953 merged commit 59740f1 into master May 4, 2026
88 of 89 checks passed
@ryan953 ryan953 deleted the seer/fix/jest-event-display-test-timing branch May 4, 2026 18:16
cleptric pushed a commit that referenced this pull request May 5, 2026
The `eventDisplay.spec.tsx` test `renders an event with tags` was
failing with a `TestingLibraryElementError` because
`screen.findByText('mock-tag', {selector: 'div'})` timed out.

This issue stemmed from the upgrade to TanStack Query v5.96 (commit
`3561a70`), which introduced an extra microtask delay in query
resolution. The `EventTagsTree` component, used by `EventDisplay`,
renders a loading indicator while its `useDetailedProject` query is
pending.

Although the test already used `findByText`, the new async timing meant
the tag element was not consistently present in the DOM within the
default timeout. This PR wraps the assertion in `waitFor` to explicitly
wait for the DOM to update after the asynchronous project data has
loaded, aligning with the pattern used to address similar timing issues
across other tests during the TanStack Query upgrade.


<!--

  Sentry employees and contractors can delete or ignore the following.

-->

### Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.

Fixes JEST-21HV

Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants