ScreenshotNeo

BlogComparisons

Playwright Screenshot Testing vs Cypress for Indian QA Teams

Compare Playwright’s built-in screenshot assertions with Cypress visual-testing integrations, with runnable examples and a practical checklist for Indian QA teams.

By the ScreenshotNeo team4 October 202610 min read

Short answer: Playwright Test includes screenshot comparison through await expect(page).toHaveScreenshot(). Its first run creates a reference image; later runs compare new captures with that baseline. Cypress can capture screenshots with cy.screenshot(), but it does not compare them itself: add a local visual-diff plugin or a hosted visual-testing service. For a team choosing today, the central tradeoff is an integrated local assertion and baseline workflow versus an existing Cypress suite paired with a separately selected comparison and review workflow.

There is no evidence in the official documentation cited here that Indian QA teams as a group prefer either framework, or that one is universally cheaper in India. Use your current suite, CI environment, supported browser needs, data-handling rules, review capacity and current vendor quotes to decide.

1. What the tools do differently

Decision Playwright Test Cypress
Capture and comparison Built-in toHaveScreenshot() assertion captures and compares a page or locator image. cy.screenshot() captures an image. Add a plugin or service to compare it with an approved baseline.
Baselines Generated image snapshots live with the test project and should be reviewed and committed intentionally. Local plugins typically use image files managed by the team; hosted products may manage baselines and approvals.
Review Test output and image diffs fit into the team’s local/CI workflow. Depends on the chosen plugin or service; hosted options commonly provide dashboards and pull-request review.
Rendering consistency Keep OS, browser, viewport, fonts and other rendering inputs consistent. For local pixel diffs, use a consistent CI or Docker environment, fixed viewport and pinned browser where possible.
Cost and ownership The assertion is part of the test workflow; engineering time and CI execution still have costs. Local plugins can avoid a hosted subscription but require team ownership of baselines and review. Hosted workflows have vendor cost and data review requirements.

Official references: Playwright visual comparisons and Cypress visual testing. Cypress documents that its screenshot command does not perform image comparison.

2. Playwright: runnable screenshot comparison

This minimal JavaScript example uses Playwright Test. Install it in a Node.js project and install the browser binary:

npm init -y
npm install --save-dev @playwright/test
npx playwright install chromium

Create tests/homepage.spec.js:

const { test, expect } = require('@playwright/test');

test('homepage visual appearance', async ({ page }) => {
  await page.setViewportSize({ width: 1440, height: 900 });
  await page.goto('http://127.0.0.1:3000', { waitUntil: 'networkidle' });
  await expect(page.getByRole('heading', { name: 'Welcome' })).toBeVisible();
  await expect(page).toHaveScreenshot('homepage.png', {
    fullPage: true,
    animations: 'disabled',
    caret: 'hide',
    maxDiffPixelRatio: 0.001
  });
});

Run it with:

npx playwright test

On the first run, Playwright writes the expected screenshot. Inspect and commit it as the baseline. Later runs compare against it; when a visual change is intentional, review the diff and update snapshots deliberately:

npx playwright test --update-snapshots

Commit baseline changes with the code change that explains them. Do not make baseline updating an automatic step in ordinary CI, since doing so can silently bless regressions.

Useful Playwright screenshot controls

  • page compares a page; locator comparisons keep the image limited to a meaningful component.
  • fullPage: true captures the full document rather than only the visible viewport.
  • animations: 'disabled' and caret: 'hide' reduce common sources of irrelevant pixel changes.
  • mask can cover dynamic regions, and stylePath can apply snapshot-only CSS to hide volatile content or stabilize presentation.
  • threshold, maxDiffPixels and maxDiffPixelRatio tune comparison sensitivity. Start strict; loosen only after identifying unavoidable rendering noise.
  • Set the viewport in the test or project configuration. Pin the browser and execution environment used to create and compare snapshots.
  • Snapshot naming and project configuration affect where baselines are stored. Use the documented snapshot update workflow and commit the resulting files.

See the current option definitions in Playwright’s visual comparisons guide. Rendering can vary by OS, browser version, settings, hardware and headless mode, so avoid generating baselines on one environment and comparing them in another.

