Skip to content
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

Closed
joanrieu opened this issue Sep 23, 2019 · 8 comments · Fixed by #5189
Closed

Can't set cy.viewport larger than 3000 pixels #5181

joanrieu opened this issue Sep 23, 2019 · 8 comments · Fixed by #5189
Labels
good first issue Good for newcomers type: enhancement Requested enhancement of existing feature

Comments

@joanrieu
Copy link

joanrieu commented Sep 23, 2019

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)

@joanrieu
Copy link
Author

joanrieu commented Sep 23, 2019

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.

@joanrieu
Copy link
Author

joanrieu commented Sep 23, 2019

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.

@joanrieu joanrieu changed the title Cypress cannot take 4K screenshots Cypress cannot create a 4K viewport Sep 23, 2019
@jennifer-shehane
Copy link
Member

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

@jennifer-shehane jennifer-shehane added the good first issue Good for newcomers label Sep 23, 2019
@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Sep 23, 2019
@jennifer-shehane jennifer-shehane added the type: enhancement Requested enhancement of existing feature label Sep 23, 2019
@jennifer-shehane jennifer-shehane changed the title Cypress cannot create a 4K viewport Can't set cy.viewport larger than 3000 pixels Sep 23, 2019
@cypress-bot cypress-bot bot added stage: work in progress stage: ready for work The issue is reproducible and in scope and removed stage: ready for work The issue is reproducible and in scope stage: work in progress labels Sep 24, 2019
@cypress-bot cypress-bot bot added stage: work in progress and removed stage: ready for work The issue is reproducible and in scope labels Sep 24, 2019
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 24, 2019

The code for this is done in cypress-io/cypress#5189, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 23, 2019

Released in 3.5.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers type: enhancement Requested enhancement of existing feature
Projects
None yet
3 participants
@joanrieu @jennifer-shehane and others