device pixel ratio
How many physical screen pixels are used for one CSS pixel, such as 2 on many high-density phone and laptop screens.
In more detail
Screenshots at different ratios have different sizes and detail, so visual tests fix it in their configuration, for example with Playwright's deviceScaleFactor option. Browsers expose it to scripts as window.devicePixelRatio.
Related terms
- pixel — The CSS absolute length unit px, defined as 1/96 of an inch and roughly one dot on a standard-density screen.
- viewport — The visible area of a web page in the browser window or device screen.
- Playwright — Microsoft's open-source tool for automating Chromium, Firefox and WebKit browsers, widely used for end-to-end and visual tests.
Taught in
- Visual Regression Testing: Playwright & Snapshot Differencing — Design Systems & Component Engineering