Playwright controls headless desktop browsers that can also emulate mobile devices. And while device emulation can’t replace testing on mobile devices entirely, it’s a practical and quick-to-setup approach to testing mobile scenarios. Device emulation is well suited to test if your site behaves correctly across multiple viewport sizes and correctly handlesDocumentation Index
Fetch the complete documentation index at: https://checkly-422f444a-sync-playwright-reporter-changelog-v1-5-0.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
user-agent strings. But if your site relies on device-specific browser features, an iPhone emulation running in a Chromium browser might lead to false positives.
This guide explains how to define viewport sizes, device pixel ratio and user-agent strings using Playwright.
Defining the user agent string
If your site parses the user agent string to serve a different experience to mobile users, define theuserAgent in your automation scripts.
emulate-mobile.spec.ts
Defining viewport size and pixel density
If your site follows responsive web design practices and renders elements depending on device viewport size, define a mobile viewport and pixel density.emulate-mobile-viewport.spec.ts
Use built-in device registries
Playwright includes a built-in device registry to access mobile device characteristics quickly. Leverage the pre-defined devices to emulate mobile devices.emulate-mobile-builtin.spec.ts
Further reading
Bugs don’t stop at CI/CD. Why would Playwright? 
Sign up and start using Playwright for end-to-end monitoring with Checkly.