Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚨 Fix Failing Test: handles new session before old session finished saving in URLWrapper.spec.ts #11445

Closed
MAT1018 opened this issue Mar 8, 2025 · 0 comments
Labels
triage tickets that need to be looked at before assigning to team members

Comments

@MAT1018
Copy link

MAT1018 commented Mar 8, 2025

Description:

The test case handles new session before old session finished saving in URLWrapper.spec.ts was failing due to incorrect async handling. The issue was caused by:
• Improper session sequencing: The test expected sessionId2, but received sessionId1.
• Lack of proper async handling: The test was not waiting for session updates correctly.
• Potential timeout issues: The test exceeded the default Jest timeout of 5000ms.

Steps to Reproduce:
1. Run yarn test.
2. Observe the failure in URLWrapper.spec.ts.

Image

Proposed Fix:
• Use async/await for better handling of asynchronous session updates.
• Increase timeout using jest.setTimeout(10000).
• Modify sinon.stub to dynamically return session values while maintaining execution order.
• Ensure correct session sequencing with await new Promise(resolve => setTimeout(resolve, 100));.
• Restore stub after execution to prevent interference.

Acceptance Criteria:
• The test should correctly reflect session updates (sessionId2 should override sessionId1).
• yarn test should pass with no failures.
• Ensure that other dependent tests are not affected.

@github-actions github-actions bot added the triage tickets that need to be looked at before assigning to team members label Mar 8, 2025
@MAT1018 MAT1018 closed this as completed Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage tickets that need to be looked at before assigning to team members
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant