jaredpalmer / cypress-image-snapshot

Catch visual regressions in Cypress
MIT License
888 stars 160 forks source link

snapshot image is cutoff #134

Open ypatel26 opened 4 years ago

ypatel26 commented 4 years ago

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

MattTreichelYeah commented 4 years ago

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.

timarney commented 4 years ago

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)

MattTreichelYeah commented 4 years ago

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.

Nate-Wessel commented 4 years ago

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

zuzusik commented 2 years ago

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