Closed hbaron12 closed 1 year ago
How can I ensure that screenshots remain the same regardless of the screen they run on (as long as nothing changes in the source code)?
You need to ensure that the tests are running in a standardized environment, to ensure consistency. This way, you can rule out variables introduced by different monitors or system settings.
The problem is related to the system's rendering differences rather than just the browser itself, it depends on the device pixel configuration of the connected monitor. It's outside the control of Playwright and occurs at the OS or hardware (GPU) level.
Closing as there is no planned worked in this direction.
See also related issue: https://github.com/microsoft/playwright/issues/14460
Hey there, try removing the Viewport options and it should work fine!
System info
Config file
Test file (self-contained)
Steps
Expected
When running the test on different screens, the first time on 24-inch (1920 870 resolution) and the second time on 13-inch (1440 758 resolution), the screenshot comparison succeeds.
Actual
When running the test on different screens, the first time on 24-inch (1920 870 resolution) and the second time on 13-inch (1440 758 resolution), the screenshot comparison failed due to "773 pixels are different"
Question
How can I ensure that screenshots remain the same regardless of the screen they run on (as long as nothing changes in the source code)?