Visual regression: detect unintended UI changes by comparing screenshots before/after.
Process:
- Capture baseline screenshot.
- Make change.
- Capture new screenshot.
- Compare pixel-by-pixel.
- Flag differences.
Tools: Percy, Chromatic, BackstopJS, Applitools.
Use cases:
- Lightning page rendering.
- Custom LWC components.
- Email templates.
- Dashboard layouts.
Pros: catches visual bugs missed by functional tests.
Cons: brittle (false positives from minor renderings), expensive at scale.
Best for: visual-critical components, brand-sensitive UI.
Senior insight: visual regression complements but doesn't replace functional testing.
