fix(test): Update transactionsList.spec.tsx to await grid cells - #120571
Merged
Conversation
ryan953
approved these changes
Jul 24, 2026
ryan953
enabled auto-merge (squash)
July 24, 2026 16:15
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>
3 tasks
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.
The test
transactionsList.spec.tsxwas failing withTestingLibraryElementError: Unable to find an element by: [data-test-id="grid-cell"].Root Cause:
The test was calling
screen.getAllByTestId('grid-cell')synchronously afterawait screen.findByTestId('transactions-table'). Thetransactions-tableelement (aPanelTablecontainer) is rendered immediately on component mount, even when data is still loading. However, the actualgrid-cellelements are rendered asynchronously only after the API data has successfully loaded and theisLoadingstate transitions tofalse. This created a race condition where the synchronousgetAllByTestIdwas executed before thegrid-cellelements were present in the DOM.Solution:
Changed
screen.getAllByTestId('grid-cell')toawait screen.findAllByTestId('grid-cell')in the affected test. This ensures that the test correctly waits for thegrid-cellelements to be rendered after the data has loaded, resolving theTestingLibraryElementError. The precedingfindByTestId('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.