Cypress hangs on various Docker images and with very little executing
See original GitHub issuePreface:
Per the title, this has only been an issue when running in a Docker Container, or in a CI/CD platform like Gitlab. Running it on my Mac OS X (10.15.4 ) leveraging yarn add cypress
and running tests locally (yarn cypress run
) in the CLI or on the console (cypress open
) work. That is what makes this issue SUPER strange and hard to debug.
Issue:
I have used /included:4.X
versions, base:10
, as well as browser
node/chrome version. Just focusing on one for this issue to make it easier let’s focus on: cypress/browsers:node10.16.0-chrome77
No matter what I put after cy.get('a.card').first().click()
Cypress hangs indefinitely. The longest I have waited was 1hr. No crash, no logs, just hangs.
Since I have used so many versions I can only assume I am doing something wrong, but this is the only test/spec I am running and it works fine outside of any containerization. I have spend days trying to get over this hump.
So, an example problem is…
cypress/browsers:node10.16.0-chrome77
and running
yarn cypress run --headless --browser chrome
on the following spec in a cypress image, which works unless I add the last line, then it hangs.
describe('Check Basic Access', function () {
it('Login and Edit', () => {
cy.visit(`${Cypress.env('SITE')}/logout`)
window.localStorage.setItem('first-time-dashboard', false)
cy.get('input[placeholder=Email]').type(Cypress.env('UNAME'))
cy.get('input[placeholder=Password]').type(Cypress.env('PW'))
cy.get('button[data-smc=Button]').click()
cy.get('a.card').first().click() <----- This line hangs up the system without error
})
})
The hard thing to convey here is the hundreds of variations I have tried with routes
, waits
, contains
, browsers (Electron 80, and Chrome77-80), and the various results between memory faults and non–informing hangs.
For example:
If I give that a timeout like this using Electron:
cy.get('a.card', {timeout: 7000}).first().click()
I get an error like this:
[4262:0416/071201.991156:FATAL:memory.cc(22)] Out of memory. size=69455872
With Chrome 80 it just hangs.
Also, note, I have verified that the page and class selector do exist on the page, and verified it is visiting the correct page (using cy.screenshot()
), and it works in the console every time (ex cypress open
and run from there.)
With so little code, and my clean use of the image, and the fact that it works on my Mac env, I can’t imagine what I am doing wrong…
One thing that may help is getting the logs on the left of the console to show up on the CLI?
I can’t seem to find a way to get that same info in my CLI terminal. (Note: I don’t want console.logs from the browser, just the step-by-step info on what Cypress is executing.)
Any help to get over this hanging/memory issue would be much appreciated.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:13 (2 by maintainers)
Top GitHub Comments
I also get an ‘Out of memory error’ and I am very interested in a solution. Most of the time my test finishes after 3 minutes, but sometimes it ‘hangs’ and I could not determine what the problem is because the test runs into the timeout and creates a broken video. I run the test in a cypress chrome Docker container with GitHub Actions.
[0418/130705.890866:FATAL:memory.cc(22)] Out of memory. size=262144 [31m+2s[0m
Yes, was going to point out also that this plugin will print Cypress commands on failure, but I believe the test would have to actually fail: https://github.com/archfz/cypress-terminal-report
So what is functionally happening when this anchor link is clicked in your application. Like, what normally happens when someone clicks this anchor link? Is it navigating away somewhere? Do you have any
before:unload
handlers in your app or anything? The behavior of the app is likely a key piece of info here that we need.Could you run Cypress in debug mode mode and print the entire set of logs here?