cypress-io / cypress

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

Spurious failed spec error closing Cypress Runner window #29232

Open MikeMcC399 opened 5 months ago

MikeMcC399 commented 5 months ago

Current behavior

An error message is output when closing the Cypress Runner using the runner menu although there was no test running.

We detected that the electron tab running Cypress tests closed unexpectedly.

We have failed the current spec and aborted the run.

Desired behavior

If the Cypress Runner is closed without aborting any tests, such as by using the runner menu (File > Close Window), then no error message should be output.

Test code to reproduce

Execute

mkdir cy-closing
cd cy-closing
git init
npm init -y
npm install cypress
npx cypress open --e2e --browser electron

Select Continue In Cypress Runner select File > Close Window

image

Note error message:

We detected that the electron tab running Cypress tests closed unexpectedly.

We have failed the current spec and aborted the run.

Cypress Version

First reported for versions: 13.0.0 through 13.7.1 Also reproducible on: 13.14.2

Node version

v20.11.1 v20.17.0 LTS

Operating System

Ubuntu 22.04.4 LTS

Debug Logs

cypress:server:browsers:electron close fired on the BrowserWindow { browserWindowUrl: 'http://localhost:33217/__/' } +12s
  cypress:server:browsers:electron closed event fired +6ms
  cypress:server:windows error removing all extensions { err: TypeError: Object has been destroyed at Object.j (<embedded>:4291:111741) at BrowserWindow.<anonymous> (<embedded>:4291:125370)     at Object.onceWrapper (node:events:629:26)     at BrowserWindow.emit (node:events:526:35), extensions: undefined } +29s
  cypress:server:browsers browser instance exit event received { code: undefined, signal: undefined } +10s
  cypress:server:browsers:electron closing remote interface client { options: {} } +1ms
  cypress:server:browsers:cri-client closing cri client { closed: false, target: 'BE5D0EC6AE749684900A400BC823B24D' } +12s
  cypress:server:browsers:browser-cri-client Target.targetDestroyed { event: { targetId: 'BE5D0EC6AE749684900A400BC823B24D' }, closing: true, closed: false, resettingBrowserTargets: false } +12s
  cypress:server:browsers:cri-client not closing, cri client is already closed { closed: true, target: 'BE5D0EC6AE749684900A400BC823B24D' } +23ms
  cypress:server:browsers:cri-client closed cri client { closed: true, target: 'BE5D0EC6AE749684900A400BC823B24D' } +4ms
  cypress:server:browsers:cri-client closing cri client { closed: false, target: 'ws://127.0.0.1:44319/devtools/browser/8e4ecb82-0413-4e70-9dbc-85b1f4070961' } +3ms
  cypress:server:browsers:cri-client closed cri client { closed: true, target: 'ws://127.0.0.1:44319/devtools/browser/8e4ecb82-0413-4e70-9dbc-85b1f4070961' } +7ms
  cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 60652 } +5s
  cypress:server:browsers:browser-cri-client browser websocket did not close, page was closed { targetId: 'BE5D0EC6AE749684900A400BC823B24D' } +512ms
We detected that the electron tab running Cypress tests closed unexpectedly.

We have failed the current spec and aborted the run.

Other

dbry23 commented 4 months ago

I'll add my two cents and confirm this same behavior with Node 20.12.2, Cypress 13.8.1, and Windows 11.