Skip to content

chore: Fix flaky test in suites/sessions/initial-scope/test.ts#18354

Closed
AbhiPrasad wants to merge 2 commits into
developfrom
cursor/fix-flaky-test-in-sentry-javascript-claude-4.5-opus-high-thinking-938b
Closed

chore: Fix flaky test in suites/sessions/initial-scope/test.ts#18354
AbhiPrasad wants to merge 2 commits into
developfrom
cursor/fix-flaky-test-in-sentry-javascript-claude-4.5-opus-high-thinking-938b

Conversation

@AbhiPrasad

@AbhiPrasad AbhiPrasad commented Nov 28, 2025

Copy link
Copy Markdown
Contributor

Cursor generated PR

Fixes #18313

This PR resolves a flaky test (should start a new session with navigation.) by addressing a race condition.

Why this change?
The original test had two competing navigations:

  1. page.click('#navigate') triggered a navigation via a route handler.
  2. getFirstSentryEnvelopeRequest(page, url) subsequently called page.goto(url), causing a conflict.

How this change fixes it:
The fix reorders the operations to:

  1. Set up the session listener using waitForSession(page) before the click.
  2. Perform the click, which triggers the single intended navigation.
  3. Wait for the session promise, avoiding any additional page.goto() calls and eliminating the race condition.

Open in Cursor Open in Web

Co-authored-by: aprasad <aprasad@sentry.io>
@cursor

cursor Bot commented Nov 28, 2025

Copy link
Copy Markdown

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@AbhiPrasad AbhiPrasad changed the title Fix flaky test in sentry-javascript chore: Fix flaky test in suites/sessions/initial-scope/test.ts Nov 28, 2025
Co-authored-by: aprasad <aprasad@sentry.io>
@AbhiPrasad AbhiPrasad closed this Nov 28, 2025
@AbhiPrasad AbhiPrasad deleted the cursor/fix-flaky-test-in-sentry-javascript-claude-4.5-opus-high-thinking-938b branch November 28, 2025 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Flaky CI]: [chromium] › suites/sessions/initial-scope/test.ts:18:11 › should start a new session with navigation.

2 participants