fix: proxy spec flake in firefox due to improper sweeping and correlation #31651
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.
Additional details
While revisiting the proxy spec issues, I found two issues. One of them addresses the flake.
Since
cdpRequestWillBeSentReceivedTimestamp
is set to zero and the pre request sweeper checks the interval timing, the expression likely always evaluates to true and removes the prerequest when the sweeper runs. The sweeper runs every 10 seconds, which could coincidentally run while the proxy spec is running in the middle of the rest of the system tests. This is why this is hard to reproduce while running a single system test, because most tests run faster than 10 seconds and the cypress server doesn't run for longer than 10 seconds. But with the full test suite going, the sweeper is going to run multiple times. To fix this, we need to check ifcdpRequestWillBeSentReceivedTimestamp
is set. If it isn't, we should just leverage the default sweeper logic.Another issue I ran into when looking at this prerequest logic is that hashes are not accounted for in the proxied url in the middleware. When we push prerequests into the prerequest map, firefox bidi DOES contain hashes in the url (routes). To fix this, we remove the hash routes before pushing the url into the prerequest map.
Steps to test
How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?