What is visual regression testing, and what defects is it good at finding?
Answer
Visual regression testing compares a rendered page or component with an approved baseline image. It is effective for unintended layout, typography, spacing, color, clipping and responsive changes that DOM assertions may miss. It should complement semantic and accessibility checks because a matching screenshot does not prove correct behavior, usable focus order or meaningful content.
Strong answer includes
- explains baseline image comparison
- names visual defects that semantic assertions miss
- does not replace functional or accessibility testing
Practical example
A CSS refactor accidentally removes a max-width rule on a pricing table; every DOM assertion still passes because the correct text and elements are present, but a visual-regression diff immediately flags that the table now overflows its card on a 1280px viewport.