Skip to content

fix(testing): Correct organization context for replay.id link test#115696

Open
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/jest-2332-replay-link-test
Open

fix(testing): Correct organization context for replay.id link test#115696
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/jest-2332-replay-link-test

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry Bot commented May 15, 2026

This PR fixes the TestingLibraryElementError: Unable to find role="link" in fieldRenderers.spec.tsx.

The renders replay.id as a link when replay exists test was failing because the useReplayCount hook, which is used by ViewReplayLink, relies on useOrganization() to determine the organization slug for its API calls to /replay-count/.

When render() was called without explicitly passing the organization fixture, the OrganizationContext within the test environment was not correctly set. This caused useReplayCount to construct an API URL with a default/incorrect organization slug, which did not match the URL set up by MockApiClient.addMockResponse.

As a result, the mock API response was never triggered, the replay existence check failed, and ViewReplayLink rendered (missing) instead of the expected link, leading to the findByRole('link') assertion timing out.

The fix involves passing the organization fixture as an option to the render() call, ensuring that useOrganization() resolves the correct organization slug and the replay-count API call correctly hits the mock.

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-2332

@ryan953 ryan953 added the Frontend: Rerun Flaky Tests Known flaky tests should be run many times, just to be safe. label May 15, 2026
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📊 Type Coverage Diff

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

@ryan953 ryan953 marked this pull request as ready for review May 16, 2026 00:03
@ryan953 ryan953 requested a review from a team as a code owner May 16, 2026 00:03
@ryan953 ryan953 enabled auto-merge (squash) May 16, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend: Rerun Flaky Tests Known flaky tests should be run many times, just to be safe. Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant