cypress icon indicating copy to clipboard operation
cypress copied to clipboard

Cypress hangs when running multiple spec files but not one by one

Open mauriciabad opened this issue 2 years ago • 9 comments

Current behavior

When I run 4 specific tests in headless mode, cypress freezes when starting to run the 2nd or 3rd spec file.

The same tests pass in this conditions:

  • If you run the tests with cypress open.
  • If you run them individually, deleting the other 3 tests.

The last thing I can see in the console is:


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  home.spec.ts                                                                    (3 of 4)

Timed out waiting for the browser to connect. Retrying...

Timed out waiting for the browser to connect. Retrying again...

The browser never connected. Something is wrong. The tests cannot run. Aborting...

The browser never connected. Something is wrong. The tests cannot run. Aborting...
Warning: We failed processing this video.

This error will not affect or change the exit code.

TimeoutError: operation timed out
    at afterTimeout (/home/runner/.cache/Cypress/12.11.0/Cypress/resources/app/node_modules/bluebird/js/release/timers.js:46:19)
    at Timeout.timeoutTimeout [as _onTimeout] (/home/runner/.cache/Cypress/12.11.0/Cypress/resources/app/node_modules/bluebird/js/release/timers.js:76:13)
    at listOnTimeout (node:internal/timers:559:17)
    at process.processTimers (node:internal/timers:502:7)

  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        0                                                                                │
  │ Passing:      0                                                                                │
  │ Failing:      1                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  0                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     0 seconds                                                                        │
  │ Spec Ran:     home.spec.ts                                                                     │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘

Desired behavior

That tests pass.

In case this is a problem with my code. I expect that cypress crashes gracefully with an error message, instead of just hanging.

Test code to reproduce

https://github.com/mauriciabad/wordspy/pull/23

I can't isolate the test that makes the error (When I isolate the tests, they work), so this is the minimum reproducible version I'm able to give you.

You can check the CI to see the failing tests.

Cypress Version

12.11.10

Node version

18.16.0

Operating System

Ubuntu 22.04.2 LTS

Debug Logs

https://raw.githubusercontent.com/mauriciabad/wordspy/cypress-issue-report/logs.txt

(They are too long, github doesn't let me submit)

Other

I don't know if it's related but, I saw this lines in the debug logs:

"Uncaught Error: Something went terribly wrong and we cannot proceed. We expected to find the global Cypress in the parent window but it is missing. This should never happen and likely is a bug. Please open an issue."
cypress:server:browsers killing browser process
cypress:server:browsers browser process killed

mauriciabad avatar May 07 '23 23:05 mauriciabad

Could you try using the official github action and see if that yields a better result? If not, maybe try running the tests in Chrome (instead of the default, Electron)?

chrisbreiding avatar May 11 '23 12:05 chrisbreiding

I tried using the official GitHub action with electron, and it doesn't work. But using chrome works.

This may look like using chrome solves the issue, but the bug is still there. The code is right, and tests should be passing in both browsers.

Logs

Electron: https://github.com/mauriciabad/wordspy/actions/runs/4973594173/jobs/8899535122?pr=23 Chrome: https://github.com/mauriciabad/wordspy/actions/runs/4973608122/jobs/8899557606?pr=23

mauriciabad avatar May 14 '23 17:05 mauriciabad

Thanks for trying that out. Tests should definitely be passing in both browsers. It's useful to know that it might be isolated to an issue with Electron.

I'm going to forward this ticket to the appropriate team. They will evaluate the priority of this ticket and consider their capacity to pick it up. Please note that this does not guarantee that this issue will be resolved. The ticket will indicate status changes during evaluation, so we ask that you please refrain from asking for updates. Thanks!

chrisbreiding avatar May 15 '23 12:05 chrisbreiding

@chrisbreiding This is similarly encountered in Firefox. Hope you check it there as well.

nloutadeo avatar Aug 29 '23 02:08 nloutadeo

@chrisbreiding Was this resolved, I am facing the same error on Firefox!

joseph-luketelo avatar Feb 12 '24 15:02 joseph-luketelo

I'm also now facing this error when using Firefox. It started happening on its own in the last 24 hours, and only on about half of our tests in any given run.

phoebejaffe avatar Mar 19 '24 18:03 phoebejaffe

I'm also now facing this error when using Firefox. It started happening on its own in the last 24 hours, and only on about half of our tests in any given run.

We are also seeing this after installing Firefox 124. Always on multiple tests running synchronously, always on Firefox. On CI, first test in the set runs fine, then this failure at the start of the second test.


Error: connect ECONNREFUSED 127.0.0.1:32853
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
Test run failed, code 1
More information might be available above
Cypress module has returned the following error message:
Could not find Cypress test run results
Error: Could not find Cypress test run results

On local cypress run, the second test has the following:

Still waiting to connect to Firefox, retrying in 1 second (attempt 19/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 20/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 21/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 22/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 23/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 24/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 25/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 26/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 27/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 28/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 29/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 30/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 31/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 32/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 33/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 34/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 35/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 36/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 37/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 38/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 39/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 40/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 41/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 42/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 43/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 44/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 45/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 46/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 47/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 48/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 49/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 50/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 51/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 52/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 53/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 54/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 55/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 56/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 57/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 58/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 59/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 60/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 61/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 62/62)
Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 50 seconds.

This usually indicates there was a problem opening the Firefox browser.

The CDP port requested was 57510.

Error: Could not find url target in browser about:blank. Targets were []
    at <embedded>:4489:71485
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async n (<embedded>:4489:70649)
    at async Object.connectToNewSpec (<embedded>:4489:166476)
    at async Object.O (<embedded>:4495:7500)
    at async Object.connectToNewSpec (<embedded>:4495:25721)
    at async v.relaunchBrowser (<embedded>:4561:147231)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

akepley0280 avatar Mar 20 '24 13:03 akepley0280

The Firefox 124 issue is being resolved with https://github.com/cypress-io/cypress/pull/29179 and should be released soon.

mschile avatar Mar 21 '24 16:03 mschile