Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress fails to connect to devTools after first test #1156

Closed
sawmurai opened this issue Mar 20, 2024 · 13 comments
Closed

Cypress fails to connect to devTools after first test #1156

sawmurai opened this issue Mar 20, 2024 · 13 comments
Labels
browser: firefox bug Something isn't working

Comments

@sawmurai
Copy link

sawmurai commented Mar 20, 2024

Hello team :)

This issue started to occur yesterday. We test using firefox and yesterday firefox 124 was released, so maybe this is related. Locally everything works fine with firefox 124.

I think this is the most important line of the log below:

There was an error reconnecting to the Chrome DevTools protocol. Please restart the browser.

I hope this report is useful.

Output of Cypress run step
Run cypress-io/github-action@v5
  with:
    browser: firefox
    working-directory: packages/e2e-system
    start: yarn fixtures:use
    wait-on: http://localhost:8666/src/components/base-data
    record: false
    publish-summary: true
    component: false
  env:
    VITE_APP_GENERATE_TOKEN_URL_SERVER: http://localhost:8080/token
    VITE_APP_GENERATE_TOKEN_URL: http://localhost:8080/token
    PROXY_PORT: 8080
    VITE_PORT: 8666
    PROXY_HOST: localhost
    CI: 1
    FRONTGATE_HOST: wss://<REMOVED BECAUSE SENSITIVE>/ws
Cache Size: ~163 MB (170970637 B)
/usr/bin/tar -xf /home/ubuntu/actions-runner/_work/_temp/7351a40c-4608-4719-8519-a8818b284f0c/cache.tzst -P -C /home/ubuntu/actions-runner/_work/library/library --use-compress-program unzstd
Cache restored successfully
Cache Size: ~798 MB (836245800 B)
/usr/bin/tar -xf /home/ubuntu/actions-runner/_work/_temp/6b45df07-5508-412d-af6f-d3be1299b92a/cache.tzst -P -C /home/ubuntu/actions-runner/_work/library/library --use-compress-program unzstd
Cache restored successfully
/usr/local/bin/yarn --frozen-lockfile
yarn install v1.22.22
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 1.01s.
/opt/hostedtoolcache/node/18.19.1/x64/bin/npx cypress cache list
┌─────────┬──────────────┐
│ version │ last used    │
├─────────┼──────────────┤
│ 12.17.4 │ a minute ago │
└─────────┴──────────────┘
start server command "yarn fixtures:use"
current working directory "/home/ubuntu/actions-runner/_work/library/library/packages/e2e-system"
waiting on "http://localhost:8666/src/components/base-data" with timeout of 60 seconds
/usr/local/bin/yarn fixtures:use
yarn run v1.22.22
$ yarn concurrently -k -s first 'yarn preview --host' 'yarn server'
$ /home/ubuntu/actions-runner/_work/library/library/node_modules/.bin/concurrently -k -s first 'yarn preview --host' 'yarn server'
[1] $ node ./server/index.js
[0] $ vite preview --host
[1] :  Listening!
[0]   ➜  Local:   http://localhost:8666/
[0]   ➜  Network: [http://10.128.110.234:](http://10.128.110.234/)8666/

DevTools listening on ws://127.0.0.1:37065/devtools/browser/c2eda6b3-70d0-4cd1-a47a-94618d689951
[2111:0320/063143.494726:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
(node:2130) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2130) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        12.17.4                                                                        │
  │ Browser:        Firefox 124 (headless)                                                         │
  │ Node Version:   v16.20.1 (/home/ubuntu/actions-runner/externals/node16/bin/node)               │
  │ Specs:          165 found (alert-badge.cy.ts, alert-history-list.cy.ts, alert-notifications.cy │
  │                 .ts, alert-trigger-controls.cy.ts, alert-trigger-toggle.cy.ts, alert-triggers- │
  │                 list.cy.ts, analysts-sentiment.cy.ts, arbitrage-list.cy.ts, assets-list.cy.ts, │
  │                  base-data.cy.ts, bond-b...)                                                   │
  │ Searched:       cypress/e2e/**/*.cy.{js,jsx,ts,tsx}                                            │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  alert-badge.cy.ts                                                             (1 of 165)
Still waiting to connect to Firefox, retrying in 1 second (attempt 18/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 18/62)
Still waiting to connect to Firefox, retrying in 1 second (attempt 19/62)
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 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 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 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 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 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 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 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 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 28/62)


  test
    ✓ compares the screenshot (4422ms)


  1 passing (4s)


  (Results)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Tests:        1                                                                                │
  │ Passing:      1                                                                                │
  │ Failing:      0                                                                                │
  │ Pending:      0                                                                                │
  │ Skipped:      0                                                                                │
  │ Screenshots:  1                                                                                │
  │ Video:        false                                                                            │
  │ Duration:     4 seconds                                                                        │
  │ Spec Ran:     alert-badge.cy.ts                                                                │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


  (Screenshots)

  -  /home/ubuntu/actions-runner/_work/library/library/packages/e2e-system/cypress/sc     (1280x720)
     reenshots/alert-badge.cy.ts/alert-badge.cy.ts-page.png                                         


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  alert-history-list.cy.ts                                                      (2 of 165)
There was an error reconnecting to the Chrome DevTools protocol. Please restart the browser.

