Why Visual Bugs Are Harder to Catch Than Functional Bugs
A login button that doesn’t work is easy to report. A login button that works perfectly but sits 4px lower than every other button on the page is a different story. The application passes the functional test. The API returns 200. The button is clickable. The form submits successfully. But something still feels wrong. Maybe […]

A login button that doesn’t work is easy to report.
A login button that works perfectly but sits 4px lower than every other button on the page is a different story.
The application passes the functional test. The API returns 200. The button is clickable. The form submits successfully.
But something still feels wrong.
Maybe the button is slightly misaligned. Maybe the font is one size too large. Maybe a card has 24px of padding instead of 20px. Maybe the layout looks perfect on a 1440px monitor but breaks at 768px.
These are visual bugs, and they’re surprisingly good at surviving normal QA processes.
That’s where visual testing becomes important.
Visual testing isn’t about asking whether a page works. It’s about asking whether the page looks and behaves visually as intended.
And that distinction matters more than many teams realize.
What Is Visual Testing?
Visual testing is the process of checking the visual appearance and layout of an application to identify unintended differences in elements such as spacing, alignment, typography, colors, dimensions, and responsive behavior.
Functional testing answers questions such as:
- Does the button work?
- Does the API return the correct response?
- Can the user complete the checkout?
- Is the validation message displayed?
- Does the form submit?
Visual testing asks different questions:
- Is the button aligned correctly?
- Is the spacing consistent?
- Is the text the right size?
- Does the component match the design?
- Did a CSS change move something by 4px?
- Does the layout still work at different viewport sizes?
A useful way to think about it is:
Functional testing checks whether the application does the right thing. Visual testing checks whether it looks right while doing it.
Both matter.
Why Are Visual Bugs So Easy to Miss?
The biggest problem is simple:
Most automated functional tests don’t care what the UI looks like.
Consider this test:
await page.getByRole('button', { name: 'Login' }).click();
await expect(page).toHaveURL(/dashboard/);
The test can pass even if:
- the button is 6px too low
- the button text is too large
- the button overlaps another element
- the button has the wrong border radius
- the button is visually inconsistent with the rest of the application
From the test’s perspective, everything is fine.
From the user’s perspective, it might not be.
This creates a gap between functional correctness and visual correctness.
A 4px Problem Can Be a Real Bug
Developers sometimes hear:
“It’s only 4 pixels.”
That sounds insignificant.
It isn’t always.
Imagine a page containing:
- Header
- Search bar
- Filter controls
- Product cards
- Pagination
Each component is individually off by only a few pixels.
The result can be a page that feels noticeably unbalanced.
The problem becomes even more obvious when the application follows a strict design system.
For example:
| Expected | Actual | Difference | |
|---|---|---|---|
| Button height | 40px | 40px | 0px |
| Card padding | 24px | 20px | -4px |
| Input height | 40px | 44px | +4px |
| Header spacing | 32px | 28px | -4px |
| Font size | 16px | 17px | +1px |
None of these defects necessarily break functionality.
Together, they can make the interface look poorly implemented.
That’s why visual bugs should not automatically be dismissed as cosmetic.
Functional Bugs vs Visual Bugs
The difference becomes clearer when you put the two side by side.
| Functional Bug | Visual Bug |
|---|---|
| Login doesn’t work | Login button is misaligned |
| API returns incorrect data | API response is displayed with incorrect spacing |
| Checkout fails | Checkout layout breaks on mobile |
| Button doesn’t trigger action | Button has incorrect dimensions |
| Form accepts invalid data | Error message is positioned incorrectly |
| Page crashes | Page renders with broken alignment |
| Search returns wrong results | Search input doesn’t match the design |
| Navigation link is broken | Navigation items have inconsistent spacing |
Functional bugs are usually easier to express as deterministic assertions.
For example:
expect(response.status()).toBe(200);
Visual bugs often require understanding relationships between elements.
For example:
“The button should be vertically centered with the input.”
That’s not simply a value assertion.
It’s a layout relationship.
The Real Difficulty: Humans Notice Relationships
This is one of the biggest reasons visual bugs are difficult to automate and detect.
Humans don’t only look at individual elements.
We compare them.
We notice that:
- two buttons aren’t aligned
- one card has more whitespace than another
- one heading feels too close to the paragraph
- an icon isn’t centered
- a form looks slightly shifted
- the navigation doesn’t have consistent spacing
The individual elements may all be technically valid.
The relationship between them is wrong.
Consider:
.button {
margin-top: 16px;
}
and:
.button {
margin-top: 20px;
}
Both are valid CSS.
Neither causes a JavaScript exception.
Neither causes a failed API request.
Neither prevents the button from being clicked.
But one may violate the design specification.
This is where visual QA becomes valuable.
Common Types of Visual Bugs
Visual bugs aren’t limited to colors and screenshots. They can appear throughout the entire interface.
1. Spacing Differences
Spacing bugs are among the easiest to introduce.
For example:
.card {
padding: 24px;
}
becomes:
.card {
padding: 20px;
}
Everything still works.
The content still renders.
But the component no longer follows the intended spacing system.
Common examples include:
- incorrect padding
- incorrect margins
- inconsistent gaps
- excessive whitespace
- elements sitting too close together
2. Misaligned Elements
Alignment problems are particularly noticeable in forms and dashboards.
Imagine this:
Name: [________________]
Email: [_____________]
Password: [________________]
Every input works.
The form submits.
But the fields don’t line up.
This is a visual defect, not a functional one.
It can happen because of:
- different label widths
- inconsistent margins
- flexbox configuration
- grid column sizes
- different component styles
- unexpected default browser styles
3. Incorrect Font Size or Typography
Typography is another common source of visual defects.
A developer changes:
font-size: 16px;
to:
font-size: 18px;
because it looks better during development.
Unfortunately, the change affects multiple components.
Suddenly:
- headings wrap earlier
- cards become taller
- buttons change size
- layouts shift
- mobile views break
A one-line CSS change can create a chain reaction across the UI.
4. Responsive Layout Problems
Responsive bugs are especially difficult because the page can look perfect on the developer’s screen.
At:
1440px → Looks good
1280px → Looks good
1024px → Looks okay
768px → Something feels wrong
390px → Broken
A functional test running at one viewport may never discover the problem.
Responsive testing needs deliberate viewport coverage.
This isn’t only a visual-quality concern either. Responsive behavior can affect accessibility and usability. WCAG’s reflow guidance, for example, addresses whether content can be presented without loss of information or functionality when the viewport is constrained.
5. Unexpected Margins and Default Styles
Browsers and CSS frameworks can introduce subtle differences through:
- default margins
- line-height
- inherited styles
- component libraries
- browser-specific rendering
- CSS specificity
- media queries
A classic example is a heading:
h2 {
margin-block-start: 0.83em;
margin-block-end: 0.83em;
}
A developer may not realize the browser’s default style is contributing to a spacing issue.
The application works.
The layout doesn’t.
Why Manual Visual Testing Doesn’t Scale Easily
A human tester can catch visual problems.
But manually checking every page at every viewport isn’t practical for a large application.
Imagine an application with:
- 100 pages
- 5 major viewport sizes
- 4 supported browsers
- 10 important states per page
That’s potentially thousands of visual combinations.
A tester can’t realistically inspect all of them after every CSS change.
And there’s another problem:
People adapt to what they’re looking at.
If you stare at the same application every day, small differences become harder to notice.
A developer who created the page may be even less likely to notice a small visual deviation because they already know what they expect to see.
Visual Regression Testing Helps Catch What Functional Tests Miss
One approach is visual regression testing.
The basic idea is straightforward:
- Capture a known-good visual state.
- Make a code change.
- Capture the same state again.
- Compare the new image against the baseline.
- Investigate meaningful differences.
Tools such as Playwright support screenshot comparisons directly through APIs such as toHaveScreenshot(). Playwright also provides controls for acceptable pixel differences and recommends keeping screenshot environments consistent because rendering can vary between operating systems, browsers, fonts, and other environmental factors.
A simple example:
import { test, expect } from '@playwright/test';
test('login page visual regression', async ({ page }) => {
await page.goto('/login');
await expect(page).toHaveScreenshot('login-page.png');
});
The important part isn’t the screenshot itself.
It’s the baseline comparison.
You’re effectively saying:
“This page looked like this when we accepted it. Tell me when it changes.”
But Screenshot Testing Isn’t a Magic Solution
This is where teams sometimes make a mistake.
They add screenshot testing and assume the problem is solved.
It isn’t.
A screenshot comparison can tell you:
Something changed.
It doesn’t necessarily tell you:
Whether that change is actually a bug.
For example, a new release intentionally changes:
Button: blue → green
A visual regression test may report a difference.
That’s expected.
Another problem is dynamic content.
Imagine a dashboard showing:
Orders today: 1,248
Tomorrow:
Orders today: 1,391
A naive screenshot comparison may report a difference even though the application is working correctly.
This is why good visual testing needs:
- stable test data
- deterministic environments
- controlled fonts
- predictable viewport sizes
- controlled animations
- handling for dynamic content
- thoughtful baselines
Visual testing needs engineering discipline just like API or UI automation.
Visual Testing Beyond Screenshots
Screenshot comparison is useful, but visual validation doesn’t have to mean comparing entire pages.
Sometimes the better question is:
“Where exactly is this element?”
For example:
Expected:
[ Input ]
[ Button ]
Actual:
[ Input ]
[ Button ]
The application may look almost identical at first glance.
But the button has moved.
You might want to inspect:
- x/y coordinates
- width
- height
- padding
- margin
- bounding box
- alignment
- distance between elements
Browser developer tools already expose much of this information, but manually inspecting dozens of elements becomes tedious.
This is one area where tools such as Captain Spyglass can be useful.
Instead of visually guessing whether an element is 4px away from where it should be, a QA engineer or frontend developer can inspect the element’s dimensions, spacing, and alignment directly.
That’s a different workflow from screenshot regression.
And the two approaches complement each other.
Screenshot Testing vs Visual Inspection
These approaches solve slightly different problems.
| Approach | Best For |
|---|---|
| Manual visual inspection | Exploratory UI validation |
| Screenshot comparison | Detecting unexpected visual changes |
| DOM assertions | Verifying structure and behavior |
| CSS inspection | Finding the cause of layout problems |
| Dimension inspection | Checking width, height and positioning |
| Responsive testing | Finding viewport-specific defects |
A mature UI testing strategy doesn’t necessarily pick one.
It combines them.
A Real-World Example
Imagine an e-commerce checkout page.
The functional automation looks something like this:
test('checkout works', async ({ page }) => {
await page.goto('/checkout');
await page.getByLabel('Card number').fill('4111111111111111');
await page.getByLabel('Expiry').fill('12/30');
await page.getByLabel('CVV').fill('123');
await page.getByRole('button', {
name: 'Place order'
}).click();
await expect(page.getByText('Order confirmed')).toBeVisible();
});
The test passes.
But after a CSS refactoring, the checkout page has this problem:
Desktop:
┌─────────────────────────────┐
│ Billing Information │
│ │
│ Card Number [__________] │
│ Expiry [____] │
│ CVV [___] │
│ │
│ [Place Order] │
└─────────────────────────────┘
On mobile:
┌──────────────────────┐
│ Billing Information │
│ │
│ Card Number │
│ [________________] │
│ │
│ Expiry [____] CVV │
│ │
│ [ Place Order] │
└──────────────────────┘
The button still works.
The checkout still succeeds.
But perhaps the button is partially outside the viewport at a particular width.
That’s a bug.
Functional automation alone may not catch it.
Responsive visual validation might.
Common Mistakes Teams Make With Visual Bugs
Mistake 1: Treating Visual Bugs as “Cosmetic”
Not every visual problem is cosmetic.
A broken layout can affect:
- usability
- accessibility
- conversion
- readability
- navigation
- mobile usage
The visual layer is part of the product experience.
Mistake 2: Testing Only One Resolution
A page that looks perfect on a 27-inch monitor isn’t automatically responsive.
At minimum, test the important breakpoints used by your product.
Don’t blindly choose dozens of resolutions either.
Choose them based on:
- analytics
- supported devices
- design breakpoints
- user behavior
- product requirements
Mistake 3: Comparing Screenshots Without Controlling the Environment
This creates noisy tests.
Font rendering, browser versions, operating systems, and other environment differences can affect screenshots. Playwright explicitly calls this out in its visual comparison documentation.
If your baseline was generated on one environment and your CI pipeline uses another, you may spend more time investigating false positives than real bugs.
Mistake 4: Making Pixel Matching Too Strict
A zero-difference policy sounds attractive.
It can also become painful.
Minor rendering differences can create failures that have no user impact.
A better strategy is to establish sensible tolerances and review what your application considers meaningful.
The right threshold depends on the application.
A banking dashboard, a marketing website, and a design-heavy SaaS product may need very different visual-testing tolerances.
Mistake 5: Making It Too Lenient
The opposite problem is just as bad.
If your tolerance is too high, a real defect can disappear inside the accepted difference.
Visual testing should reduce noise without hiding defects.
Mistake 6: Updating Every Baseline Automatically
This is dangerous.
If a test fails and your pipeline automatically replaces the baseline, you may effectively be saying:
“Whatever the new UI looks like is now correct.”
That’s not testing.
A baseline update should be a deliberate decision.
A Practical Visual Testing Strategy
You don’t need to start by testing every page.
Start with the areas where visual defects matter most.
Step 1: Identify Critical Screens
Examples:
- Login
- Signup
- Checkout
- Dashboard
- Search
- Navigation
- User profile
- Main product workflows
Step 2: Identify Important States
Don’t test only the default state.
Consider:
- empty state
- loading state
- error state
- populated state
- validation errors
- modal open
- dropdown open
- mobile navigation
- disabled controls
Many visual bugs hide in states that developers don’t inspect regularly.
Step 3: Define Important Viewports
For example:
Mobile
390 × 844
Tablet
768 × 1024
Desktop
1440 × 900
These are examples, not universal requirements.
Your actual viewport matrix should reflect your product’s users.
Step 4: Stabilize the Test Environment
Control things such as:
- browser version
- operating system
- fonts
- test data
- animations
- timestamps
- random content
- network-dependent content
Otherwise your visual tests can become noisy.
Step 5: Combine Functional and Visual Assertions
Don’t replace functional tests with visual tests.
Use both.
await expect(page.getByRole('button', {
name: 'Place order'
})).toBeVisible();
await expect(page).toHaveScreenshot('checkout.png');
The first assertion checks behavior/state.
The second checks visual output.
Together they provide stronger coverage.
Where Visual Testing Fits in a Modern QA Strategy
A useful testing pyramid isn’t only about unit, API, and UI tests.
For frontend-heavy applications, you can think about testing across multiple dimensions:
User Experience
▲
│
Visual Testing
│
UI / E2E Testing
│
API Testing
│
Integration Tests
│
Unit Tests
Each layer answers a different question.
Unit tests
Does this piece of code behave correctly?
API tests
Does the service return the expected contract?
UI tests
Can the user complete the workflow?
Visual tests
Does the interface still look and behave visually as intended?
None of these replaces the others.
How QA Engineers Can Start Finding More Visual Bugs
You don’t necessarily need a new automation framework.
Start changing the questions you ask during testing.
Instead of only asking:
Can I click this button?
Ask:
Is the button positioned correctly?
Instead of:
Does the form submit?
Ask:
Are all fields aligned consistently?
Instead of:
Does the page work on mobile?
Ask:
Does the layout reflow correctly at the important mobile widths?
Instead of:
Is the error message displayed?
Ask:
Is it displayed in the right place, with the right spacing and typography?
This shift in thinking catches defects that traditional functional testing can miss.
A Useful Checklist for Visual QA
Before signing off a UI, check:
Layout
- Are elements aligned?
- Is spacing consistent?
- Are containers the correct width?
- Are elements unexpectedly overlapping?
- Are margins and padding consistent?
Typography
- Is the font correct?
- Is the font size correct?
- Is the line height correct?
- Are headings wrapping correctly?
- Are labels aligned?
Components
- Are buttons the correct size?
- Are inputs consistent?
- Are icons centered?
- Are borders and radii correct?
- Are disabled states visually distinguishable?
Responsive Behavior
- Does the layout reflow?
- Does content get clipped?
- Does horizontal scrolling appear unexpectedly?
- Does navigation adapt correctly?
- Do dialogs fit within the viewport?
States
- Loading
- Empty
- Error
- Success
- Disabled
- Hover
- Focus
- Validation failure
- Modal/dialog
- Dropdown
This checklist alone can improve manual visual testing significantly.
Visual Testing Is Not Just a Designer’s Responsibility
This is another misconception worth challenging.
Designers care about visual consistency.
Frontend engineers implement it.
But QA engineers are often the people validating the final product across workflows, data, browsers, and devices.
That makes visual validation a shared engineering responsibility.
A strong development workflow looks more like:
Design
↓
Implementation
↓
Functional Testing
↓
Visual Validation
↓
Responsive Testing
↓
Production
Rather than:
Developer says "looks good"
↓
QA checks functionality
↓
Ship
Where Tools Like Captain Spyglass Fit
There are two different questions when investigating a visual defect:
“Did something change?”
and
“Why is it different?”
Visual regression testing is particularly useful for answering the first question.
Developer tools and visual inspection utilities can help answer the second.
For example, if a button looks slightly too far away from an input, you may want to inspect:
Button
Width: 128px
Height: 40px
Margin-top: 16px
Margin-left: 4px
Input
Height: 40px
Now the conversation changes from:
“This button looks a little off.”
to:
“The button has an unexpected 4px horizontal offset.”
That’s much easier to communicate between QA, frontend engineering, and design.
This is the kind of problem Captain Spyglass is designed to make easier: inspect an element and understand its dimensions, spacing, and alignment without manually hunting through layers of CSS.
It doesn’t replace visual regression testing.
It makes visual investigation faster.
The Best Visual Testing Strategy Is a Combination
There isn’t one tool that catches every visual bug.
A practical strategy combines:
1. Automated visual regression
Good for detecting unexpected changes.
2. Responsive testing
Good for finding viewport-specific problems.
3. Manual exploratory testing
Good for discovering things automation wasn’t designed to check.
4. Browser developer tools
Good for understanding CSS and layout behavior.
5. Element-level inspection
Good for investigating dimensions, spacing, alignment, and positioning.
The goal isn’t to create more tests.
The goal is to catch the right defects earlier.
Final Thoughts
Functional correctness is only one part of application quality.
A page can return the correct data, execute the correct JavaScript, pass every API test, and complete every end-to-end workflow while still looking wrong.
A 4px spacing difference may sound insignificant. Captain Spyglass is best free tool to catch such issues.
An incorrectly sized font may seem harmless.
A slightly misaligned button may not break anything.
But these small defects accumulate. They affect consistency, usability, accessibility, and the overall quality users perceive.
That’s why visual testing deserves a place alongside functional, API, integration, and end-to-end testing.
The important mindset shift is simple:
Don’t only test whether the application works. Test whether it looks like the application you intended to build.
Once QA engineers start looking for relationships—spacing, alignment, dimensions, typography, responsive behavior—an entirely different class of bugs becomes visible.
And those are often the bugs users notice first.
Frequently Asked Questions
What is visual testing in software testing?
Visual testing verifies that an application’s UI looks and behaves visually as expected. It can identify issues involving spacing, alignment, typography, colors, dimensions, layout, and responsive behavior.
What is the difference between functional testing and visual testing?
Functional testing verifies what an application does, such as submitting a form or returning the correct API response. Visual testing verifies how the application appears, including layout, spacing, alignment, typography, and responsive presentation.
What are examples of visual bugs?
Common examples include misaligned buttons, incorrect padding or margins, wrong font sizes, inconsistent spacing, overlapping elements, incorrect colors, clipped content, and responsive layouts that break at certain viewport sizes.
Is visual regression testing the same as visual testing?
Not exactly. Visual regression testing generally compares a current UI against an accepted visual baseline to identify unintended changes. Visual testing is broader and can also include manual inspection, responsive testing, element measurements, CSS validation, and UI inspection.
Can Playwright be used for visual testing?
Yes. Playwright Test supports screenshot-based visual comparisons using APIs such as toHaveScreenshot(). Teams can maintain baseline screenshots and compare later test runs against those references.
Why do visual regression tests produce false positives?
Differences in browsers, operating systems, fonts, rendering environments, dynamic content, animations, and test data can cause screenshots to change even when the application isn’t actually broken. A consistent test environment and controlled test data are important.
Should QA automate visual testing?
For important and frequently changing UI areas, automation can be very valuable. It shouldn’t completely replace exploratory testing, though. Automated visual tests are best combined with manual investigation and responsive testing.
Are visual bugs important for accessibility?
They can be. Some visual and responsive defects directly affect usability and accessibility. For example, WCAG’s reflow requirements address whether content remains usable when displayed in constrained viewport widths.
