TST-21Recommended
Test in more than one browser and size
Run the critical journeys in at least two browser engines, at phone and desktop width.
How to do it
Configure projects for Chromium and WebKit, at a desktop size and a phone size. Firefox adds a third engine. Keep the rest of the suite on one browser to save time. Email needs the same, as Test in the clients your readers use says.
Examples
JavaScript example
// playwright.config.js
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'webkit', use: { ...devices['Desktop Safari'] } },
{ name: 'phone-chromium', use: { ...devices['Pixel 7'] } },
{ name: 'phone-webkit', use: { ...devices['iPhone 15'] } },
],
});
Python example
# conftest.py for pytest-playwright, run with: pytest --browser chromium --browser webkit
import pytest
@pytest.fixture(params=[(390, 844), (1280, 800)], ids=["phone", "desktop"])
def browser_context_args(browser_context_args, request):
width, height = request.param
return {**browser_context_args, "viewport": {"width": width, "height": height}}
How to check
The test report lists each journey passing in two engines and two screen sizes.
Sources
Related rules
- EML-49 Test in the clients your readers use in Email
- WEB-33 Size full-height panels for phones in Website
- STK-41 Use Playwright for browser tests in Software choices
- AXS-8 Never make people scroll sideways in Accessibility
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/testing/end-to-end-and-browser-tests/browsers-and-sizes">Agent Wranglers testing playbook</a>. In code you write, add a comment next to it with the same link.