You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains 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
The reason this is happening is when the chrome_process_crash.cy.js fails and crashes the browser, the CRI client becomes disconnected. However, the browser-cri-client is unaware of the disconnect. When resetBrowserTabsForNextTest is called at the end of the test, and Target.createTarget is called, the promise never resolves and hangs, meaning that the server state is never reset. We want resetBrowserTabsForNextTest to behave as a no-op, whether is succeeds or fails. Additionally, if the CRI socket is closed and a reconnect is attempted, and there are no pending commands in the queue and the socket is STILL closed, we want to reject send commands to prevent hanging promises. This doesn't seem to happen with video on I believe since the the video processing takes time, and in that time the browser CRI client is reconnected, which allows the state to be reset.
Additionally, after fixing the hanging promise and the state resetting, the relaunchBrowser method was getting called twice, once in open_project and again in browsers/index.ts when the browser crashes. I think this due to the run spec now actually resolving, which now hits the correct relaunchBrowser, meaning the one in browsers/index.ts can be removed.
Lastly, when the browser crashes, we want shouldLaunchNewTab to be treated as false, which is handled by runSpec. After crash this was being set to true, which was trying to run connectToNewSpec when it shouldn't, resulting in the infamous error Missing browserCriClient in connectToNewSpechere as the CRI client doesn't get instantiated yet.
If a chrome crash is detected, we need to reset isFirstSpec (renamed to isFirstSpecInBrowser) to false, which in turn sets shouldLaunchNewTab to false, which creates the CRI client as expected
@AtofStryker i've tested out the changes and so far, i've not had the issue reproduce!!
although quite a few failures due to issues seen in 12.15.0 with cy.task
@AtofStryker i've tested out the changes and so far, i've not had the issue reproduce!!
That's great to here. If you do run into it, let us know, but hopefully this is the fix you need
although quite a few failures due to issues seen in 12.15.0 with cy.task
That is currently expected. There was a regression in 12.15.0 which should be released in 12.16.0 today. Once that release goes out I can try updating the binaries to help reduce noise
That is currently expected. There was a regression in 12.15.0 which should be released in 12.16.0 today. Once that release goes out I can try updating the binaries to help reduce noise
Great. I will test once the binaries are updated and then it'll be MUCH easier to test this, Thanks again.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
4 participants
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
When running the browser_crash_handling_spec.js -> when the browser process crashes in chrome spec with
video: false
, Cypress enters an infinite test loop where it keeps trying to runchrome_process_crash.cy.js
.The reason this is happening is when the
chrome_process_crash.cy.js
fails and crashes the browser, the CRI client becomes disconnected. However, thebrowser-cri-client
is unaware of the disconnect. WhenresetBrowserTabsForNextTest
is called at the end of the test, and Target.createTarget is called, the promise never resolves and hangs, meaning that the server state is never reset. We wantresetBrowserTabsForNextTest
to behave as a no-op, whether is succeeds or fails. Additionally, if the CRI socket is closed and a reconnect is attempted, and there are no pending commands in the queue and the socket is STILL closed, we want to reject send commands to prevent hanging promises. This doesn't seem to happen with video on I believe since the the video processing takes time, and in that time the browser CRI client is reconnected, which allows the state to be reset.Additionally, after fixing the hanging promise and the state resetting, the
relaunchBrowser
method was getting called twice, once in open_project and again in browsers/index.ts when the browser crashes. I think this due to the run spec now actually resolving, which now hits the correctrelaunchBrowser
, meaning the one in browsers/index.ts can be removed.Lastly, when the browser crashes, we want
shouldLaunchNewTab
to be treated asfalse
, which is handled by runSpec. After crash this was being set to true, which was trying to run connectToNewSpec when it shouldn't, resulting in the infamous errorMissing browserCriClient in connectToNewSpec
here as the CRI client doesn't get instantiated yet.If a chrome crash is detected, we need to reset
isFirstSpec
(renamed toisFirstSpecInBrowser
) tofalse
, which in turn setsshouldLaunchNewTab
tofalse
, which creates the CRI client as expectedSteps to test
run the browser_crash_handling_spec.js -> when the browser process crashes in chrome with video on and off (added in this PR)
PR Tasks
cypress-documentation
?type definitions
?