How to handle responsive DOM changes
See original GitHub issueI have been playing around with this library and I noticed something querky in terms of my screen shots. It seems when I set the widths
option within cy.percySnapshot
the screenshot is taken during the resize of the screen which causes layout issues. By this I mean the screenshot is happening while the layout is still repositioning itself based on the response styles. Is it possible to delay the snapshot a little bit after the width has been set?
Packages:
@percy/cypress: 2.3.1
cypress: 4.3.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How should I handle DOM changes in responsive design?
Essentially, use a CSS table and a media query to swap table values as the viewport changes. CSS .header{ display:table-header-group; } .
Read more >How to handle responsive DOM changes #392 - GitHub
I suspect something else is going on. It sounds like your apps DOM changes between widths? The way Percy works is by capturing...
Read more >How to make Grid Responsive on DOM layout changes?
To make grid responsive on DOM layout changes, we can use the windowonresize method of ejGrid. For example, we have placed the Grid...
Read more >3 Ways To Implement Responsive Design In Your React App
Tracking changes to the window size (width/height); Add/Remove/Update the necessary DOM elements to reflect those changes. The Demo.
Read more >10 Ways to Minimize Reflows and Improve Performance
1. Use Best-Practice Layout Techniques · 2. Minimize the Number of CSS Rules · 3. Minimize DOM depths · 4. Update Classes Low...
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
Hey @jarretmoses, thanks for the issue! I suspect something else is going on. It sounds like your apps DOM changes between widths? The way Percy works is by capturing the DOM of the page (and its state) when
percySnapshot
is called. When then do asset discovery on the DOM & send it off to the API where its rendered concurrently across browsers & widths.If your applications DOM changes when the browser is resized, this current method doesn’t work. We render that same DOM at different widths with JS disabled (to prevent JS from altering any captured state). This method assumes the DOM stays the same and you’re using CSS media queries entirely to alter the page.
To fix this you’ll have to resize the test browser before calling
percySnapshot
for accurate snapshots.This issue is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.