3. Cypress: capture plus a comparison tool

Cypress supplies the browser automation and screenshot capture. Choose a comparison plugin or service and follow its current installation instructions; the command name, baseline format, thresholds and update process differ by integration. This example shows the Cypress test shape, with cy.compareSnapshot() representing the command provided by the selected plugin:

describe('homepage visual appearance', () => {
  it('matches the approved homepage image', () => {
    cy.viewport(1440, 900);
    cy.visit('http://127.0.0.1:3000');
    cy.findByRole('heading', { name: 'Welcome' }).should('be.visible');

    // Replace with the comparison command documented by your chosen plugin.
    cy.compareSnapshot('homepage');
  });
});

The example assumes a Testing Library Cypress command is installed for findByRole; alternatively use a selector already supported by your app and Cypress setup. The placeholder comparison command is intentionally not presented as built-in Cypress functionality. cy.screenshot() alone only writes an image:

cy.screenshot('homepage');

Cypress describes two broad paths: open-source plugins that compare locally and hosted services that manage comparison and review. Local plugins give the team control over image storage and infrastructure, while the team must maintain consistent rendering and a review process. Hosted services can take on baseline management, review and cross-browser or responsive rendering, subject to service cost and company data rules. The Cypress visual testing guide lists integrations and explains these workflow differences. Check each provider’s current documentation and plans before adopting it.

4. Make screenshots repeatable

A screenshot diff is useful only when the page renders repeatably. OS, browser version, fonts, display scaling, headless mode, test data, current time, network responses, animation and third-party content can all change pixels without a product regression.

  1. Pin the rendering setup. Run baseline creation and comparisons in the same CI image where practical. Set a fixed viewport, browser version and font set. Avoid comparing laptop-generated baselines against a different CI environment.
  2. Wait for the intended state. Navigate, trigger the UI state and assert that the relevant content is visible before capturing. Avoid arbitrary sleeps where a functional assertion can confirm readiness.
  3. Control data and time. Use fixtures or stubbed responses for changing APIs. Freeze time when dates, countdowns or timestamps are visible.
  4. Stop motion. Disable transitions and animations in the test environment or wait for them to finish. Cypress notes that action-command animation settings do not prevent an unrelated animation from appearing mid-frame in a screenshot.
  5. Mask narrowly. Hide or mask a small genuinely volatile third-party region when it cannot be controlled. Do not raise the whole-page mismatch threshold to suppress one unstable widget.
  6. Pick meaningful checkpoints. Cover key pages, shared components and important states. Prefer a component-level snapshot when a full page would make unrelated layout changes fail the same assertion.
  7. Review baselines. Inspect the expected, actual and diff images. Update a baseline only after confirming the new appearance is intentional.

Cypress’s guidance summarizes the timing rule as: “Take a snapshot only after you confirm the page is done changing.” Cypress documentation

5. Choose for your team in India

Use this checklist in a short pilot with one representative page and one component:

  • Does the existing end-to-end suite already use Cypress or Playwright? Switching frameworks solely to gain screenshot assertions may cost more than adding a suitable comparison workflow.
  • Can local development and CI use the same pinned OS/browser/font environment?
  • Are hosted page snapshots allowed under the team’s data-handling and procurement rules?
  • Which customer browsers and viewport sizes actually need coverage? Verify current support in each framework and any proposed visual service rather than assuming the matrices match.
  • Who reviews diffs and approves intentional baseline changes, and how are CI artifacts retained?
  • What is the current service price in the team’s billing currency and procurement context? The cited docs do not establish India-specific prices or regional availability; check vendors directly.

Playwright’s built-in assertion is a straightforward fit if the team wants the comparison close to its tests and is comfortable maintaining local snapshots. Cypress is a sound fit when the team already has a Cypress suite and can select a plugin or service whose baseline, browser coverage and review workflow meet its needs. Neither choice removes the need to stabilize pages and review changes.

For browser support, compare the current framework documentation against the actual customer matrix. Cypress lists its browser launching options and notes WebKit support is experimental; Playwright documents its browser binaries and channels. These pages may change: Cypress browser launching and Playwright browsers.

6. Troubleshooting visual test failures

Symptom Likely cause Fix
Diff fails every CI run but looks unchanged OS, fonts, browser version, headless mode or viewport differs from baseline generation. Generate and compare in the same pinned environment; set viewport explicitly and install consistent fonts.
Only text or dates differ Live data, current time, locale or timezone changes. Use stable fixtures, freeze time, and configure locale/timezone where relevant to the test.
Image captures a spinner or partial layout Capture started before data or client rendering finished. Wait for a meaningful visible state or response, then snapshot.
Thin bands or small regions change intermittently Animation, blinking caret, video, ads or third-party widgets. Disable motion, hide the caret, or mask just the uncontrollable region.
Playwright says no expected snapshot exists This is the first run or snapshot path/project naming differs. Run the test, inspect the created baseline, verify its path, and commit it.
Playwright baseline update makes many files change Update was run in a different browser or environment, or an unintended broad UI change occurred. Review the diff and environment before accepting; regenerate from the canonical CI setup if appropriate.
Cypress captures a PNG but the test passes on visual changes cy.screenshot() is capture only. Install and configure a comparison plugin or service; use its documented assertion command.
Plugin command is unknown or baseline cannot be found Plugin registration, support-file import, command naming or fixture path is wrong. Follow that plugin’s current setup guide and confirm its support code runs before the test.
Too many diffs to review Snapshots cover incidental or oversized surfaces. Reduce to high-value page states and component-level targets; assign clear ownership.
Raising threshold hides meaningful regressions A broad tolerance was used to silence noise. Find and control the changing input; use narrow masks and conservative thresholds.

7. Performance, reliability and cost

Both approaches add browser rendering, image capture and comparison work to the test pipeline. The provided sources do not establish a reliable speed winner, and actual time depends on page weight, number of checkpoints, browser matrix, CI hardware and whether comparison runs locally or in a hosted service. Keep snapshot count intentional and measure the pilot in the team’s own CI.

Local snapshots and plugins keep comparison under team control and can avoid sending captured pages to a visual-testing service. They also make the team responsible for stable renderers, baseline storage, diff artifacts and approvals. Hosted services can centralize review and render across multiple browser or viewport configurations, but add service cost, network dependency and data-handling review. Confirm current vendor plans and terms directly; do not assume a free tier or India-specific price from this comparison.

Reliability comes mainly from controlling inputs and reviewing output, not from choosing a framework name. A screenshot test detects rendering changes, but it cannot establish semantic correctness, accessibility conformance or that a workflow behaves properly. Keep functional assertions and accessibility checks alongside visual comparisons.

8. ScreenshotNeo: an alternative to try first

If the need is to capture clean website screenshots through an API rather than maintain browser automation for capture, try ScreenshotNeo, a website screenshot API and MCP server from Yorker Media. It is not a replacement for an assertion inside a Playwright or Cypress test when you need to compare an approved baseline on every commit; it is an alternative for screenshot capture workflows and AI agents.

Or skip the browser setup

One GET request returns an image or PDF. For the screenshot options and authentication details, see the ScreenshotNeo documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo accepts cookie/consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets before capture; each cleanup step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots. Every feature is on every plan.

Sign up free for 1,000 screenshots a month, with no card required.

FAQ

Does Playwright create a baseline automatically?

Yes. The first toHaveScreenshot() run creates the expected image; review and commit it, then later runs compare against it.

Can Cypress take screenshots without a plugin?

Yes, with cy.screenshot(). That command captures an image but does not perform visual comparison.

Should every page get a full-page snapshot?

No. Choose a small set of meaningful states. Use component-level captures when they reduce unrelated failures and make diffs easier to review.

Which framework is better for Indian QA teams?

The sources do not establish a country-wide preference. Pilot against your current framework investment, CI consistency, browser needs, data rules, reviewer capacity and current vendor pricing.

Do screenshot diffs replace accessibility testing?

No. Pixel comparison cannot determine whether contrast or other accessibility requirements meet a standard; run accessibility checks separately.

Sources

Framework capabilities, browser support, integrations and commercial plans can change. Check linked vendor documentation and current pricing before adopting a workflow.