Error: connect ECONNREFUSED 127.0.0.1:41601
    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

Cypress: 12.7.4
Github action version: cypress-io/github-action@v5

I tried upgrading to the latest of both, but then I get another error. Also, the combination above worked up to yesterday.

Greetings from Switzerland!

@MikeMcC399
Copy link
Collaborator

@sawmurai

If the issue is due to Firefox 124, then you may be able to work around the issue by using a Cypress Docker image. You can lock your workflow for instance to Firefox 123 with cypress/browsers:node-20.11.0-chrome-121.0.6167.184-1-ff-123.0-edge-121.0.2277.128-1.

Your log shows you are using Ubuntu, however I could not see which GitHub runner version you are using. There is currently a roll-out of ubuntu-22.04 taking place (see actions/runner-images#9532) which updates Firefox from 123 to 124. This version is not available everywhere at the moment and is in status "Deployment". The example https://github.com/cypress-io/github-action/actions/workflows/example-firefox.yml workflow is not showing any issue at this time, however this is still running on Firefox 123.

Node.js 16 reached end-of-life on Sep 11, 2023. Since cypress-io/github-action@v5 uses Node.js 16, it is no longer supported. cypress-io/github-action@v6 is the only currently supported version of the action. The error you are seeing

There was an error reconnecting to the Chrome DevTools protocol. Please restart the browser.

Error: connect ECONNREFUSED 127.0.0.1:41601
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)

is however unlikely to be caused the action.

@MikeMcC399
Copy link
Collaborator

@sawmurai

I can't reproduce any issue with Firefox 124 and Cypress 13.7.0 locally on Ubuntu 22.04 or Windows 11. I have however seen CircleCI hanging with Firefox 124.

There may be a compatibility issue between Firefox 124 and Cypress. If that is a general issue, then it would need to be logged to https://github.com/cypress-io/cypress/issues. So far nobody else has reported any similar issue.

@sawmurai
Copy link
Author

@MikeMcC399

Thank you for the quick response! I tried using the docker image you recommended, but strangely Cypress complained about firefox not being installed:

Output of cypress run step
Run cypress-io/github-action@v5
  with:
    browser: firefox
    working-directory: packages/e2e-system
    start: yarn fixtures:use
    wait-on: http://localhost:8666/src/components/base-data
    record: false
    publish-summary: true
    component: false
  env:
    VITE_APP_GENERATE_TOKEN_URL_SERVER: http://localhost:8080/token
    VITE_APP_GENERATE_TOKEN_URL: http://localhost:8080/token
    PROXY_PORT: 8080
    VITE_PORT: 8666
    PROXY_HOST: localhost
    CI: 1
    FRONTGATE_HOST: wss://<>/ws
