TestingDocs.com logoTestingDocs.com
Automation learning lab
TestingDocs • Self-paced course

Playwright Automation
Self Study Guide

Start from zero. Learn JavaScript and TypeScript, automate browsers, and build reliable end-to-end tests.

60 chaptersBeginner friendlyHands-on practice
Playwright / Chapter 58 of 60~18 min • Beginner
Chapter 58Playwright

Cross-browser and mobile emulation

Projects run the same suite under different settings. Device descriptors can emulate viewport, user agent and touch settings; this does not substitute for testing real mobile devices. Configure only the projects appropriate to your requirements.

How it works

Step-by-step walkthrough

  1. Define desktop and mobile projects
  2. Run both
  3. Compare layout behavior

Example

TypeScript
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
  projects: [
    { name: 'chromium', use: { ...devices['Desktop Chrome'] } },
    { name: 'mobile', use: { ...devices['Pixel 7'] } }
  ]
});
Expected result: Same suite runs in two project configurations
💡 Point to remember
Emulation is not equivalent to physical-device testing.

✎ Your practice task

Add a WebKit desktop project.

Knowledge check

Does mobile emulation guarantee real-device behavior?

🌐 Continue learning