-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
cy.screenshot() not reflecting viewportWidth and viewportHeight settings, resulting in offset within the Cypress Test Runner #28586
Comments
The issue I want to highlight is not the difference between open mode and run mode but rather that its behavior alone in open mode does not meet expectations. |
Looking at this again. |
Alright, I've figured out what's going on in this situation. And, it is in the same vein as the explanation in this comment #3324 (comment) When running I would recommend always running open mode in fullscreen. If you are using the screenshots for specific analysis, like screenshot diffing - I would recommend the workaround in #3324 (comment) and only take screenshots in an environment that will have a stable resolution and browser size by only taking them in headless mode. There is an existing issue with Chrome rendering the chrome of the browser in Cypress 12.5.0+, where there is about 124px difference from the config variable, that is this issue that you can follow. #27260 I don't think there's anything we can do in this situation. We can't render the iframe/webpage larger than the actual browser in headed mode. |
Current behavior
when using cy.screenshot() within the Cypress Test Runner , the settings for viewportWidth and viewportHeight are not being reflected, leading to offset related issues. I have chosen Chrome and Electron, and their sizes are different but both are different from the settings.
In #28541, I mentioned summary of the problem,and it was closed. I added some comments but didn't receive any further replies. Therefore, I decided to open a new issue to restate the problem. I hope to get it resolved.
the screenshot within the Cypress Test Runner and electron:
the screenshot within the Cypress Test Runner and chrome:
Desired behavior
Within the Cypress Test Runner,the images generated by cy.screenshot() should match the dimensions set by viewportWidth and viewportHeight, and should have no offset.
Test code to reproduce
My config:
my test:
Cypress Version
13.5.0
Node version
v16.15.1
Operating System
macOS 13.4
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: