Skip to content

Multi-Browser Testing

The Device Lab combines device emulation with Playwright's multi-browser engine. This page covers how to test across Chromium, Firefox, and WebKit on emulated devices.

Browser Availability per Device

Playwright supports all three engines regardless of the emulated device. An "iPhone 14 Pro" descriptor can run on Chromium, Firefox, or WebKit:

DeviceChromiumFirefoxWebKit
iPhone 14 ProViewport + UA emulatedViewport + UA emulatedClosest to real Safari
Pixel 7Closest to real ChromeViewport + UA emulatedViewport + UA emulated
iPad Pro 11Viewport + UA emulatedViewport + UA emulatedClosest to real Safari
Desktop ChromeNative behaviorCross-checkCross-check

When to Use WebKit

For Apple device descriptors (iPhone, iPad), use WebKit to get the closest approximation of real Safari behavior. Chromium and Firefox emulate the viewport and user agent but still use their own rendering engines.

Cross-Browser Differences on Mobile

Mobile emulation reveals browser differences that desktop testing often misses:

BehaviorChromiumFirefoxWebKit
Touch eventsEmulated touch + mouse fallbackEmulated touch + mouse fallbackEmulated touch only
Viewport metaRespects initial-scaleRespects initial-scaleMay auto-zoom on small text
Position: fixedConsistentConsistentScroll-dependent quirks
Input zoomControlled by viewport metaControlled by viewport metaAuto-zooms inputs < 16px font
CSS safe-area-insetReturns 0 (no notch)Returns 0Returns 0 (real values need device)

Running Multi-Browser Device Tests

There are two approaches to testing the same flow across multiple browser+device combinations:

Sequential Runs

Select a device, choose a browser, run the test, then repeat with a different browser:

text
Run 1: iPhone 14 Pro + WebKit    → Pass
Run 2: iPhone 14 Pro + Chromium  → Pass
Run 3: iPhone 14 Pro + Firefox   → Fail (touch event ordering)

CI Matrix Strategy

In CI pipelines, use a matrix to parallelize all combinations:

yaml
strategy:
  matrix:
    include:
      - device: "iPhone 14 Pro"
        browser: webkit
      - device: "iPhone 14 Pro"
        browser: chromium
      - device: "Pixel 7"
        browser: chromium
      - device: "Desktop Chrome"
        browser: chromium
      - device: "Desktop Chrome"
        browser: firefox

Device Lab Recordings

Tests generated by the Device Lab recorder are browser-agnostic. They use Playwright API calls that work on all three engines. The device descriptor is defined in the project configuration, not hardcoded in the test.

Common Issues Across Browsers

Touch Event Differences

Chromium and Firefox dispatch both touch and mouse events when hasTouch is enabled. WebKit dispatches touch events only. Tests that rely on mousedown/mouseup instead of click may behave differently on WebKit.

Mobile Viewport Rendering

All three browsers respect the viewport dimensions from device descriptors, but the rendering of scrollbars, zoom behavior, and font smoothing differs. Visual regression tests should set per-browser baselines.

Network API Timing

Mobile device emulation does not change network timing. Tests that pass under desktop network conditions will also pass under mobile emulation. To test slow-network scenarios, configure Playwright's network throttling independently:

typescript
await page.route('**/*', route => {
  route.continue({ headers: route.request().headers() });
}, { timeout: 3000 });

Physical Device Gap

Software emulation cannot replicate all aspects of physical devices — real GPU performance, actual cellular latency, native browser features, and OS-level gestures remain untestable through emulation alone.

Local-first QA orchestration.