cypress: 10.3.0 regression - test runner randomly fails when running electron locally
Current behavior
So when running COMPONENT tests specs locally, the test runner randomly crashes out at varying specs. 🤔
ERR_FAILED (-2) loading 'http://localhost:51860/__/#/specs/runner?file=src/components/section-heading/section-heading.test.tsx'
Error: ERR_FAILED (-2) loading 'http://localhost:51860/__/#/specs/runner?file=src/components/section-heading/section-heading.test.tsx'
at rejectAndCleanup (node:electron/js2c/browser_init:161:7647)
at EventEmitter.stopLoadingListener (node:electron/js2c/browser_init:161:8022)
at EventEmitter.emit (node:events:390:28)
at EventEmitter.emit (node:domain:475:12)
Sometimes it fails at other specs. I have tested every single spec where it has crashed using cypress open - and all specs pass when run manually. I think there’s something up with the test runner inside of MACOS 12.4 (21F79)
Sometimes the test runner gets as far as (7 of 64) sometimes (16 of 64), and sometimes it gets to (26 of 64). 🤔 Im having a tough time trying to work out why the runner crashes out at various different specs, there is almost nothing else running while the cypress runner is working.
Desired behaviour
for all the specs to run, just like they do in CI
Test code to reproduce
Ill try and update this ticket with these details, but was hoping to gauge how many people are also finding this issue right now
Cypress Version
10.3.0
Other
Some other relevant dependencies:
"@emotion/css": "^11.5.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"cypress-real-events": "^1.7.1",
"@cypress/code-coverage": "^3.10.0",
MacOS 12.4 (21F79) running on an M1 MAX
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 6
- Comments: 44 (21 by maintainers)
I should also note that I’m seeing this crash super reliably right after the 32nd spec, rather than jumping around to various locations as you described. Could possibly be an OS difference.
Hi, @lmiller1990 I was trying to create a reproducible example, but unfortunately, I could not. The
cypress.config.tsand all the cypress-related files (support, index etc.) are the same for all projects. Then I have solved my problem by deleting theCypressfolder under theApplication Supportdir. When I track it down, I found that the following directory is the root cause:/Users/<myUsername>/Library/Application Support/Cypress/Partitions/interactive/Service Worker. Unfortunately, I could not track down which file under it caused the issue.I hope it helps the resolution of the issue in general, or at least for the ones who face similar to my case.
Alrighty! thats awesome intel, thank you @lmiller1990 - ill try and give that a go and see if the error still happens - and report back. 😃
Ok, I looked into this, here’s how you can use old Chromium versions. First, obtain the version you want. I grabbed one here: https://vikyd.github.io/download-chromium-history-version/#/
I downloaded the zip called
chrome-linux.zip. I also noticed Cypress has some old Chrome versions, if that’s useful to someone. Those are here.I got my desired version (say 90) and extracted it to my desktop:
chromeis the binary. I’m on linux so I can just./chrometo launch it, if you want to try browsing the web with an old verison of Chromium for whatever reason.You can customize available browsers in Cypress. See the docs. I did it:
Now I can see it:
You could easily queue up many versions like this for testing. I also think you can just do
yarn cypress open --browser <path_to_browser>but I like to have lots of them available for testing various things.Hmm good point, this got me thinking… it’s definitely possible to use a different version of Electron if you have it installed locally. Documentation.
We should be able to isolate this. First, we need to answer the question:
Downgrading the electron version we ship is a little more involved in just changing a dependency, but maybe we debug it like this:
cypress run --component --browser /usr/bin/some-electron-versionGood input - I feel like we are slowly closing in on this.
I think we’d all love to see this fixed 🥲 along with this other long standing electron issue: https://github.com/cypress-io/cypress/issues/15932
I am really unsure if this is even a bug in Cypress or a bug in electron. If anyone wants to dig into this, happy to assist - tons of good info here, but I don’t think I can actively debug this in the immediate future.
Thanks! Good to know this is isolated to electron… why is electron less reliable, I thought it would be shipping pretty much the same code as chrome, at least the core components.
FYI i worked out that the tests only ran in CI because we use chrome in CI. 🤪 I have updated the title to remove the reference to it being OK in CI
Yeah, it appears to work fine under Chrome, no crashes at all, so that’s a workaround. Added ‘electron’ to the title to help others locate the issue.
@glomotion are you able to invite @BlueWinds to your repo, too? They will be taking a look at this one. Thanks!
@glomotion Right, that’s what the GH repo invite was. (Was out for 1 week).
I will try running this and see if I run into the same problem. Having a minimal repro makes it sooooo much easier to debug and by extension much more likely the problem is solved, thanks for this!
Hi Tim - thanks for the bug report, your issues are always informative.
Normally the issue is the opposite - CI fails, local passes. Disabling code coverage -> success is even more weird. What plugins/libs/versions are you using for code coverage?
Does this happen in the previous version of Cypress? If it really was introduced 10.3.0, that’s a small surface area, it should be easy to fix - can you provide a minimal reproduction, along with answers to the above questions?