Skip to content

fix(test): Fix flaky EventReplay inline onboarding test#111840

Draft
JoshuaKGoldberg wants to merge 1 commit intomasterfrom
fix/flaky-event-replay-spec
Draft

fix(test): Fix flaky EventReplay inline onboarding test#111840
JoshuaKGoldberg wants to merge 1 commit intomasterfrom
fix/flaky-event-replay-spec

Conversation

@JoshuaKGoldberg
Copy link
Copy Markdown
Member

Summary

Fixes a flaky test in static/app/components/events/eventReplay/index.spec.tsx:

  • Test: "should render the replay inline onboarding component when replays are enabled and the project supports replay"
  • Occurrences: 6 in the last 30 days

Root Cause

The ReplayInlineOnboardingPanel component is loaded via React.lazy(), creating an async code-splitting boundary. Inside that lazy-loaded component, usePrompt calls useApiQuery (React Query), adding another async data-fetching boundary. The combination of these two async layers occasionally exceeded the findByText default timeout in CI, causing the test to flake.

Fix

Mock the replayInlineOnboardingPanel module (same pattern already used for replayClipPreview) and assert on a data-test-id instead of the rendered text. This eliminates both async boundaries — the lazy import and the prompt API call — making the test deterministic.

The test's purpose is to verify that EventReplay correctly decides to render the onboarding component when conditions are met, not to test the onboarding panel's internal rendering. Mocking the panel isolates the unit under test.

Test plan

  • All 4 tests in the file pass locally
  • Pre-commit passes

Made with Cursor

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 30, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant