Skip to main content

Configuring Responsive Viewports

Master responsive testing with Argos: Easily configure viewports for Playwright, Cypress, and Puppeteer, ensuring your app looks great on any device.

Prerequisites

This advanced feature integrates smoothly with Playwright, Cypress, and Puppeteer to enhance your testing capabilities.

Viewport Configuration

Adjust the argosScreenshot() command in your test scripts to capture responsive screenshots. You can specify exact dimensions or use device presets to mimic real-world scenarios:

await argosScreenshot(..., {
viewports: [
"iphone-4", // Use device preset
{ width: 800, height: 600 }, // Specify dimensions directly
{ preset: "ipad-2", orientation: "landscape" }, // Device preset with orientation
],
});

Available Presets

List of available device presets with their respective dimensions:

PresetWidth (px)Height (px)
macbook-161536960
macbook-151440900
macbook-131280800
macbook-111366768
ipad-27681024
ipad-mini7681024
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

To ensure accurate rendering, always set the viewport size with page.setViewportSize() before navigating to the target page, as many sites do not dynamically adapt to changes in viewport size after the page has loaded. For comprehensive testing, consider running your tests across all intended viewports to validate responsive behavior across the board.