DEV Community

Vitalii Holben
Vitalii Holben

Posted on

I Stopped Screenshot-Testing Every Page and My CI Got 4x Faster


title: I Stopped Screenshot-Testing Every Page and My CI Got 4x Faster published: true tags: testing, webdev, ci, performance

We had visual regression tests on about 340 pages. Full-page screenshots, pixel diff comparison, the whole thing. CI pipeline took 22 minutes just for the visual step.

It was thorough. It was also killing our velocity.

The breaking point was when a junior dev pushed a one-line CSS fix and had to wait 25 minutes for the pipeline to tell him it was fine. He started merging without waiting for CI. Cant really blame him.

So I sat down and looked at what those 340 screenshots were actually catching. Went through the last 6 months of visual diffs that blocked merges. Total: 47 legitimate catches. The rest were either false positives (font rendering differences between containers) or changes so minor nobody cared.

Of those 47 real catches, 41 were on just 23 pages. The checkout flow, the pricing page, the dashboard, a couple of marketing landing pages. The other 317 pages had caught exactly 6 real issues in half a year.

The fix was stupidly simple. I cut the visual test suite to those 23 high-value pages plus maybe 10 more that had complex layouts. 33 pages total.

CI went from 22 minutes to about 5. The screenshot step specifically dropped to under 90 seconds.

What about the other 300+ pages? We run a full visual sweep once a week on a schedule. Not on every PR. If something breaks on the about page or a blog post template, we find out within a week. Thats fine.

# nightly-visual.yml
schedule:
  - cron: "0 3 * * 1"  # Monday 3am
jobs:
  full-visual:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm run test:visual -- --suite=full

The critical pages still get tested on every push. The rest get a weekly check. Nobody has complained. No regressions slipped through that we didnt catch within the week.

Honestly should have done this a year ago. We were spending compute and developer time protecting pages that barely ever change.

What does your visual testing coverage look like? Curious if anyone else has gone through a similar pruning exercise.

Top comments (0)