/usr/bin/docker exec  eb16d3401dc4b49e8a0ab779c819ff7f2c2944ef3f0a0a9f0a5d54d95e2e4ef6 sh -c "cat /etc/*release | grep ^ID"
Cache Size: ~172 MB (180493164 B)
/bin/tar -xf /__w/_temp/dbd12bfb-4384-423b-bb4f-f71fe65c52e8/cache.tgz -P -C /__w/library/library -z
Cache restored successfully
/usr/local/bin/yarn --frozen-lockfile
yarn install v1.22.19
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.91s.
/__t/node/18.19.1/x64/bin/npx cypress cache list
┌─────────┬───────────────────┐
│ version │ last used         │
├─────────┼───────────────────┤
│ 12.17.4 │ a few seconds ago │
└─────────┴───────────────────┘
/__t/node/18.19.1/x64/bin/npx cypress verify
[STARTED] Task without title.
[SUCCESS] Task without title.
Saving npm cache error: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.
/bin/tar --posix -cf cache.tgz --exclude cache.tgz -P -C /__w/library/library --files-from manifest.txt -z
Failed to save: Unable to reserve cache with key cypress-linux-x64-0309b95e3436eda3ba9ba25d52a00622f91d163f7e8205e98e637ff6828f480b46df2053409a019a5d28b33f251526513be027ab5b0042c04c7a3e9cea4e9d21, another job may be creating this cache. More details: Cache already exists. Scope: refs/pull/4584/merge, Key: cypress-linux-x64-0309b95e3436eda3ba9ba25d52a00622f91d163f7e8205e98e637ff6828f480b46df2053409a019a5d28b33f251526513be027ab5b0042c04c7a3e9cea4e9d21, Version: f505cd510c21b306bf40fa93afa2c89cd39c4f64b1484f6c4510c045f410733e
start server command "yarn fixtures:use"
current working directory "/__w/library/library/packages/e2e-system"
waiting on "http://localhost:8666/src/components/base-data" with timeout of 60 seconds
/usr/local/bin/yarn fixtures:use
yarn run v1.22.19
$ yarn concurrently -k -s first 'yarn preview --host' 'yarn server'
$ /__w/library/library/node_modules/.bin/concurrently -k -s first 'yarn preview --host' 'yarn server'
[1] $ node ./server/index.js
[0] $ vite preview --host
[1] :  Listening!
[0]   ➜  Local:   http://localhost:8666/
[0]   ➜  Network: [http://172.18.0.2:](http://172.18.0.2/)8666/
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[976:0320/091640.550635:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

DevTools listening on ws://127.0.0.1:42727/devtools/browser/0cee565d-d734-43f7-880b-04c2405bb3ac
(node:996) ExperimentalWarning: Custom ESM Loaders is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:996) ExperimentalWarning: The Node.js specifier resolution flag is experimental. It could change or be removed at any time.
Can't run because you've entered an invalid browser name.

Browser: firefox was not found on your system or is not supported by Cypress.

Cypress supports the following browsers:
 - electron
 - chrome
 - chromium
 - chrome:canary
 - edge
 - firefox

You can also use a custom browser: https://on.cypress.io/customize-browsers

Available browsers found on your system are:
 - chrome
 - edge
 - electron
Can't run because you've entered an invalid browser name.

Browser: firefox was not found on your system or is not supported by Cypress.

Cypress supports the following browsers:
 - electron
 - chrome
 - chromium
 - chrome:canary
 - edge
 - firefox

You can also use a custom browser: https://on.cypress.io/customize-browsers

Available browsers found on your system are:
 - chrome
 - edge
 - electron
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

Not sure if I did something wrong, but I used it like so in the workflow file:

...

jobs:
  test:
    timeout-minutes: 60
    runs-on: ubuntu-latest
    container:
      image: cypress/browsers:node-20.11.0-chrome-121.0.6167.184-1-ff-123.0-edge-121.0.2277.128-1
    steps:
...

Should I then just go ahead and raise this issue again in the cypress repo?

@MikeMcC399
Copy link
Collaborator

MikeMcC399 commented Mar 20, 2024

@sawmurai

Thank you for the quick response! I tried using the docker image you recommended, but strangely Cypress complained about firefox not being installed:

You need to follow the documentation Docker image and add options: --user 1001 to your workflow. Firefox has security which prevents it from running as root.

Should I then just go ahead and raise this issue again in the cypress repo?

In the meantime the deployment has included this repo, so I could test with Firefox 124 and the test is passing. This means that Firefox 124 with Cypress is not completely broken. (see below #1156 (comment)).

My advice would be to first add the missing options: --user 1001 and check if your tests run, before deciding on any other next steps.

@MikeMcC399
Copy link
Collaborator

@sawmurai

There is a reproducible issue using the full set of Cypress examples, so I will log a new issue for this and link it back here. Stand by!

@MikeMcC399
Copy link
Collaborator

Now logged under cypress-io/cypress#29172

@MikeMcC399
Copy link
Collaborator

@sawmurai

@MikeMcC399 MikeMcC399 added bug Something isn't working browser: firefox labels Mar 20, 2024
@sawmurai
Copy link
Author

Closing as suggested. Thank you! :)

@MikeMcC399
Copy link
Collaborator

See [email protected] for a fix for this issue.

@ml-evs
Copy link

ml-evs commented Apr 11, 2024

Hi @MikeMcC399, been tracking this issue as currently you can't use this action with firefox without pinning a specific browser container version. Are you planning to make a release of this action in the near future that uses 13.7.1? Thanks

@MikeMcC399
Copy link
Collaborator

@ml-evs

Are you planning to make a release of this action in the near future that uses 13.7.1?

There is a misconception in your question. The action has no version of Cypress hard-coded in it. To use a specific version of
Cypress with the action you would install the version as a dependency. For example, if you are using npm as package manager

npm install [email protected] --save-dev

This will put [email protected] into your package.json and package-lock.json files. The action then uses package-lock.json to install your configured dependencies. See Installation .

So no, there are no plans to release the action to use 13.7.1, because a release is not necessary for this. The examples in this repo are already using 13.7.2 and will soon be updated to use 13.7.3.

If you need help from the Cypress technical community on using Cypress and / or this Cypress JavaScript GitHub Action, you are free to join the Discord chat (click on button).

@ml-evs
Copy link

ml-evs commented Apr 12, 2024

Ahhh, gotcha, thanks for the help. I was confused by the commit that updated to 13.7.1 in this repo but that makes sense now.

@MikeMcC399
Copy link
Collaborator

@ml-evs

Ahhh, gotcha, thanks for the help. I was confused by the commit that updated to 13.7.1 in this repo but that makes sense now.

It's a little confusing because this repo contains the action AND examples for the action. The examples are used to test the action with current versions of Cypress and they serve as learning tools for anybody who would like to fork the repo and run the example workflows themselves.

I've just submitted a PR to update the examples once again. This time it is to update to Cypress 13.7.3 which was released yesterday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser: firefox bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants