this post was submitted on 26 Jul 2026
31 points (100.0% liked)

Programming

27848 readers
451 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS
 

Ran into a situation last week that got me thinking about how most teams handle visual changes in production.

We pushed a CSS update that was supposed to fix button alignment on one page. Looked fine in staging. Looked fine in the PR preview. Got merged, deployed, and broke the card layout on three other pages because of a shared utility class.

Caught it about four hours later when a customer mentioned it in a support ticket. Not a great look.

What we tried

After that incident we talked about adding visual regression testing to CI. Looked at a few options:

  • Percy — solid, but the pricing gets steep once you have more than a handful of pages and multiple PRs a day

  • Playwright screenshots in CI — free, but you need to maintain baseline images and the diffs are noisy. Every font rendering difference across runners triggers a false positive

  • Manual spot checks after deploy — what we were doing. Obviously not sufficient

We ended up going with Playwright screenshot comparisons but with a pretty generous diff threshold (0.3%) to cut down on false positives. It catches big layout shifts but ignores sub-pixel rendering differences. Good enough for now, but not ideal.

The production monitoring gap

CI-based visual testing only covers what happens before deploy. It doesn't catch things that break after — CDN caching serving old assets, third-party scripts injecting unexpected elements, A/B test variants rendering wrong.

Some teams run synthetic monitoring that takes periodic screenshots of production pages and compares them. That covers the post-deploy gap but it's a separate system to set up and maintain.

Curious what others do

How are you handling visual verification in production? Specifically:

  • Do you run any visual checks post-deploy, or only in CI?

  • If you use screenshot comparison, how do you deal with dynamic content (dates, user-specific data, ads)?

  • Anyone running continuous visual monitoring on production pages on a schedule?

Feels like there should be a simpler answer than "maintain 200 baseline images and pray the CI runner has the same font rendering as last time."

top 12 comments
sorted by: hot top controversial new old
[–] IanTwenty@piefed.social 4 points 10 hours ago

Can you start to document the css in the source? So someone touches something, right above it is a comment: 'this class used for all card layouts on these type pages' or some such. Then there's a chance to spot the danger, in code review at least.

I agree with others here: visual testing should be last result as it is brittle, sweeping and numbing.

[–] Kache@lemmy.zip 2 points 12 hours ago* (last edited 12 hours ago)

Depends how much it matters. See if you can get the business to put it in dollar value terms or at least as opportunity costs against other eng work.

Would be sort of a spike project, but would be interested to see how well off-the-shelf VLMs could handle screenshot comparisons, and then a bit extra to see how to deploy them efficiently and effectively.

[–] sobchak@programming.dev 6 points 18 hours ago (1 children)

Last time I worked on a large, long running web project, a person would manually check nearly everything. He kept a checklist of what to check, which covered nearly every page, modal, and dialog on staging before we deployed. We did try the snapshot thing for a little bit, but it caused more problems than it solved.

[–] vrek@programming.dev 3 points 16 hours ago (2 children)

At my last job all testing was manual, it was so painful. Like we had a c# application and there was literally a requirement of "system must run on c# framework 4.8.1" so test gave instructions to go into registry and the key to check and the tester had to write the value seen, it was then scanned in as a pdf and reviewed by 6 people who all had to check that the value matched what was in the test case.

[–] sobchak@programming.dev 3 points 15 hours ago (1 children)

Lol, yeah. We also had to do stuff like that for auditing and compliance because the application interacted with the company's accounting system.

[–] vrek@programming.dev 3 points 15 hours ago

This was medical device testing so I get it but oh my go so annoying

[–] vrek@programming.dev 1 points 15 hours ago

Error handling verification was go into visual studio, set break point, run in debug, run till break point hit, unplug network cable, confirm application stopped running with appropriate error code

[–] jtrek@startrek.website 2 points 17 hours ago

When I tried Percy it was really bad. I think it wasn't even doing real screenshots, but some horrible serialization of the dom nonsense. Some of what came out of their tests just wasn't accurate at all.

Every time I've tried to implement visual tests it's a bad time.

A good unit test encodes intent. This kind of test, and snapshot tests, tends to be too broad. Something changed but was it on purpose? I dunno maybe just accept it. People don't look at it closely. It's numbing.

As others have said, you probably want to stop having shit randomly shared in multiple places. If you change something used in more than one place, probably manually check.

[–] MagicShel@lemmy.zip 3 points 19 hours ago

I can't really provide a better answer — I would've recommended Playwright — but I will say this:

I really don't like sharing classes across UI elements. I know that bridge is likely crossed for you, but it violates separation of concerns. When I worked at a big automaker, instead of setting sizes on elements, we used a standard class like size-3, where everything computed to size value *4 pixels. It was the stupidest thing I've ever seen. The only thing you could do if you wanted to change element size or positioning is change the base value across the entire web UI. Or change the class. Just like you could change the size on the element itself.

Standards like this are why I left "full stack" for back-end only. I can do everything on the client end, but I can't stand how front ends are built.

[–] kibiz0r@midwest.social 1 points 16 hours ago* (last edited 16 hours ago)

I can say a little bit on tooling: We’ve experimented with Chromatic. We’re on a mobile app though, so the idea with Chromatic is to render via react-native-web, which has its own issues, so the ROI is such that we haven’t taken it beyond POC. Seems nice though, and probably more in line with your domain.

But for org strategy, I take it you’re on a much bigger team than I ever have been. (10 people max for me) So I can’t speak to personal experience there, but what I will say is that being able to control your entire env top to bottom is crucial for pretty much anything where you want high fidelity testing.

Like, being able to set up an env that allows you to play with stuff like externally-sourced ads and CDN caches in a space that’s private and temporary. No small feat, but that’s pretty much what you have to do if you want to catch those Rube Goldberg style failures before prod.

It depends how much it’s worth it to you, to have a test env that’s 99.999% realistic. As with anything, the first two 9s are the cheapest.

[–] danda@lemmy.zip 1 points 17 hours ago

I've used BackstopJS, but it sounds a lot like Playwright. You can target and exclude certain elements, which is how I test individual components or exclude dynamic content. It's old and janky but it's better than nothing I guess.

[–] pHr34kY@lemmy.world 1 points 17 hours ago

Playwright is a lot of maintenance.

As a dev, I usually have a good idea of what my change may "touch". I write detailed notes for testers. I fixed a dropdown box glitch this week, and I had to mention the one other dropdown that called this particular function in a place you wouldn't expect.

We're told to make changes that "touch" as little as possible. Obviously because this stuff is a nightmare to test for regressions.