question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cypress hangs on various Docker images and with very little executing

See original GitHub issue

Preface: 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?

Screen Shot 2020-04-15 at 11 50 18 PM

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:open
  • Created 3 years ago
  • Reactions:5
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jannnikcommented, Apr 18, 2020

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 +2s

1reaction
jennifer-shehanecommented, Apr 17, 2020

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting | Cypress Documentation
If you're having an issue during installation of Cypress, try removing the contents of the Cypress cache. This will clear out all installed...
Read more >
agoldis/sorry-cypress-api - Docker Image
When you launch Cypress on a CI environment with multiple machines, each machine first contacts the dashboard to get the next test to...
Read more >
Running Cypress Tests in Docker (Part 9) - Medium
Every time you run “docker run” you spawn a new container. That container then stops after the tests finish, but there is nothing...
Read more >
cypress-io/cypress - Gitter
hey all, Jenkins on windows hangs trying to run cypress. i can run ... image.png ... I have this problem running cypress from...
Read more >
Cypress 7+ hanging in IC - Stack Overflow
The below worked for me. cypress run-ct --browser chrome --headless --config screenshotsFolder=/reports/cypress/screenshots -- --spec.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found