cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.79k stars 3.17k forks source link

Message "DevTools listening on ws://127.0.0.1" #26753

Open MikeMcC399 opened 1 year ago

MikeMcC399 commented 1 year ago

Current behavior

When Cypress is run (open, run or through Module API) a message similar to the following is output to the console:

DevTools listening on ws://127.0.0.1:37973/devtools/browser/6aaa0851-45ea-4db9-9185-d2e228ef6787

Desired behavior

The message "DevTools listening on ws://127.0.0.1" should not be output when Cypress is run.

If it is not avoidable, then document the change to the user experience in the CHANGELOG for 12.12.0 or elsewhere.

Test code to reproduce

npx cypress open

See logs https://github.com/cypress-io/cypress-example-kitchensink/actions/workflows/single.yml?query=branch%3Amaster

Cypress Version

First reported on Cypress 12.12.0 This is new behavior which did not occur on 12.11.0 Still occurs on Cypress 13.14.2.

Node version

18.16.1 and v20.15.0

Operating System

Ubuntu 22.04

2023-05-12T13:42:54.8668087Z Current runner version: '2.304.0'
2023-05-12T13:42:54.8702511Z Ubuntu
2023-05-12T13:42:54.8702775Z 22.04.2
2023-05-12T13:42:54.8703096Z LTS
2023-05-12T13:42:54.8704181Z Image: ubuntu-22.04
2023-05-12T13:42:54.8704559Z Version: 20230507.1
2023-05-12T13:42:54.8705134Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20230507.1/images/linux/Ubuntu2204-Readme.md
2023-05-12T13:42:54.8705873Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20230507.1

Debug Logs

See https://github.com/MikeMcC399/gpu-error-test/actions/workflows/gpu-test-base.yml

Other


It seems to be related to Chrome DevTools Protocol (cdp). Using Chrome DevTools Protocol > Protocol Fundamentals says:

Protocol Fundamentals

When Chromium is started with a --remote-debugging-port=0 flag, it starts a Chrome DevTools Protocol server and prints its WebSocket URL to STDERR. The output looks something like this:

DevTools listening on ws://127.0.0.1:36775/devtools/browser/a292f96c-7332-4ce8-82a9-7411f3bd280a

MikeMcC399 commented 1 year ago

The message DevTools listening on ws://127.0.0.1 is not always output.

On a clean install of Ubuntu 22.04.2 LTS with only the default Firefox browser installed, I am not seeing it.

On Windows 11 with latest Google Chrome and Firefox installed, I am however seeing it.

GitHub is also consistently showing it.

warrensplayer commented 1 year ago

Fix for issue: https://github.com/cypress-io/cypress/issues/15932 was released in 12.12.0 with PR https://github.com/cypress-io/cypress/pull/26573.

This may be the cause of this message.

MikeMcC399 commented 1 year ago

The message is also mentioned in https://developer.chrome.com/articles/new-headless/#debugging

andrii-lundiak commented 12 months ago

@MikeMcC399 so, Oct-2023, did you find out the way how to disable or suppress that "DevTools listening on" message? My point is that if I run Cypress v13.3.0 (relying on Electron v114) running on NodeJS v18.17.1 on CI and locally on WSL/Ubuntu, it's 100% headless mode, so I will not reach a GUI anyway so why should 1) use software for devtool/debugging and 2) why should I have that output?.

Your answer/comment above gave me hint that if any other browsers installed besides Electron than issues doesn't exist. My Ubuntu is basic ubuntu-latest on Azure CI pipeline space, and I don't have any browsers there like Chrome or FireFox.

And I would also expect that some env variable should help me to disable it, like ELECTRON_EXTRA_LAUNCH_ARGS='--andrii-asks-electron-engine-to-not-use-dev-tools'. Do you think it's even possible?

MikeMcC399 commented 12 months ago

@andrii-lundiak

This is not my area of expertise, so we'd need some further input from Cypress experts, such as @warrensplayer.

MikeMcC399 commented 6 months ago

The explanation of the message is in

https://developer.chrome.com/articles/new-headless/#debugging

as already mentioned in https://github.com/cypress-io/cypress/issues/26753#issuecomment-1599375196.

This could be covered in the Cypress documentation with a comment about whether to ignore it or not. If it can be used for additional debugging in a Cypress environment, then the documentation could describe this as well.

Daniel-Spindler-Mandalay commented 6 months ago

Can we reopen this issue? We run cypress in Octopus Deploy (which executes within Windows Powershell) This "devtools running" is written to the console as a warning and therefore the step is never marked as completed successfully, even when all cypress tests run successfully - which is frustrating. We have tried a number of work arounds with no success.

Cypress makes the browser calls and should add an option to control this setting in the browser. It really should be off by default and opt in via a setting or flag?

MikeMcC399 commented 6 months ago

@Daniel-Spindler-Mandalay

I have re-opened this issue. I suggest you log also a separate new issue for your special case with Octopus Deploy.

There is a good case to suppress the message when running in CI if it is causing workflow issues:

DevTools listening on ws://127.0.0.1

The message occurs independently of the browser under test (Electron, Chrome, Firefox, Edge, etc.).

carlos-nevesaraujo commented 3 months ago

Run the script via powershell (before it was via cmd), it worked for me ! 😄

Daniel-Spindler-Mandalay commented 3 months ago

Run the script via PowerShell (before it was via cmd), it worked for me ! 😄

@carlos-nevesaraujo could you please elaborate? I am running using Windows Powershell and I still receive the devtools listening output to standard error and it is quite frustrating. Are you using PowerShell Core?

Can you reproduce the error and then the fix?