[8.x] Return JSON response from auth endpoints to prevent browser race condition in fast CI environments#1186
Closed
jackbayliss wants to merge 3 commits intolaravel:8.xfrom
Closed
[8.x] Return JSON response from auth endpoints to prevent browser race condition in fast CI environments#1186jackbayliss wants to merge 3 commits intolaravel:8.xfrom
jackbayliss wants to merge 3 commits intolaravel:8.xfrom
Conversation
|
Thanks for submitting a PR! Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
Contributor
Author
|
Hm, i'm not sure this is the right thing to do, ive got an override locally, but doesn't seem to related to this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When using fast CI runners browser tests can flake because loginAs() and logout() use visit() to hit endpoints that return 204.
The browser receives the 204 but has no page load event to wait for, so the WebDriver considers the navigation complete immediately and fires the next command before the browser has fully processed and stored the session cookie.
Changing the response from 204 to 200 gives the browser a proper response to settle on. It was originally 204 to prevent favicon errors, but by doing json() we ensure the content-type is json - so no favicons requested :)
Here's a real example... (all three are in the same second)
I have an override for this in my project which seems to work..