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

Values set from command for the viewport do not override values set in configuration file #30901

Open
yam-exerp opened this issue Jan 17, 2025 · 0 comments

Comments

@yam-exerp
Copy link

Current behavior

After changing the viewport values (using cy.viewport(600,400) command), I tried to retrieve these values from Cypress.config('viewportWidth') , but it keeps returning the default configuration, see code below

cy.viewport(600, 400)
const viewportWidth = Cypress.config('viewportWidth')
cy.task('log', `viewportWidth: ${viewportWidth}`) // viewportWidth: 1000

Desired behavior

Cypress should provide a method that gives back the current viewport width and height.

Test code to reproduce

Here is a repo where to reproduce the failing test

https://github.com/yam-exerp/cypress-test-tiny

Cypress Version

14.0.0

Node version

v18.20.4

Operating System

MacOS Version 15.0.1

Debug Logs

Other

It seems that this issue was raised before but was closed because of a long period of inactivity

#22688
https://stackoverflow.com/questions/75115796/why-is-cy-viewportwidth-height-not-updating-screen-size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant