Skip to content

fix(test): Update transactionsList.spec.tsx to await grid cells - #120571

Merged
ryan953 merged 1 commit into
masterfrom
seer/fix/jest-2y1z-grid-cell-test-timing
Jul 24, 2026
Merged

fix(test): Update transactionsList.spec.tsx to await grid cells#120571
ryan953 merged 1 commit into
masterfrom
seer/fix/jest-2y1z-grid-cell-test-timing

Conversation

@sentry

@sentry sentry Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

The test transactionsList.spec.tsx was failing with TestingLibraryElementError: Unable to find an element by: [data-test-id="grid-cell"].

Root Cause:
The test was calling screen.getAllByTestId('grid-cell') synchronously after await screen.findByTestId('transactions-table'). The transactions-table element (a PanelTable container) is rendered immediately on component mount, even when data is still loading. However, the actual grid-cell elements are rendered asynchronously only after the API data has successfully loaded and the isLoading state transitions to false. This created a race condition where the synchronous getAllByTestId was executed before the grid-cell elements were present in the DOM.

Solution:
Changed screen.getAllByTestId('grid-cell') to await screen.findAllByTestId('grid-cell') in the affected test. This ensures that the test correctly waits for the grid-cell elements to be rendered after the data has loaded, resolving the TestingLibraryElementError. The preceding findByTestId('transactions-table') check is now redundant as a timing gate but can remain for general element presence assertion.

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-2Y1Z

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@ryan953
ryan953 requested a review from a team July 24, 2026 16:15
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 24, 2026
@ryan953 ryan953 added the Trigger: getsentry tests Once code is reviewed: apply label to PR to trigger getsentry tests label Jul 24, 2026
@ryan953
ryan953 enabled auto-merge (squash) July 24, 2026 16:15
@ryan953
ryan953 merged commit b3b4383 into master Jul 24, 2026
85 of 86 checks passed
@ryan953
ryan953 deleted the seer/fix/jest-2y1z-grid-cell-test-timing branch July 24, 2026 16:23
Christinarlong pushed a commit that referenced this pull request Jul 24, 2026
)

The test `transactionsList.spec.tsx` was failing with
`TestingLibraryElementError: Unable to find an element by:
[data-test-id="grid-cell"]`.

**Root Cause:**
The test was calling `screen.getAllByTestId('grid-cell')` synchronously
after `await screen.findByTestId('transactions-table')`. The
`transactions-table` element (a `PanelTable` container) is rendered
immediately on component mount, even when data is still loading.
However, the actual `grid-cell` elements are rendered asynchronously
only after the API data has successfully loaded and the `isLoading`
state transitions to `false`. This created a race condition where the
synchronous `getAllByTestId` was executed before the `grid-cell`
elements were present in the DOM.

**Solution:**
Changed `screen.getAllByTestId('grid-cell')` to `await
screen.findAllByTestId('grid-cell')` in the affected test. This ensures
that the test correctly waits for the `grid-cell` elements to be
rendered after the data has loaded, resolving the
`TestingLibraryElementError`. The preceding
`findByTestId('transactions-table')` check is now redundant as a timing
gate but can remain for general element presence assertion.

<!--

  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-2Y1Z](https://sentry.sentry.io/issues/7629893353/?seerDrawer=true)

<sub>Comment `@sentry <feedback>` on this PR to have Autofix iterate on
the changes.</sub>

Co-authored-by: Ryan Albrecht <ryan.albrecht@sentry.io>
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.

1 participant