How to fix Playwright mobile emulation issues when desktop layout still appears?

Playwright

Mobile layout can fail when viewport/device settings are overridden later in config or test.

Use one clear project device profile and avoid conflicting per-test overrides.

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

export default defineConfig({
  projects: [{ name: 'Mobile Safari', use: { ...devices['iPhone 13'] } }],
});

If behavior differs in headed mode, verify no app logic branches on unsupported UA checks.