Skip to main content

Configuring Responsive Viewports

Argos lets you capture the same page at multiple breakpoints with a single test. Configure viewports once and get consistent responsive coverage across Playwright, Cypress and Puppeteer.

Prerequisites

This feature works seamlessly with Playwright, Cypress and Puppeteer.

note

If you use Storybook, see the dedicated guide on Storybook modes.

Viewport Configuration

Pass a viewports array to argosScreenshot() to generate screenshots for each dimension or preset you define. You can mix explicit sizes and device presets.

await argosScreenshot(..., {
viewports: [
"iphone-4",
{ width: 800, height: 600 },
{ preset: "ipad-2", orientation: "landscape" },
],
});

Available Presets

PresetWidth (px)Height (px)
pro-display30081962
studio-display25601440
imac-2422401260
macbook-161536960
macbook-151440900
macbook-131280800
macbook-111366768
ipad-12-pro10241366
ipad-11-pro8341194
ipad-108101080
ipad-10-pro8341112
ipad-9-pro7681024
ipad-27681024
ipad-mini7681024
iphone-air420912
iphone-17402874
iphone-17-pro402873
iphone-17-pro-max440956
iphone-16393852
iphone-16e390844
iphone-16-plus430932
iphone-16-pro402874
iphone-16-pro-max440956
iphone-15393852
iphone-15-plus430932
iphone-15-pro393852
iphone-15-pro-max430932
iphone-14390844
iphone-14-plus428926
iphone-14-pro393852
iphone-14-pro-max490932
iphone-13390844
iphone-13-mini360780
iphone-13-pro390844
iphone-13-pro-max428926
iphone-12390844
iphone-12-mini360780
iphone-12-pro390844
iphone-12-pro-max428926
iphone-11414896
iphone-11-pro375812
iphone-11-pro-max414896
iphone-xr414896
iphone-x375812
iphone-6+414736
iphone-se2375667
iphone-8375667
iphone-7375667
iphone-6375667
iphone-5320568
iphone-4320480
iphone-3320480
samsung-s10360760
samsung-note9414846

Troubleshooting and Best Practices

Many sites compute layout at load time and will not adapt cleanly if the viewport changes later. If you notice issues, you may want to run your test suite entirely for each viewport instead of changing the viewport before taking each screenshot.

For example, in Playwright you can create a separate browser context for each viewport size.

playrwight.config.ts
import { defineConfig, devices } from "@playwright/test";

export default defineConfig({
projects: [
{
name: "chromium-mobile",
use: {
...devices["Desktop Chrome"],
channel: "chrome",
},
},
{
name: "chromium-mobile",
use: {
...devices["Desktop Chrome"],
channel: "chrome",
viewport: { width: 402, height: 874 }, // iPhone 7 viewport
},
},
],
});

You can also run page.setViewportSize() before navigating to the page to ensure the layout is computed correctly.

await page.setViewportSize({
width: 640,
height: 480,
});
await page.goto("https://example.com");