Closed taylorpreston closed 8 months ago
@jennifer-shehane When I run into this problem it was because the page that the screenshot was run on was rather long. What caused me the most irritation was that the exception was thrown from inside the handling of a failed testcase, causing the test-case failure to be hidden. If there is an easy way to make sure that the test-failure is reported despite the screenshot (or anything else in the cleanup) failing, that would probably solve most of the irritation from this problem.
When we ran into this problem , we solved it by using a workaround by passing "screenshotOnRunFailure": false
in your cypress.json file. In the scenario, the cypress doesn't try to capture the screenshot on failure and you get the actual error.
Hi @jennifer-shehane facing this same issue consistently can we get an ETA when this will be fixed?
using modules
"cypress": "^5.6.0",
"cypress-multi-reporters": "^1.4.0",
"cypress-terminal-report": "^2.4.0",
"mocha": "^8.2.1",
"mochawesome": "^6.2.1",
"mochawesome-merge": "^4.2.0",
"mochawesome-report-generator": "^5.1.0",
browser: chrome Version 87.0.4280.88 (Official Build) (x86_64) OS: macOS version 10.15.7
We haven't been given a clear reproducible example of this issue. Without having a way to reproduce it, we can't track down when and why this error is throwing. There can't be any work done on the issue until that is provided.
Can anyone provide a reproducible example?
Had it as well when running locally in Docker
Cypress 6.2.1 Inside docker engine 20.10.0 on Darwin 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
Electron 87 (headless)
@jennifer-shehane The link to debugging command line you posted earlier "Can you run Cypress in debug mode mode and print the entire set of logs here?" do not work. I do not see any configuration option nor run parameter that enabled debugging.
Update 1: Adding --config video=false,numTestsKeptInMemory=0,watchForFileChanges=false
did not help.
@KrzysztofMadejski https://on.cypress.io/troubleshooting#Print-DEBUG-logs
I am also affected. Cypress: 5.1.0 │ Browser: Electron 83
@RubenGarcia you could try updating to latest 6.4.0? I haven't seen this error for quite some time now, so might be fixed in last few versions or so.
Version 6.4.0 works for me. Thank you.
it's happening the same for me with latest 6.4.0. Cypress: 6.4.0 Browser: Chrome
This might sound weird, but I experienced this ONLY when I had Norton antivirus firewall enabled.
We get this in Chrome Headless on AWS Codebuild, with Cy 6.4.0 and 6.8.0. Linking to another Cypress issue as for us, they seem to happen together. N.B. the same tests do not fail when run locally.
We will try the fixes suggested by Jennifer above and update this comment.
We also get this sometimes during our CI (Docker/k8s). We're running the latest version of Cypress (6.8.0) on Debian 9 Docker containers.
Docker: cypress/base:12.16.2 Cypress versions: 6.5.0, 7.1.0 Where: in Jenkins
@jennifer-shehane come across this issue in Cypress version 6.5.0 and the latest 7.1.0. It gets reproduced only on a specific set of tests. There are ~7 tests. I've tested it at least 15 times running in Jenkins in Docker. Currently, it gets failed with "CypressError: cy.screenshot()
timed out waiting 30000ms
to complete." on the current failure of the test :
CypressError: `cy.task('eCommerceExecute')` failed with the following error:
> Response code 422 (Unprocessable Entity)
I run the tests as a node process using cypress as an imported lib as you all suggest in one of your docs. Following this, I did not manage to set the DEBUG parameter. Could you please recommend what else data I could extract for you to be useful to provide. Also if it appears not enough I'm ready to jump on a call to work on this case together since I can't just send this test as it involves many integrations which will be a bit tough to mock.
Experiencing the same issue on Cypress 7.1.0 running inside cypress/browsers:node12.18.3-chrome89-ff86
docker image.
Error message: CypressError: 'cy.screenshot()' timed out waiting '30000ms' to complete.
@AlexanderTunick Can you provide a reproducible example?
I am having the same problem, from my investigation this seem to be happening if another tab is opened during the test. This issue is happening on two of my tests that presents this behaviour: First is testing our Chrome Extension, that opens a welcome page after being installed. The second one was on a test that opens another tab on purpose, to test if our app can be used on a single tab only
My team is facing this problem in windows machine. @jennifer-shehane Can you try this out on a page which needs to be scrolled thrice to take a screenshot. (Can't provide the example here!!)
On such a page perform some action and try to take screenshot
cy.screenshot() //some steps on top of page cy.screenshot() //some steps in top of page cy.screenshot() //some actions in middle of the page cy.screenshot() some action towards the end of the page
+1, random timeouts on live site using cypress open, works fine locally, both open/ run.
Cypress: 7.4.0
Is there a way to catch these failures to screenshot? It would be nice if those didn't result in a CypressError
and didn't overwrite the stack trace of the actual reason for failure
we are experiencing this on cypress 6.4.0
I have this problem too, however I noticed that the error only happens when I minimize the browser screen. If I run the tests with it maximized, I don't suffer from this problem. And if I run the tests in headless mode, I can also run them without any problem.
The version of cypress I am using is 6.6.0
Is there any workaround to solve it on github-actions?
I'm having the same problem that during cypress run
, after the test finished, it hangs for a while and then it throws an error
CypressError: `cy.screenshot()` timed out waiting `30000ms` to complete.
I have a sample code that can reproduce the issue in Cypress 8.6.0 cypress-run-replication.zip
npm install
to install cypress npx cypress run
cypress.config
, when I set video
to true, then it works fine.cypress.config
, if I set the baseUrl
to the app url that I need to test, then it also work fineHi,
Please remove me from this email trail.
Thanks
BP
Billy Papageorgiou Developer CRS Engineering, Customer Relationship Systems CUSTOMER PROCESSING SYSTEMS @.*** Level 5 South, 55 Currie Street, Adelaide
From: toannguyen83 @.>
Sent: Friday, 15 October 2021 12:49 AM
To: cypress-io/cypress @.>
Cc: Papageorgiou, Billy @.>; Comment @.>
Subject: Re: [cypress-io/cypress] Cypress cy.screenshot() timeout during cypress run
(#5016)
I'm having the same problem that during cypress run, after the test finished, it hangs for a while and then it throws an error
CypressError: cy.screenshot()
timed out waiting 30000ms
to complete.
I have a sample code that can reproduce the issue in Cypress 8.6.0 cypress-run-replication.ziphttps://github.com/cypress-io/cypress/files/7346695/cypress-run-replication.zip
Run Sample Code Instructions (on Windows Machine)
I noticed that when I set the cypress.config video to true, then it works fine.
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/cypress-io/cypress/issues/5016#issuecomment-943404688, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUARGYJIUFHLC3FHKMGTDDUG3RG5ANCNFSM4IOJQN6Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. ** IMPORTANT: This e-mail is for the use of the intended recipient only and may contain information that is confidential, commercially valuable and/or subject to legal or parliamentary privilege. If you are not the intended recipient you are notified that any review, re-transmission, disclosure, dissemination or other use of, or taking of any action in reliance upon, this information is prohibited and may result in severe penalties. If you have received this e-mail in error please notify the sender immediately and delete all electronic and hard copies of this transmission together with any attachments. Please consider the environment before printing this e-mail **
@toannguyen83
Same here, after enable video
on cypress config the screenshot stoped to throw timeout error.
What make no sense if you won't record video after error.
OS: Windows 10. Cypress: 8.7.0 Browser: Electron 93 (headless)
I tried cypress-plugin-snapshots and cypress-image-snapshot plugins, both had similar results.
If I have video: false
setting in cypress.json file and run Cypress from command line, it throws this error:
CypressError: cy.screenshot() timed out waiting 30000ms to complete.
However, it works when I run the test via Cypress UI.
test.spec.js
describe('Screenshot testing', function() {
it('page exists and can be opened', function() {
cy.visit('http://local.testurl.com:3001').then(() => {
cy.document()
.toMatchImageSnapshot();
})
})
})
Hi,
Please remove me from this email list.
Thanks.
Billy
From: divpusher @.>
Sent: Tuesday, 2 November 2021 3:11 AM
To: cypress-io/cypress @.>
Cc: Papageorgiou, Billy @.>; Comment @.>
Subject: Re: [cypress-io/cypress] Cypress cy.screenshot() timeout during cypress run
(#5016)
OS: Windows 10. Cypress: 8.7.0 Browser: Electron 93 (headless)
I tried cypress-plugin-snapshots and cypress-image-snapshot plugins, both had similar results.
If I have video: false setting in cypress.json file and run Cypress from command line, it throws this error:
CypressError: cy.screenshot() timed out waiting 30000ms to complete.
However, it works when I run the test via Cypress UI.
test.spec.js
describe('Screenshot testing', function() {
it('page exists and can be opened', function() {
cy.visit('http://local.testurl.com:3001').then(() => {
cy.document()
.toMatchImageSnapshot();
})
})
})
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/cypress-io/cypress/issues/5016#issuecomment-956393690, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUARGYTA6RNZPPGN7TI4R3UJ27JTANCNFSM4IOJQN6Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. ** IMPORTANT: This e-mail is for the use of the intended recipient only and may contain information that is confidential, commercially valuable and/or subject to legal or parliamentary privilege. If you are not the intended recipient you are notified that any review, re-transmission, disclosure, dissemination or other use of, or taking of any action in reliance upon, this information is prohibited and may result in severe penalties. If you have received this e-mail in error please notify the sender immediately and delete all electronic and hard copies of this transmission together with any attachments. Please consider the environment before printing this e-mail **
Just click on the unsubscribe link in the bottom of the email...
Hi, Please remove me from this email list. Thanks. Billy From: divpusher @.> Sent: Tuesday, 2 November 2021 3:11 AM To: cypress-io/cypress @.> Cc: Papageorgiou, Billy @.>; Comment @.> Subject: Re: [cypress-io/cypress] Cypress cy.screenshot() timeout during
cypress run
(#5016) OS: Windows 10. Cypress: 8.7.0 Browser: Electron 93 (headless) I tried cypress-plugin-snapshots and cypress-image-snapshot plugins, both had similar results. If I have video: false setting in cypress.json file and run Cypress from command line, it throws this error: CypressError: cy.screenshot() timed out waiting 30000ms to complete. However, it works when I run the test via Cypress UI. test.spec.js describe('Screenshot testing', function() { it('page exists and can be opened', function() { cy.visit('http://local.testurl.com:3001').then(() => { cy.document() .toMatchImageSnapshot(); }) }) }) — You are receiving this because you commented. Reply to this email directly, view it on GitHub<#5016 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARUARGYTA6RNZPPGN7TI4R3UJ27JTANCNFSM4IOJQN6Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. ** IMPORTANT: This e-mail is for the use of the intended recipient only and may contain information that is confidential, commercially valuable and/or subject to legal or parliamentary privilege. If you are not the intended recipient you are notified that any review, re-transmission, disclosure, dissemination or other use of, or taking of any action in reliance upon, this information is prohibited and may result in severe penalties. If you have received this e-mail in error please notify the sender immediately and delete all electronic and hard copies of this transmission together with any attachments. Please consider the environment before printing this e-mail **
I can confirm that when running with video: false
when there are tests failing, cypress will time out (running in circle-ci)
Its Circle that kills the process eventually rather than the process exiting properly. This makes the tests run very long of course needlessly.
When changing to video: true
cypress will exit immediately after tests finish running. (see run after change)
Also, screenshots are captured correctly when video is enabled... 🤷
I have no desire for the videos to be captured but seems like I have to enable this feature until this is fixed.
using cypress 9.0.0
A few more details:
running with: cypress run --record false --reporter mocha-multi-reporters --reporter-options configFile="cypress/reporters-config.json"
reporters config:
{
"reporterEnabled": "spec, mocha-junit-reporter",
"reporterOptions": {
"mochaFile": "cypress/results/results-[hash].xml",
"toConsole": true
}
}
not using Cypress Orb
CypressError: cy.screenshot()
timed out waiting 30000ms
to complete.
version :8.7.0
occurs frequently in all the suites why this is open for years ?
can anyone please take this as priority and fix it it will be helpful for many
@jennifer-shehane
I recently updated from ^6.9.1 to ^9.1.0 and now I get this cy.screenshot timed out error on failed tests, and the process doesn't exit (Github Action ends up running for hours, if I don't manually cancel).
I also have video: false
in my config.
This is more than just a minor annoyance for the following reason: these tests pass on my local machine. So the only way to diagnose why they failed on CI server is with screenshots. Without a screenshot, I'm just changing things at random to see how to get it to pass.
Will set video: true
even if it results in much longer tests, to see if that helps.
We have also now started to get this issue (including in trivial tests that do not actively take screenshots) having upgraded from 7.3 to 9.1. Like @yoavniran and @AdrianoFerrari we also have video: false, and also see that some tests are not terminating. Not sure if related. We'd like to keep the version current, but this is a blocker.
I'm seeing the same behavior on 9.1.1 on Jenkins as well
I am also seeing this behavior !
Seeing the same behavior in Cypress 8.7. The worst part is that the process doesn't end, it keeps hanging, so even if you try to catch the error you can't close the process.
I am having the same issue on 9.0.0. Running my tests with video:false since I do not need the video and it is taking too long to run them with video. The run is in headless mode.
happening the same on 9.2.0 running locally and is solved by passing true to video.
I am also seeing this for the first time after upgrading to a 9.0.0 or higher version. The issue does not show up locally, only in our Jenkins build. Setting video:true solved this, but this is not desirable as a long-term solution since we don't have a need for the videos.
This didn't worked for me since v7. Switched to playwright, it produces much more stable tests, not just screenshots.
any progress on this? this issue open for years...
To try and help, I created a minimal repro of the issue here with some README details on the environment I'm using, and a snippet of the last line of the DEBUG logging I sometimes see before it "hangs"/times out.
I also noticed some interesting cause/effect observations in the README (some of which have been noted here by others). For example, I notice that invoking cy.screenshot()
directly doesn't fail for me, only when it's done indirectly by a failed test assertion. When I do invoke it directly, it seems to make subsequent failed assertions & screenshots NOT timeout.
Mentioning @jennifer-shehane as I kindly saw her asking for these details above. Hoping this will help.
Our workaround for now is to enable video: true
which works (as stated by others) but is obviously not ideal if you don't want the video.
I came across this issue as well with 9.3.1
and i already started to create a new issue, but finally found this one. Exact same problem here with video:false
, it hangs an never exit on failed tests. video:true
is no option for us, as we have automated headless tests on not so beefy machines.
Same here with cypress 9.3.1
: setting "video": false
in cypress.json i get CypressError: `cy.screenshot()` timed out waiting `30000ms` to complete.
I notice that invoking
cy.screenshot()
directly doesn't fail for me, only when it's done indirectly by a failed test assertion. When I do invoke it directly, it seems to make subsequent failed assertions & screenshots NOT timeout.Our workaround for now is to enable
video: true
which works (as stated by others) but is obviously not ideal if you don't want the video.
Based on the observation above, and just for fun, I tried reverting video: false
and putting an explicit cy.screenshot()
call before my tests e.g.
//in support/index.js
before(() => {
cy.screenshot()
})
...but it didn't work consistently, yielding an occasional timeout and even an error code 3221225477.
At the moment I'm sticking with video: true
.
@jennifer-shehane this is getting more and more problematic. Any change you can get this on the fix list?
I just timed running with video: true
, it was generally 3-4 x slower than without (!) and this is on beefy c5.large AWS instances.
This issue appeared for us when attempting to upgrade to Cypress 8.x - we are stuck on 7.x as a consequence.
A workaround that worked for me (using v9.3.1):
I found that this was occurring for me if during each describe block, my first action was to do a cy.visit(<url>)
, then running tests that would fail with NO screenshot.
After playing around with what was semi working, I tried assigning the url I wanted to visit at the beginning of each test to the baseUrl:
Before:
cypress.json
{
...,
"video": false
}
dummy.spec.js:
describe('should fail', () => {
it('visit url', () => {
cy.visit(<url>)
}
it('test that should've failed and triggered a screenshot', () => {
cy.get('[data-testid=header]').contains(<incorrect title>)
}
}
After:
cypress.json
{
...,
"video": false,
"baseUrl": <url>
}
dummy.spec.js:
describe('should fail', () => {
it('visit url', () => {
cy.visit('/')
}
it('test that failed and SUCCESSFULLY trigger a screenshot', () => {
cy.get('[data-testid=header]').contains(<incorrect title>)
}
}
Hi Everyone, For those Experiencing this issue on Cypress version ^9.4.1 , I just resolve this issue by updating the Node.js Version to 16 or to the latest version (https://nodejs.org/en/ ) and with the latest version of Chrome in our setup.
In Local: Node.js Installed: v16 Chrome Installed: v97
In GitlabCI: image: cypress/browsers:node16.5.0-chrome97-ff96
command to execute: cypress run --browser chrome
Hopefully it could help Thanks!
After playing around with what was semi working, I tried assigning the url I wanted to visit at the beginning of each test to the baseUrl: configuration in either cypress.json or plugins/index.js module.exports config. Then instead of using cy.visit(), I change my in-test visit() to `cy.visit('/'). Doing this caused my screenshots to work while having videos disabled/set to false.
Recently our CI runs grew slower, and running with video: true
seemed not to help, so instead I tried this baseUrl
solution (via config
CLI flag, in our case) and so far it seems to work cleanly, not requiring video (video: false
), and still producing expected screenshots and helpful error messages on test failures. We're on version 9.2.1 still.
We had been setting baseUrl
at the start of each test, where setting baseUrl
up front (CLI, cypress.json, etc) is really a documented Cypress best practice we probably should have been doing anyway.
Time will tell if we have more issues, but for now, I just wanted to share in case this helps anyone else. Thank you, @thoover11.
What worked for me on version 9.5.0
was disabling video and screenshots on test failure on the cypress.json
config:
{
...
"video": false,
"screenshotOnRunFailure": false
}
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 callscy: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.