New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4.12.0 Regression: CreateSnapshot causes images to be loaded many times #8679
Comments
We are observing the same issue, also with Cypress 5.2 using cypress open, but using Chrome. |
This was introduced in 4.12.0, likely by #8080, which you referenced at the line of code https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/snapshots.js#L155 The waiting of these resources could significantly slow down whatever is waiting on these resources to load. Reproducible exampleDisable cache in the Network tab of DevTools
<html>
<body>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/City_Lights_of_the_United_States_2012.jpg/2560px-City_Lights_of_the_United_States_2012.jpg">
</body>
</html> spec.js it('test', () => {
cy.visit('index.html')
Array(15).fill().forEach(() => {
cy.log('Test log')
})
}) 4.11.04.12.0 |
I don't know what "CreateSnapshot" is but I'm seeing the same images fly by the console repeatedly while a test runs, e.g.
(and many more images, repeated) Could this be related? EDIT I believe this is causing a timeout failure in a test that's using a mocked XHR |
Snapshots are what we call the DOM that's captured on each command, so that when you scroll over the command log the DOM is rerendered to the state it was previously (aka time travel feature). @crfrolik See if the issue of the requests is resolved after downgrading to 4.11.0, that should narrow down if this is the same issue. |
Thank you @jennifer-shehane - I downgraded to cypress 4.11.0 and the issue does not occur there, so that confirms my problem is a duplicate of this one. |
As a side note another issue this causes on our end is that cy.visit ends up timing out as images constantly load and the |
this is really slow, and with #8679, it's even worse😢
@jennifer-shehane I hope this gets resolved soon, we are running recursive forms of 60-70 inputs (medtech). I'm only clicking inputs and typing. After half a test the time scales up so much, running 4-5 of these forms takes 30 minutes (imagine the time writing each test). |
Yes! Perfect @chrisbreiding ! |
The code for this is done in cypress-io/cypress#9050, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
Currently if
log
is called (internally within a cypress command or bycy.log
) all images which are in the process of loading will reload. On some pages this is generating so many network calls that xhr requests are getting stalled to the point that all tests time out.I think this occurs when we clone the body element here https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/snapshots.js#L155
On some internal pages we have many XHR requests (which generate many logs) and many larger images. The reloading behavior is to the point that our tests time out due to requires xhr/fetch calls getting stuck behind all the images.
Desired behavior
Calling cy.log shouldn't trigger a reloading of all images
Test code to reproduce
Use this snippet with cy.open and disable cache off:
Using the above there were 1762 image requests when loading github homepage. Each image was loaded 33 times


Versions
The text was updated successfully, but these errors were encountered: