Device pixel ratio/density simulation
See original GitHub issueI’m following the advice here : https://docs.cypress.io/api/commands/viewport.html#devicePixelRatio
Current behavior:
Actually we can’t simulate pixelRatio/pixelDensity with Cypress. It can be very useful for testing correct behavior around responsive images.
Desired behavior:
Have the possibility to switch the DevicePixelRatio in cypress.
Viewport dimension changes and testing the currentSrc
is already very useful.
Having DevicePixelRatio in cypress would enable finer tests.
Test code to reproduce
Not applicable as it’s not implemented.
It could be another option to cy.viewport()
Issue Analytics
- State:
- Created 3 years ago
- Reactions:38
- Comments:6
Top Results From Across the Web
Device Pixel Ratio dpr - imgix Documentation
Device pixel ratio (DPR) is an easy way to convert between device-independent pixels and device pixels (also called "CSS pixels"), so that high-DPR...
Read more >-webkit-device-pixel-ratio - CSS: Cascading Style Sheets | MDN
The -webkit-device-pixel-ratio is a non-standard Boolean CSS media feature which is an alternative to the standard resolution media feature.
Read more >mydevice.io : web devices capabilities
name phys. width phys. height CSS width CSS height pixel ratio phys...
Apple iPhone 12 Pro Max 1284 2778 428 926 3 458
Apple iPhone...
Read more >High DPI Images for Variable Pixel Densities - WebPlatform.org
Calculating the device pixel ratio · Compare the actual distance at which the device is held to the distance for the reference pixel....
Read more >Support different pixel densities - Android Developers
To preserve the visible size of your UI on screens with different densities, you must design your UI using density-independent pixels (dp) as ......
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
I was able to configure device pixel ratio with these lines in my tests, YMMV:
This could also help cypress-image-snapshot to avoid diff size of screenshots between local and CI runs https://github.com/palmerhq/cypress-image-snapshot/issues/129