fix: use stable test dates in duplicate API calls E2E tests #26349
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.
What does this PR do?
Fixes flaky E2E tests in
booking-duplicate-api-calls.e2e.tsthat were failing on December 31 due to month boundary issues.The tests were using
new Date()and then setting the day to 5 or 20, which caused issues when the prefetch logic inisMonthViewPrefetchEnabledevaluated the current date against month boundaries. On certain dates (like end of month/year), this could trigger additional API calls, causing the tests to fail with "Expected <= 1, Received 2".This PR introduces a
getStableTestDate()helper function that returns a fixed future date (July 2030) to ensure consistent test behavior regardless of when the tests are run.Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
PLAYWRIGHT_HEADLESS=1 yarn e2e booking-duplicate-api-calls.e2e.tsHuman Review Checklist
Note: Local testing was blocked by environment issues (Internal Server Error), so this fix is based on code analysis of the prefetch logic in
isMonthViewPrefetchEnabled.ts. CI will verify the fix.Link to Devin run: https://app.devin.ai/sessions/b1ce96e74aa14104aa9eb14f5e3449f6
Requested by: keith@cal.com (@keithwillcode)