cypress-image-snapshot icon indicating copy to clipboard operation
cypress-image-snapshot copied to clipboard

snapshot image is cutoff

Open ypatel26 opened this issue 4 years ago • 5 comments

why is the the snapshot image get's cut off. only capturing the half of the image.

ypatel26 avatar May 19 '20 20:05 ypatel26

I'm getting an issue like this as well actually, full-page screenshots are inconsistently captured mid-paint. One of them even had the Cypress UI present in the bottom half of the render and marked that as a diff, which seems uh, very questionable.

I may be able to wait for elements to be on-screen but I wonder if something can be done to mitigate this? It doesn't seem like anyone would want screenshots mid-paint.

MattTreichelYeah avatar May 27 '20 22:05 MattTreichelYeah

Curious if you're getting this type of error

Error: Image size (1872x1256) different than saved snapshot size (936x628).

Example screen - https://github.com/cypress-io/cypress/issues/3324#issuecomment-535181285

or if you have a different issue.

We do not recommend comparing screenshots across environments (aka comparing screenshots taken in cypress open versus cypress run)

timarney avatar Jun 05 '20 17:06 timarney

That's an interesting thread, but not sure if it's the same problem for me. These issues come up during the same Cypress open invocation. I'd include screenshots, but it's workplace stuff.

MattTreichelYeah avatar Jun 05 '20 17:06 MattTreichelYeah

If it's a screenshot of an element, it could be that it's not fully scrolled into view?

Nate-Wessel avatar Jun 28 '20 14:06 Nate-Wessel

We have faced similar issue recently. What helped us is to set browser viewport to be equal to Xvfb screen size used for running headless Cypress:

cy.viewport(1280, 720);

We have also tried to scroll element into view, and to scroll parent container of the element - it would not help - it just produced screenshots cut even in a more bizarre way

This is probably some issue with Cypress - I will try to reproduce on simple example and report to them

zuzusik avatar May 25 '22 19:05 zuzusik