Prompt

I'm building a responsive site and need screenshot tests for mobile and tablet layouts

Technology / Testing & QA1 observationLast seen Oct 27, 2026

Latest observation

Oct 27, 2026OpenAI APIWeb search: off

Here’s a practical way to add screenshot tests for mobile and tablet layouts in a responsive site.

What to test

At minimum, capture screenshots at a few representative viewport sizes:

  • Mobile
    • 375×667 (iPhone SE / small phone)
    • 390×844 (common modern phone)
  • Tablet
    • 768×1024 (iPad portrait)
    • 1024×768 (iPad landscape)

You can expand later, but these usually cover the main layout breakpoints.

Recommended approach

Use a browser automation tool with visual regression support, such as:

  • Playwright + screenshot assertions
  • Cypress + image diff plugin
  • Storybook + Chromatic
  • Percy / Applitools for hosted visual testing

If you want something lightweight and strong for responsive layouts, Playwright is a great choice.


Example with Playwright

1) Install

npm i -D @playwright/test
npx playwright install

2) Create screenshot tests

// tests/responsive.spec.ts
import { test, expect } from '@playwright/test';

const viewports = [
  { name: 'mobile', width: 375, height: 667 },
  { name: 'tablet', width: 768, height: 1024 },
];

for (const vp of viewports) {
  test(`homepage looks correct on ${vp.name}`, async ({ page }) => {
    await page.setViewportSize({ width: vp.width, height: vp.height });
    await page.goto('http://localhost:3000');
    await expect(page).toHaveScreenshot(`${vp.name}-homepage.png`, {
      fullPage: true,
    });
  });
}

3) Run tests

npx playwright test

The first run will generate baseline screenshots. Later runs compare against them.


Good practices for responsive screenshot tests

Test key pages and states

Don’t just test the homepage. Include:

  • Navigation open/closed
  • Forms
  • Cards/grids
  • Long content / edge cases
  • Error states

Stabilize the page

To reduce flaky diffs:

  • Disable animations
  • Mock dynamic content/time
  • Use consistent fonts
  • Wait for network idle or specific UI readiness
  • Avoid random content in screenshots

Use breakpoints, not every device

Test layout breakpoints rather than every phone/tablet model. This keeps tests manageable.

Keep screenshots focused

If full-page screenshots are too noisy, test specific sections/components instead.


If you use Storybook

A very effective workflow is:

  • Build key responsive components in Storybook
  • Capture screenshots per viewport using:
    • Chromatic
    • Playwright
    • Loki

This is especially useful for component-level regression testing.


Suggested test matrix

A simple starting matrix:

LayoutViewport
Mobile375×667
Mobile large390×844
Tablet portrait768×1024
Tablet landscape1024×768

If you want, I can also provide:

  1. a Playwright config for mobile/tablet screenshot testing,
  2. a Cypress version, or
  3. a setup tailored to React / Next.js / Vue / Angular.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.