cypress: Cannot read properties of undefined (reading 'currentlyAttachedTarget')
Hi there,
Current behavior
Timed out waiting for the browser to connect. Retrying...
Cannot read properties of undefined (reading 'currentlyAttachedTarget')
TypeError: Cannot read properties of undefined (reading 'currentlyAttachedTarget')
at Object.connectToNewSpec (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/lib/browsers/chrome.js:431:48)
at Object.connectToNewSpec (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/lib/browsers/index.js:139:27)
at /path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/lib/open_project.js:148:47
at tryCatcher (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromiseCtx (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:641:10)
at _drainQueueStep (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:97:12)
at _drainQueue (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues (/path/to/.cache/Cypress/10.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (node:internal/timers:464:21)
111
Desired behavior
no error
Test code to reproduce
I got this error many times with cypress run --browser chromium
. The test file includes 10~20 testcases.
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 10.2.0 │
│ Browser: Chromium 101 (headless) │
│ Node Version: v16.12.0 (/usr/bin/node) │
│ Params: Tag: false, Group: false, Parallel: false
Cypress Version
10.2.0
Other
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 8
- Comments: 15 (3 by maintainers)
Actually, I have reached out to someone who is familiar with this logic and it appears this is a mistake on how we are re-launching a browser after the first spec if the browser process is corrupt. This should be a relatively straightforward fix. Thank you for reporting!
Any update or workaround on this issue? running into this in version 10.0.0, 10.3.0 and 10.9.0. Need to stay 10.0 and above for NextJS compatibility.
Sorry-cypress issue was fixed in v2.3.0, thanks @alyssa-glean for providing a solution.
The original problem of cypress runner closing the browser (or not populating
currentlyAttachedTarget
in browser-cri-client) is still a separate bug, though, not related to dashboard orchestration.Ah, there’s a buggy interaction between Cypress 10 and
sorry-cypress
which causes the browser to get closed before the final spec runs (because the penultimate spec is reported as N of N). The root cause is really a sorry-cypress bug, raised with them here: https://github.com/sorry-cypress/sorry-cypress/issues/613.Just adding this for info in case it helps anyone. The
TypeError
mentioned in this issue is still a separate bug in Cypress that should be fixed 😄