Device & Viewport Emulation in Playwright

From the Playwright cheat sheet ยท Emulation & Devices ยท verified Jul 2026

Device & Viewport Emulation

Test on mobile devices, custom viewports, and different screen configurations

typescript
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  projects: [
    { name: 'Desktop', use: { viewport: { width: 1280, height: 720 } } },
    { name: 'Mobile', use: { ...devices['iPhone 13'] } },
    { name: 'Tablet', use: { ...devices['iPad Pro 11'] } },
  ],
});
๐Ÿ’ก Playwright ships with 100+ device profiles โ€” use devices["Device Name"] to emulate any of them
โšก Device profiles include viewport, userAgent, deviceScaleFactor, isMobile, and hasTouch
๐Ÿ“Œ Use page.setViewportSize() mid-test to verify responsive breakpoints dynamically
๐ŸŸข Each project runs your entire test suite โ€” great for cross-device coverage in CI
emulationdevicesviewportmobile

More Playwright tasks

Back to the full Playwright cheat sheet