Visual testing vs snapshot testing: what each checks
Comparing a visual testing tool vs snapshot testing? Understand image, data and ARIA snapshots, screenshot assertions, and the review work behind visual regression testing.
Choosing a visual testing tool vs snapshot testing starts with the evidence you want. A snapshot can hold serialized data, accessible structure or an image; the term alone does not specify appearance coverage. Screenshot testing with an image assertion can implement visual regression testing. The categories overlap. The distinction is visible in the Jest, Playwright image and ARIA snapshot documentation.
Imagine a booking summary whose confirmation button spills beyond a narrow card after a spacing change. The words and markup could remain unchanged. An image comparison at that width addresses the appearance risk; a data assertion addresses a different contract. This hypothetical example is the thread through this guide: name the possible defect, then choose evidence that could expose it.
The short version
Ask two questions when someone says “snapshot test”: what is saved, and what is compared? Jest uses the term for serialized values and distinguishes its feature from screenshot comparison. Playwright also documents image references and text snapshots taken from browser content. Running in a browser does not, by itself, tell you which evidence an assertion checks. (Jest explanation; Playwright comparisons.)
Then ask who will decide whether a difference is acceptable. A comparison needs an interpretation: a changed button label might be required copy, an accidental edit or a symptom of the wrong page state. A tool name cannot settle that question.
For a practical definition of the surrounding process, see our guide to visual regression testing. When evaluating an approach, separate capture, comparison, reference storage, review and coverage planning. Decide which responsibilities the runner handles and which belong to the people maintaining the application.
What does your snapshot contain?
Read an assertion as a contract about a particular representation. The table distinguishes a failed comparison from a missing comparison, and separates both from the responsibility to review changes. Its limits describe the chosen evidence, not a verdict on an entire testing framework.
An ARIA snapshot checks roles, names, states and hierarchy against a template. That template may intentionally describe only part of the accessible structure. It is not a pixel reference. Consequently, matching it does not establish complete accessibility, and matching an image does not establish correct interaction. Plan separate checks for the questions each representation leaves open. (ARIA snapshot guide.)
A serialized DOM or data assertion can detect changed values, including style or class information when that information is serialized. If the compared representation stays unchanged while appearance changes, that assertion has no changed input to report. Avoid assuming either that every CSS change escapes it or that a matching structure proves the layout. (Jest snapshot inputs.)
| Evidence | Meaning of a difference | Important blind spot |
|---|---|---|
| Serialized data or DOM | The saved values and current serialization differ. Jest | Appearance beyond those values. |
| ARIA template | The selected accessible structure does not match. Playwright | Pixels and semantics outside the template. |
| Raw screenshot capture | No reference assertion yet; it produces an image. Page API | No automatic regression conclusion. |
| Image assertion | The capture falls outside configured comparison limits. Assertion API | Behavior and uncaptured states. |
| Review and coverage workflow | A person must resolve a change against requirements. | Ownership is a process, not another image format. |
Read a serialized assertion
This illustration belongs in a separate Jest test file, with Jest configured and the imports shown below. toMatchSnapshot receives an object and compares its serialized form with a reference. (Jest snapshot documentation.)
The constant is deliberately small so the input is easy to see. It is not useful application coverage on its own. A real check would supply output from the code under test. Decide whether reviewing the whole object adds value; when the contract concerns one total or one status, a focused assertion may communicate the requirement more clearly.
This is an unexecuted illustration, with no generated reference or claimed result. Treat a proposed reference as something to inspect against the requirement, not as evidence that the initial value was correct.
// booking-data.test.js — illustration only
import { expect, test } from '@jest/globals';
test('booking data reference', () => {
const booking = { currency: 'USD', guests: 3, status: 'draft' };
expect(booking).toMatchSnapshot();
});Read a screenshot assertion
The second illustration is a separate Playwright Test file. It assumes an existing baseURL pointing to an application you own, an available /pricing route and a controlled page state. Imports appear in the example; application fixtures and readiness checks are omitted. Our Playwright setup guide provides background navigation.
The page.screenshot call saves a diagnostic image. The toHaveScreenshot assertion performs a separate capture sequence: it waits for two consecutive matching captures, then compares the final capture with its reference. It does not compare the earlier pricing-debug.png file. Neither operation was executed for this article. (Capture API; screenshot assertion.)
The corresponding names differ in Vitest. Its Browser Mode guide documents toMatchScreenshot image comparisons. The API documentation checked November 5, 2026, with v5.1.0 navigation, labels that matcher experimental and describes capture retries for stability. Do not transfer Playwright’s matcher name or assume these details apply to every historical release. (Vitest guide; Vitest assertion API.) Our Vitest visual testing guide offers further context.
// pricing-appearance.spec.ts — illustration only
import { test, expect } from '@playwright/test';
test('pricing page appearance', async ({ page }) => {
await page.goto('/pricing');
await page.screenshot({ path: 'pricing-debug.png' });
await expect(page).toHaveScreenshot('pricing-reference.png');
});Which checks fit your risks?
Start with a sentence a reviewer could challenge: “A long booking label must remain readable beside the confirmation button.” That sentence identifies a state and a visible relationship. “Add snapshot coverage” leaves both undecided. The hypothetical choices below turn particular concerns into proposed evidence; they are recommendations, not observed test outcomes.
Choose the smallest check that makes the intended contract understandable. A broad reference can be helpful when several relationships deserve review together. For an isolated requirement, an explicit assertion may make a failure easier to explain. Neither choice removes the need to understand what the test actually observes.
In the booking example, consider two separate revisions. A spacing edit leaves the compared data unchanged but clips the button at the selected width. A deliberate wording edit changes the label while the layout remains acceptable. The first calls for a layout repair; the second calls for review against approved copy. Treating every difference as either a defect or an automatic update would miss that distinction.
| Change under review | Useful evidence | Separate check still needed |
|---|---|---|
| Booking summary values change | A focused value assertion or data reference | Verify the required total. |
| Confirmation button name changes | An accessible-name assertion or ARIA template | Exercise keyboard interaction. |
| Narrow card clips its contents | An image comparison at the selected width | Check that confirmation works. |
| A request times out | A diagnostic screenshot for investigation | Assert the required recovery behavior. |
From capture to a reviewed regression check
Choose a representative state and identify the requirement it represents. Before comparing a revision, inspect the initial reference. A consistently wrong screen can become a consistently matching reference. Write down what the reference is meant to demonstrate so its authority comes from review, not simply from being the older file.
Suppose a planned spacing revision makes the booking summary easier to scan but also clips a validation message. A reviewer should account for both effects. Approving the entire change because the spacing was intentional would preserve the accidental clipping. Ask the author to repair the unwanted change, then review the resulting reference against the same requirement.
A hosted service is optional: Playwright Test documents image comparison within its runner. A repository review or a hosted review interface can be considered according to how your team wants to examine and approve changes. The runner’s comparison is one part of that decision. (Playwright visual comparisons.)
Vitest’s guide distinguishes creating an initial reference from deliberately reviewing updates. Use that distinction when assigning ownership: generating a file is not an explanation of why its contents should be accepted. Our visual test baseline guide expands on the reference lifecycle. (Vitest reference guidance.)
| Review question | Evidence to record | Decision |
|---|---|---|
| Is this the intended state? | Fixture, route and reference revision | Correct setup before judging appearance. |
| What change was requested? | Requirement and affected region | Explain the intended difference. |
| What else changed? | Unexpected regions, including error messages | Repair defects before approval. |
| Who owns the next revision? | Named reviewer and approval reason | Retain an accountable reference. |
Make differences explainable
When a difference is surprising, first verify the scenario. Did the test reach the intended route, account and data state? Then compare the conditions used for the reference and the new capture. Investigate content and font readiness, motion and any excluded regions before deciding that the comparator is too strict. This is a proposed diagnostic order, not a measured ranking of failure causes.
Playwright distinguishes the color difference permitted at a pixel from the allowed number or proportion of differing pixels. Its screenshot assertion disables animations by default, and masks can obscure selected regions. These are different controls with different consequences; they are not interchangeable fixes. (Screenshot assertion options.)
For example, excluding a changing promotion could also exclude a broken link label inside that region. A generous allowance could admit a small but consequential missing icon. Before changing a setting, describe the variation you intend to disregard and the defect you still need to detect. If that distinction is unclear, investigate further instead of broadening acceptance.
Record the selected viewport, browser and rendering environment, fixture, and readiness assumptions beside the check. Treat those details as review context: a future maintainer should be able to understand which conditions make a comparison meaningful. For a longer investigation checklist, see fixing flaky visual tests.
Stability is necessary for a useful comparison, but it is not proof of correctness. A stale error screen can be perfectly repeatable. Revisit what the image represents whenever the application’s requirements change, rather than treating a quiet check as permanent evidence that the requirement is satisfied.
Define the coverage you actually own
Describe coverage as a list of selected situations, each with a review owner. For the hypothetical booking interface, that might mean long labels at one narrow width, an empty-form validation message at a chosen desktop width, and a returning customer’s summary with a stable account fixture. These are examples of scope, not a complete coverage prescription.
For each situation, record the reason it matters and the event that should trigger another review. A change to booking copy might prompt a check of long labels; a new error message might prompt a check of the validation state. Make the owner responsible for noticing when the original example no longer represents the risk.
Unlisted states, content variations, themes and viewports remain open questions. A picture of a confirmation screen does not establish that the preceding booking flow works. Keep behavior requirements alongside visual requirements, and avoid converting a successful selected comparison into a claim about every route. Use accessibility regression testing as a companion topic when planning semantic and interaction checks.
You do not need three separate suites merely to satisfy three labels. Choose assertions from the risks, then choose tooling that makes those assertions and their review responsibilities clear. Reconsider the selection as the product changes. The useful result is an explainable decision about evidence, with visible limits and a person responsible for the next change.
Frequently asked questions
Is snapshot testing the same as visual testing?
Sometimes the terms overlap. An image snapshot compares appearance; a serialized data snapshot checks values, and an ARIA snapshot checks selected accessible structure. Ask what the reference contains before interpreting a passing check as evidence about the screen.
Does screenshot testing count as visual regression testing?
It can when the test compares a current image with a reference. Saving a screenshot by itself supplies an artifact for inspection, without a reference assertion. A useful ongoing process also assigns responsibility for interpreting changes and maintaining the chosen coverage.
Can snapshot tests run in a real browser?
Yes. Browser execution does not determine the comparison payload: Playwright documents both image comparisons and text snapshots collected from browser content. Read the assertion and its input. The fact that a browser ran is not enough to establish what was checked.
Do ARIA snapshots prove accessibility or replace image checks?
No. They compare selected accessible structure rather than pixel appearance. A matching template cannot establish a complete accessibility assessment, and a matching image cannot establish correct interaction. Choose semantic, visual and interaction checks according to the requirements you need to assess.
Do I need a hosted service or three separate test suites?
Neither follows from these definitions. Runners can provide image comparison without a hosted review service. Select checks and review arrangements from your risks and responsibilities; one tool may serve several purposes. Buying or maintaining more categories of tooling does not itself establish useful coverage.
When should I update a baseline?
After checking that the captured state is correct and the changes are intended. Review unexpected regions as well as the requested change. Repair defects before approving the replacement, and retain an explanation that helps the next reviewer understand why the new reference was accepted.
Sources
- Snapshot Testing · Jestchecked 2026-11-05
- Visual comparisons | Playwrightchecked 2026-11-05
- Page | Playwrightchecked 2026-11-05
- PageAssertions | Playwrightchecked 2026-11-05
- Snapshot testing | Playwrightchecked 2026-11-05
- Visual Regression Testing | Vitestchecked 2026-11-05
- Assertion API | Browser Mode | Vitestchecked 2026-11-05