-
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
Can't set cy.viewport larger than 3000 pixels #5181
Comments
Well, I'm not attached to the screenshot file being 4K as much as I need the viewport to be 4K, but this shouldn't be a decision for Cypress to make anyway. The default should be that the screenshot matches the viewport. If I want a different resolution, I'll explicitly ask for it. |
This is not what this issue is about. I'll try to rephrase it to make sure my intent is clear: I'm looking for a 4K viewport. It turns out that I also need to take a screenshot of it (I don't care if the screenshot is resized, it's not my concern at the moment). I'll edit the issue to reflect that. |
I can't see any technical reason why the higher boundary is set to 3000, you can create a pull request to change the higher value here: https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/commands/window.coffee#L162 There was a previous PR to lower the boundaries here that may be helpful to reference: #1448 The docs would also need to be updated to reflect the change when merged: https://github.com/cypress-io/cypress-documentation/edit/develop/source/api/commands/viewport.md There are going to be limitations on the screenshot size since the screenshot can only take the maximum the size of the browser (which is limited by the machine's display size Cypress is running on) as mentioned in this thread: #2313 |
The code for this is done in cypress-io/cypress#5189, but has yet to be released. |
Released in |
Current behavior:
Cypress cannot take a 4K screenshot because the viewport dimensions are capped at 3000px (width or height).
Desired behavior:
Cypress should be able to create a 4K viewport and take screenshots of it since 4K screen are common nowadays.
Steps to reproduce:
Try setting the viewport to 4K. Get an error message related to the viewport size being too large.
I tried to manually remove the bound check from Cypress code but the screenshot did not have 4K resolution even though no other error appeared.
Versions
Latest Cypress version (installed last week)
Window 10
Chrome (up to date)
The text was updated successfully, but these errors were encountered: