cypress icon indicating copy to clipboard operation
cypress copied to clipboard

Cypress cy.screenshot() timeout during `cypress run`

Open taylorpreston opened this issue 5 years ago • 199 comments

Current behavior:

All of our tests pass locally, but when running the Codeship CI we get errors for a few tests.

The error during Codeship CI builds: CypressError: cy.screenshot() timed out waiting '30000ms' to complete.

Desired behavior:

All tests pass in Codeship CI

Steps to reproduce:

For our app the reproduction is running the ci:codeship command runs which calls cy:record "cy:record": "cypress run --record --key *key* --config video=false", "ci:codeship": "start-server-and-test start http://localhost:5000 cy:record"

I'm not exactly sure how to reproduce this other than creating a Codeship Basic app and attempting to run tests there. I have seen a few other issues point to a problem with how Cypress and Codeship interact.

Versions

Cypress version: 3.4.1

Sidenote: We are using the cypress-autorecord package, but it doesn't seem like this is involved.

taylorpreston avatar Aug 21 '19 16:08 taylorpreston

@taylorpreston Did you ever resolve this issue? I am experience similar problems

lleewwiiss avatar Oct 03 '19 01:10 lleewwiiss

@lleewwiiss We never figured out what was causing this issue. We think it has to do with cypress beginning to run tests on the application before it has finished starting. The errors we received were the first 2-5 tests.

taylorpreston avatar Oct 03 '19 14:10 taylorpreston

I am also experiencing the same error.

zeel avatar Nov 17 '19 18:11 zeel

Also been getting this on 3.5.0 and 3.6.1.

justinpincar avatar Nov 20 '19 23:11 justinpincar

I also have this issue with 3.8.1 and Chrome 79 on CircleCI's ubuntu-1604:201903-01 machine. It's not there with Chrome 78 or the embedded version of Electron. It's probably related to #6023.

tibdex avatar Dec 30 '19 12:12 tibdex

  • Can you run Cypress in debug mode mode and print the entire set of logs here?
  • Can you provide the machine and machine version they are running into this issue with, that would be appreciated.
  • Provide the browser you are running within (Electron, Chrome + version).

I don't think this is related directly to https://github.com/cypress-io/cypress/issues/6023

jennifer-shehane avatar Jan 31 '20 07:01 jennifer-shehane

@taylorpreston I meet the same issue, did you find out the solution for this issue?

toneysum41 avatar Feb 05 '20 01:02 toneysum41

Hello, I have the same issue starting with 3.8.2 (and above) currently. Cypress 3.8.1 works correctly though.

We're using cypress/included docker image in Gitlab CI and keep getting these error messages:

CypressError: cy.screenshot() timed out waiting '60000ms' to complete.

It won't appear in every test and I can't see a pattern in those fails yet. At the moment, I'm struggling with getting debug mode to run, but I'll give an update as soon as I can provide some logs. I hope this first information can help nevertheless. Thank you in advance for all help, information etc.!

leichteckig avatar Feb 05 '20 10:02 leichteckig

I can confirm with @leichteckig that this issue is occurring as described:

"... 3.8.2 (and above) currently. Cypress 3.8.1 works correctly though.

We're using cypress/included docker image in Gitlab CI and keep getting these error messages:

CypressError: cy.screenshot() timed out waiting '60000ms' to complete."

Only difference is that I am using Azure DevOps CI and their container services.

bgcypressqa avatar Feb 05 '20 17:02 bgcypressqa

I can alsoI confirm with @leichteckig that this issue is occurring as described.

We are using Gitlab CI with Ubuntu CI runners and your docker image cypress/browsers:node12.14.0-chrome79-ff71

CypressError: cy.screenshot() timed out waiting '60000ms' to complete."

random, masks errors also...It doesn't happen locally on desktop/laptop.

Glad I read through this to figure out downgrading to 3.8.1 would solve the issue.

teknologista avatar Feb 05 '20 20:02 teknologista

I am having some variation on this issue. It was just happening for one specific test. Was running 3.6.1 and upgraded to 3.8.1, didn't help. When running the test locally I could see the real reason that the test was failing (instead of the screenshot timeout like CI was claiming). So for me it was mostly an issue of a bad error message i CI.

Powersource avatar Feb 06 '20 11:02 Powersource

@Powersource exactly what I meant by sometimes it also masks the true reason for the test fail

teknologista avatar Feb 06 '20 11:02 teknologista

I just upgraded Cypress to 4.0.1, and we now started to see tests failing on Github Actions with screenshot() timeout warning 😢

alexbjorlig avatar Feb 09 '20 21:02 alexbjorlig

Need info

I still have questions that have gone unanswered in this thread that are necessary for investigation.

  • What browser are you running? What version of the browser?
  • Are you running with --headless flag?
  • What machine and machine version are you running?
  • Are you calling the cy.screenshot() command directly? Are you using a plugin that calls the cy.screenshot() command?

Chrome 79 bug?

There has been some speculation that this may be caused by the Chrome 79 performance bug detailed here: https://github.com/cypress-io/cypress/issues/6023#issuecomment-584472171

If you are running on Chrome 79, we've released a docker image for Chrome 80 found here: https://github.com/cypress-io/cypress-docker-images/tree/master/browsers/node13.6.0-chrome80-ff72 at cypress/browsers:node13.6.0-chrome80-ff72.

Please try to update to using Chrome 80. If this is related to #6023 it may fix your issue.

jennifer-shehane avatar Feb 11 '20 04:02 jennifer-shehane

Hi @jennifer-shehane.

Need info

I still have questions that have gone unanswered in this thread that are necessary for investigation.

  • What browser are you running? What version of the browser? Chrome 79.0.3945.130
  • Are you running with --headless flag? No
  • What machine and machine version are you running? ubuntu-16.04
  • Are you calling the cy.screenshot() command directly? Are you using a plugin that calls the cy.screenshot() command? no

Chrome 79 bug?

There has been some speculation that this may be caused by the Chrome 79 performance bug detailed here: #6023 (comment)

If you are running on Chrome 79, we've released a docker image for Chrome 80 found here: https://github.com/cypress-io/cypress-docker-images/tree/master/browsers/node13.6.0-chrome80-ff72 at cypress/browsers:node13.6.0-chrome80-ff72.

Please try to update to using Chrome 80. If this is related to #6023 it may fix your issue.

I tried using chrome 80 in my Github actions:

jobs:
  e2eTests:
    runs-on: ubuntu-16.04
    container: cypress/browsers:node13.6.0-chrome80-ff72

Using the above container seems to give errors like this, and all tests fails:

[HPM] Error occurred while trying to proxy request /graphql from localhost:4200 to http://localhost:1337 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)

Our setup is an Angular + Graphql Node.js Express application. Is there something special I need to make this work when running in containers - or do you want me to open that as a separate issue?

But screenshots seems to be working 🔥

alexbjorlig avatar Feb 11 '20 09:02 alexbjorlig

@alexbjorlig Hmm, I haven't seen the ECONNREFUSED error for proxy requests before. Yeah, I would open a new issue. May be more due to the Node upgrade.

The fact that screenshots work in Chrome 80 is very promising though. Thanks for the update.

jennifer-shehane avatar Feb 12 '20 04:02 jennifer-shehane

@jennifer-shehane - thanks, I will create a new issue for the ECONNREFUSED.

Update After looking at my logs, I can see that the problem is that our Node server uses a mongo in-memory server. This package has a problem, when running in docker, as described here.

Is there another way to run Cypress with Chrome80? I tried using runs-on: ubuntu-latest, (where the mongodb memory server works without issues), but here the Chrome version is 79 😢

Final update My build now works with the Chrome80 container, you can see the details here.

alexbjorlig avatar Feb 12 '20 18:02 alexbjorlig

Hello there,

A little update: I tried Cypress' docker images with Chrome 80 (Cypress 4.0.0 and newer) as recommended in https://github.com/cypress-io/cypress/issues/6023#issuecomment-584472171 and after a week or so, I don't see any more screenshot related failures until now.

In 3.8.2, there was Chrome 79 installed iirc. So it looks like it was the mentioned Chrome bug for me as well. Thank you so much for your advice! :+1:

leichteckig avatar Feb 19 '20 07:02 leichteckig

Just upgraded to cypress/browsers:node12.16.1-chrome80-ff73 and this has broken my test builds using Codebuild.

jpike88 avatar Mar 02 '20 11:03 jpike88

We're seeing this on Chrome 80.0.3987.122 (Official Build) (64-bit)

Undistraction avatar Mar 06 '20 14:03 Undistraction

I have observed two different behaviors in MacOS Mojave with Node JS 13 and Chrome v80.

  1. Running directly cypress run --browser chrome, you will get a lot of timeouts. If it occurs once, then the next screenshot command will follow.
  2. Running indirectly via cypress open then, select chrome browser. It successfully completes the tests.

This is weird!

rhzs avatar Mar 08 '20 16:03 rhzs

I have observed two different behaviors in MacOS Mojave with Node JS 13 and Chrome v80.

  1. Running directly cypress run --browser chrome, you will get a lot of timeouts. If it occurs once, then the next screenshot command will follow.
  2. Running indirectly via cypress open then, select chrome browser. It successfully completes the tests.

This is weird!

We have had a similar issue, restarting our devices seemed to solve this particular issue so i assume it's device resources related.

Legendofire avatar Mar 09 '20 14:03 Legendofire

@rhzs I believe this is due to some memory leak in caching test information. We have observed the same thing on machines with less ram (<=8GB. Setting "numTestsKeptInMemory": 0 fixed it for us, but that makes debugging more difficult

lleewwiiss avatar Mar 09 '20 23:03 lleewwiiss

We're also seeing this on Chrome 80.

mingyixu avatar Mar 19 '20 03:03 mingyixu

I have seen it today too, it was first time

kamiloski avatar Mar 20 '20 16:03 kamiloski

Seeing this when using the 4.2.0 included docker image. Tried reverting back to an older image 3.8.1 and I am still seeing it. It started happening when I tried to use log-to-console-output and I cant make it go away even when I have removed all references to it

shivasrini avatar Mar 20 '20 23:03 shivasrini

I have the same problem with cypress 4.2.0 with electron browser running on TravisCI on ubuntu I run locally in docker with 800mb and cant reproduce the issue.

davojta avatar Mar 27 '20 14:03 davojta

Seems that problem is solved on Travis CI when I have start the cypress with --headless --browser chrome params. The chrome version is 73 in Travis CI.

davojta avatar Mar 27 '20 15:03 davojta

Hm... It seems that setting numTestsKeptInMemory to 0 helps me and it is working with chrome 80 in Travis.

davojta avatar Mar 27 '20 16:03 davojta

I'm getting this problem on a Mac in the Electron browser. I have a rather long page and the problem disappeared when I removed the cypress-failed-log plugin. I'm gonna have to try the other recommended plugin to work around the Issue "Capture + Display all logs for everything that happens in Cypress" #448

saas2813 avatar Apr 19 '20 23:04 saas2813