I only tweaked global font sizes and button spacing—all functional tests stayed green, yet the mobile pricing button overflowed off-screen. How do we catch layout drift automatically?
Visual regression testing compares rendered page screenshots pixel by pixel before and after a change to catch layout shifts, overlap, and styling breakage.·After editing shared buttons or dark-mode tokens, new desktop and 390px mobile screenshots are diffed against approved baselines to highlight changed regions. It catches broken UI that functional tests miss, but dynamic timestamps, animations, or intentional redesigns also create diffs, so test data must be frozen and diffs reviewed before updating baselines.
Add visual regression tests for the pricing section and checkout page at desktop and 390px mobile widths. Freeze dynamic dates and sample data before capturing baselines, and when diffs appear, show me the diff image instead of overwriting baselines automatically.
↳Key difference: E2E still clicks the button and stays green, while visual diff flags the overflow; fix the CSS rather than overwriting the baseline.
How to review and stabilize visual diffs
Use the diff image to choose between fixing CSS or updating baselines: A visual failure only says the rendered pixels changed. If you see unexpected wrapping, clipping, or overlap, fix the stylesheet; if you intentionally changed colors or typography, inspect the diff and update the baseline explicitly.
Freeze moving content before taking screenshots: Live clocks, animations, random avatars, and cross-OS font rendering can cause noisy diffs without code changes. Seed fixed data, pause animations, and capture baselines in a consistent environment such as CI.
Quick checkChoose the best answer
You only adjusted the top navbar height, yet CI visual regression flags a 14% pixel diff on the 390px mobile pricing card where the button overflows the card. What should you do next?