In headless electron (headed electron works fine), the process hangs forever when doing the below steps.
Basically, you do something like this in a.spec.js
:
cy.visit(`https://google.com`)
cy.window().then(win => {
win.history.pushState({}, null, `/`)
});
cy.go(-1);
and in b.spec.js
you retrieve an elem:
cy.get('.item');
I know that the 2nd spec file isn't really a valid use case (since we haven't yet loaded a page), but I've wanted to create the smallest reproducible test case.
I'm not really sure what's going on, but there are several significant things that must be done:
window.location.go(-1)
and in the next spec (must be a different file so that Cypress runner closes & opens new window), retrieve a DOM elem.
This last step is weird because before I managed to narrow it down to this smallest reproduction, I've been doing much more in my real-world spec, and it failed only on one particular DOM retrieval. Don't have a clue, but it also reproduces when I simply query the DOM, without loading a page.
DEBUG=cypress:*
doesn't show anything interesting, I think --- no new messages are logged after it hangs.Should not hang.
https://github.com/dwelle/cypress-test-tiny/tree/dwelle_hang
and run:
npx cypress run --spec cypress/integration/a.spec.js,cypress/integration/b.spec.js
The url links to the branch directly. Refer to README, if need be.
3.5.0
(3.4.1
works)I can confirm, this hangs forever during cypress run
(does not happen when --browser chrome
. This does not hang in 3.4.1.
I had to manually close the Cypress application to get it to stop running.
DEBUG logs at hang
cypress:server:project received runnables { id: 'r1', title: '', root: true, type: 'suite', tests: [ { id: 'r2', title: 'history get item', body: "function () {\n cy.get('.item');\n}", type: 'test' } ], suites: [] } +813ms
cypress:server:reporter trying to load reporter: spec +2s
cypress:server:reporter spec is Mocha reporter +0ms
cypress:server:project onMocha start +5ms
cypress:server:reporter got mocha event 'start' with args: [ { start: '2019-10-28T16:27:19.404Z' } ] +5ms
cypress:server:project onMocha suite +1ms
cypress:server:reporter got mocha event 'suite' with args: [ { id: 'r1', title: '', root: true, type: 'suite' } ] +1ms
cypress:server:project onMocha test +24ms
cypress:server:reporter got mocha event 'test' with args: [ { id: 'r2', title: 'history get item', body: "function () {\n cy.get('.item');\n}", type: 'test' } ] +24ms
cypress:server:socket automation:request get:cookies { domain: 'localhost' } +63ms
cypress:server:cookies getting:cookies { domain: 'localhost' } +5s
cypress:server:cookies received get:cookies [] +1ms
cypress:browserify finished bundling: /Users/jennifer/Library/Application Support/Cypress/cy/production/projects/cypress-transform-test-74d5161f4a1005f86b0d85a657ddcf07/bundles/cypress/integration/spec2.js +16ms
cypress:server:controllers:spec sending spec { filePath: '/Users/jennifer/Library/Application Support/Cypress/cy/production/projects/cypress-transform-test-74d5161f4a1005f86b0d85a657ddcf07/bundles/cypress/integration/spec2.js' } +10ms
cypress:server:project received runnables { id: 'r1', title: '', root: true, type: 'suite', tests: [ { id: 'r2', title: 'history get item', body: "function () {\n cy.get('.item');\n}", type: 'test' } ], suites: [] } +813ms
cypress:server:reporter trying to load reporter: spec +2s
cypress:server:reporter spec is Mocha reporter +0ms
cypress:server:project onMocha start +5ms
cypress:server:reporter got mocha event 'start' with args: [ { start: '2019-10-28T16:27:19.404Z' } ] +5ms
cypress:server:project onMocha suite +1ms
cypress:server:reporter got mocha
specfile1.js
it('history go', () => {
cy.visit(`https://google.com`)
cy.window().then(win => {
win.history.pushState({}, null, `/`)
});
cy.go('back');
})
specfile2.js
it('history get item', () => {
cy.get('.item')
})
Run tests in cypress run
with the --browser
flag specifying an installed version of Chrome.
Hi, just updated to the 3.5.0 as well and the same behaviour happens.
Cypress: 3.5.0 │
│ Browser: Electron 73 │
│ Specs: 6 found (data/investigate.spec.ts, data/missing-numbers.spec.ts, data/pagination.s │
│ pec.ts, data/search.spec.ts, data/sort.spec.ts, data/text-filter.spec.ts) │
│ Searched: cypress/integration/data/*
In our case, it is always hanging after the first it
in the second matched spec
(whatever order it may be). Switching to chrome ( 72) also let the tests continue.
Can we get an update on this? It's a blocking regression that prevents from upgrading from 3.4.1
(I don't know of any workaround).
Is there any chance this will be fixed in 3.6.1? Causing issues here too.
I think this is a broader issue than the comment suggests - HTML5 navigation in general seems to cause Cypress to hang.
Maybe related: https://github.com/cypress-io/cypress/issues/5645
Also likely related: https://github.com/cypress-io/cypress/issues/5596
I spent a few hours debugging this - I believe it is a bug in electron
core. I have tried dozens of different possible workarounds involving clearing session, cache, partitions, etc and nothing is working as of yet.
Confirmed this is a bug in electron. It is still failing in 6.1.5
but it is working in 7.1.2
.
Looks like we can fix this by upgrading electron.
The code for this is done in cypress-io/cypress#5849, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
Released in 3.8.0
.
@jennifer-shehane sorry for commenting on closed ticket. I am kind of facing similar issue running tests in docker. After the first test spec cypress hangs on forever.
I am using "cypress/browsers:node13.6.0-chrome80-ff72" image. Also pasting the logs of cypress in debug mode.
[34;1mcypress:server:browsers:chrome [0mconnecting to Chrome remote interface at random port 44619 [34m+15ms[0m
[33;1mcypress:server:protocol [0mGetting WS connection to CRI on port 44619 [33m+2s[0m
[31;1mcypress:launcher [0mchrome stderr: [2265:2280:0423/035613.707142:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [31m+148ms[0m
[32;1mcypress:network:connect [0mreceived error on connect, retrying { iteration: [33m0[39m, delay: [33m100[39m, err: Error: connect ECONNREFUSED 127.0.0.1:44619 [90m at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)[39m { errno: [32m'ECONNREFUSED'[39m, code: [32m'ECONNREFUSED'[39m, syscall: [32m'connect'[39m, address: [32m'127.0.0.1'[39m, port: [33m44619[39m } } [32m+260ms[0m
[31;1mcypress:launcher [0mchrome stderr: [2265:2265:0423/035613.708675:ERROR:edid_parser.cc(102)] Too short EDID data: manufacturer id [31m+1ms[0m
[31;1mcypress:launcher [0mchrome stderr: [2265:2289:0423/035613.731195:ERROR:bus.cc(393)] Failed to connect to the bus: Address does not contain a colon [31m+23ms[0m
[31;1mcypress:launcher [0mchrome stderr: DevTools listening on ws://127.0.0.1:44619/devtools/browser/bf00290b-61c9-4229-808a-d016583652d7 [31m+7ms[0m
[31;1mcypress:launcher [0mchrome stderr: [2265:2289:0423/035613.741804:ERROR:bus.cc(393)] Failed to connect to the bus: Address does not contain a colon
[2265:2289:0423/035613.741826:ERROR:bus.cc(393)] Failed to connect to the bus: Address does not contain a colon [31m+4ms[0m
[31;1mcypress:server:server [0mGot CONNECT request from www.gstatic.com:443 [31m+234ms[0m
@jennifer-shehane sorry for commenting on closed ticket. I am kind of facing similar issue running tests in docker. After the first test spec cypress hangs on forever.
I am using "cypress/browsers:node13.6.0-chrome80-ff72" image. Also pasting the logs of cypress in debug mode.[34;1mcypress:server:browsers:chrome �[0mconnecting to Chrome remote interface at random port 44619 �[34m+15ms�[0m
�[33;1mcypress:server:protocol �[0mGetting WS connection to CRI on port 44619 �[33m+2s�[0m
�[31;1mcypress:launcher �[0mchrome stderr: [2265:2280:0423/035613.707142:ERROR:bus.cc(393)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory �[31m+148ms�[0m
�[32;1mcypress:network:connect �[0mreceived error on connect, retrying { iteration: �[33m0�[39m, delay: �[33m100�[39m, err: Error: connect ECONNREFUSED 127.0.0.1:44619 �[90m at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)�[39m { errno: �[32m'ECONNREFUSED'�[39m, code: �[32m'ECONNREFUSED'�[39m, syscall: �[32m'connect'�[39m, address: �[32m'127.0.0.1'�[39m, port: �[33m44619�[39m } } �[32m+260ms�[0m
�[31;1mcypress:launcher �[0mchrome stderr: [2265:2265:0423/035613.708675:ERROR:edid_parser.cc(102)] Too short EDID data: manufacturer id �[31m+1ms�[0m
�[31;1mcypress:launcher �[0mchrome stderr: [2265:2289:0423/035613.731195:ERROR:bus.cc(393)] Failed to connect to the bus: Address does not contain a colon �[31m+23ms�[0m
�[31;1mcypress:launcher �[0mchrome stderr: DevTools listening on ws://127.0.0.1:44619/devtools/browser/bf00290b-61c9-4229-808a-d016583652d7 �[31m+7ms�[0m
�[31;1mcypress:launcher �[0mchrome stderr: [2265:2289:0423/035613.741804:ERROR:bus.cc(393)] Failed to connect to the bus: Address does not contain a colon
[2265:2289:0423/035613.741826:ERROR:bus.cc(393)] Failed to connect to the bus: Address does not contain a colon �[31m+4ms�[0m
�[31;1mcypress:server:server �[0mGot CONNECT request from www.gstatic.com:443 �[31m+234ms�[0m
I meet the same error, is there any update?
This issue will be closed to further comment as the exact issue here was resolved and tested.
If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.
Most helpful comment
Confirmed this is a bug in electron. It is still failing in
6.1.5
but it is working in7.1.2
.Looks like we can fix this by upgrading electron.