Closed AshMcConnell closed 3 years ago
Experiencing this as well. I am seeing this issue when running tests headless and headed in chrome.
Versions 4.7.0 Windows 10 Chrome 83
I am also getting same issue
We're also seeing this problem. My colleagues and I use Windows 10 but we also see it on our automated test job running on Windows server 2012 R2. Both use Chrome v. 83.0. Initially when this started happening we were using Cypress version 4.7. Then we tried running lower versions - 4.6, 4.5. Both exhibit the issue.
Same issue here. Running Cypress 4.7.0 on Windows 10. Running against Chrome 83 with --headless
Not all runs have the issue. First run works but after that 90%+ has the connection problem.
For me first test passed, but next failed with that issue Explored in 4.7.0 and 4.6.0 (windows 10)
I think this is a copy of #7450 It is rather blocking, as Google makes it impossible to downgrade to an earlier version of chrome. And yes, Electron is a kind of workaround, but it almost doubles the run duration.
Getting this as well, I just updated to Windows 10 2004 not sure if related. Sometimes fails on the first test other times it is after 10 tests run.
Following this thread as it's affecting all my chrome headless tests with Cypress 4.7.0.
Thank you @stevejefferies, adding the --disable-gpu flag to 'before:browser:launch' seems to do the trick for me!
@PetMou which file do you add the --disable-gpu flag to? index.js file inside the plugins folder? also can you share what that code looks like please?
We're seeing this on RHEL on our jenkins (latest and greatest) when running cypress as a container. Works fine in 4.6.0. Had the same problem on 3.7.0 which we upgraded from today.
Very random problem.
@eabusharkh0 something like the following in plugins/index.js: Cypress 4+:
module.exports = (on, config) => {
on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args.push('--disable-gpu');
return launchOptions
}
});
}
Or before Cypress 4:
module.exports = (on, config) => {
on('before:browser:launch', (browser, args) => {
if (browser.name === 'chrome' && browser.isHeadless) {
args.push(
'--disable-gpu'
);
return args;
}
});
}
@stevejefferies That did the trick. Thanks for the work around.
@stevejefferies thank you so much, just a side note, I get a warning after adding your code snippet in the index.js upon execution:
Deprecation Warning: The before:browser:launch
plugin event changed its signature in version 4.0.0
The before:browser:launch
plugin event switched from yielding the second argument as an array
of browser arguments to an options object
with an args
property.
We've detected that your code is still using the previous, deprecated interface signature.
This code will not work in a future version of Cypress. Please see the upgrade guide: https://on.cypress.io/deprecated-before-browser-launch-args
if you click on the link, it says cypress no longer support the second argument being an array but instead it should look something like this (you can click on the link and read all the details as well): Before The second argument is no longer an array.
on('before:browser:launch', (browser, args) => {
// will print a deprecation warning telling you
// to change your code to the new signature
args.push('--another-arg')
return args
})
After Access the args property off launchOptions
on('before:browser:launch', (browser, launchOptions) => {
launchOptions.args.push('--another-arg')
return launchOptions
})
@eabusharkh0 good catch, updated above with 4.x and 3.x versions of the snippet
@stevejefferies I'm still getting the warning in my intellij IDE even after updating the code snippet, any idea on why Cypress is still showing the warning?
@eabusharkh0 Shouldn't it be launchOptions.args.push('--another-arg')
Great! This fixes the issue for me as well. I thought that this option was a default in Cypress? Guess I was wrong...
My tests fail when implementing this workaround.
@shutchison-bai Strange, I have over 500 tests passed. Are you comparing screen captures maybe or something like that?
@WayneHiller, I rearrange some code in my plugins/index.js file. The workaround appears to be working now. Thanks!
Has anyone noticed a performance hit when specifying --disable-gpu on Chrome? My tests seems to run at about the same speed.
@WayneHiller, My tests run about the same speed as well.
@WayneHiller, here it is a bit slower, but not much (about 3 minutes extra for a run taking about 30 minutes). Nothing dramatic
@WayneHiller when I update the line to use "--another-arg", my tests won't run at all, screenshot is down below, any ideas?
@eabusharkh0 I believe that should be 'disable-gpu' not 'another-arg'. another-arg was just an example of adding an argument.
@WayneHiller thank you, I switched it back to disable-gpu, the tests run but I still get the warning for some reason, any idea why?
@eabusharkh0 Change it to launchOptions.args.push('--disable-gpu');
@WayneHiller thank you so much, that did the trick!
Since this issue hasn't had activity in a while, we'll close the issue until we can confirm this is still happening. Please comment if there is new information to provide concerning the original issue and we'd be happy to reopen.
Still experiencing this problem on version 7.0.1, MacOS Catalina with Chrome 89. Already restarted computer, run npx cypress cache clear
and npx cypress install
multiple times. Added the following code to plugins/index.js
but still not connected:
on('before:browser:launch', (browser, launchOptions) => {
launchOptions.args.push('--disable-gpu')
return launchOptions
})
Can anyone help?
For a while the suggested workaround seemed to make this go away for us, but I have occasionally been seeing it again. I'm on Cypress 5.5.0 and Chrome 86.
Yes, I need to get around to upgrading all my tests to Cypress 7, which I keep putting off mainly due to the change in 6.0.0 that will cause a lot of my not.visible
-type assertions to fail when I don't really care whether the element happens to exist in the DOM, but that's neither here nor there.
Seeing this a lot (on Gitlab CI) after upgrading to 7.1.0 with the workaround outlined above:
Running: forms/simple/contact-form.spec.js (1 of 5)
Failed to connect to Chrome, retrying in 1 second (attempt 18/62)
...
Failed to connect to Chrome, retrying in 1 second (attempt 45/62)
Timed out waiting for the browser to connect. Retrying...
Timed out waiting for the browser to connect. Retrying again...
I'm getting this error locally as well. I'm running MacOS BigSur 11.5, Chrome Version 92.0.4515.107, Cypress 7.5.0. It only occurs when I'm not running headless. I can run headless just fine.
Edit: restarting my machine seems to have fixed my issue.
I get this issue commonly on macOS Catalina and the latest Cypress versions. Not sure how to replicate, but the fix is to kill the orphaned Chrome process.
When upgrading to 4.7.0 (from 4.6.0) we are getting error messages when connecting to chrome about 50-75% of the time, this was not a problem before 4.7.0 (we have used Cypress for a couple of years now).
It only happens when we use
-b chrome --headless
Versions
4.7.0 Windows 10 Chrome 83