Support ability to set viewport in `before` or `Cypress.config` to persist new viewport across several tests (not reset to default viewport size in between each test)
See original GitHub issueThis looks like a bug but I may be misunderstanding the documentation, under Config -> Name And Value it states:
Any value you change will be permanently changed for the remainder of your tests.
I interpreted this as when I set cypress like so:
Cypress.config({
viewportWidth: 375,
viewportHeight: 812,
})
cy.viewport(375, 812)
Any further (non chained) tests should run in 375, 812
viewpoint but it seems to default back to the original cypress.json
config.
Interestingly when I console log
const { viewportWidth, viewportHeight } = Cypress.config()
console.log('Actual', viewportWidth, viewportHeight)
It will give me the correct Actual, 375, 812
values
The reason I’m doing it this way is I am using the cypress-cucumber-preprocessor
plugin which treats each cypress definition as a different “step” and doesn’t seem to persist cy.viewport()
between them.
This is a little complicated to explain, let me know if I need more info etc.
Cheers
- Operating System: MacOS 10.13.3
- Cypress Version: 2.1.0
- Browser Version: Chrome
Issue Analytics
- State:
- Created 5 years ago
- Reactions:17
- Comments:28 (3 by maintainers)
Top Results From Across the Web
viewport | Cypress Documentation
Reset viewport via Cypress.config(). You can change the size of the viewport height and width for the remainder of the tests by setting...
Read more >Cypress Viewport - YouTube
Cypress Viewport command controls the orientation and size of the screen of your application. Using this command, you can set the size of ......
Read more >Cypress Viewport and Browser Configurations you Must Know.
Udemy Enrollment Form https://forms.gle/4dndSRQtntfo8puaA More information: https://docs. cypress.io/api/commands/ viewport Check my ...
Read more >How Do I Use Mobile Viewports for Responsive Experiences?
Mobile viewports help you see how your Adobe Target activities look on Screens of various sizes. Find a list of popular device viewport...
Read more >What's new? - Applitools
What's new with our automated visual testing software? Get the latest updates on product releases and integrations as well as Applitools Eyes and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Some of the work in #5346 should make it possible to persist a viewport size across a series of tests.
To be released
So, keep track of that PR to see when it is merged and released within our product.
Could it keep last set viewport and not reset each time to default while it’s within one describe section? Jumping between viewports visual experience is really unpleasant for eyes.