Cypress - Changing viewport with preset doesnt affect viewportHeight or Width

Viewed 904

I'm starting cypress today and I have this scenario with test displaying a simple element whether I'm on mobile, tablet, or desktop.

So I use this method to change viewport which seems to works but the config doesn't change.

cy.log("viewport");
cy.log(""+Cypress.config().viewportWidth) // logs 1000
cy.viewport(preset)
cy.log(""+Cypress.config().viewportWidth) // still logs 1000 

Am I to understand that config() is the default config and is not updated by method viewport

And if so, how can you get the current viewport?

1 Answers
Related