All posts
automationtest-automationci-cd

Test automation that actually pays back: a pragmatic playbook

Automation projects rarely fail because of bad tooling. They fail because teams automate the wrong tests. Here's the order that actually works.

Daniel OwusuMay 5, 202611 min read
Test automation that actually pays back: a pragmatic playbook

If you've been around QA long enough, you've seen at least one automation project quietly die. A six-month "Cypress migration" that ends up with 40 flaky tests nobody trusts. A Playwright suite that takes 22 minutes to run and gets disabled before a launch.

It's not the tools' fault. It's the order.

A laptop showing a CI pipeline

The order that actually works

The teams who get a return on automation tend to follow the same sequence — even if they didn't plan it that way.

1. Stabilize the boring stuff first (API + smoke)

Before anything else, automate the tests that:

  • Don't depend on UI rendering.
  • Run in seconds.
  • Catch ~80% of "did the deploy work?" failures.

These are usually API contract checks plus a handful of end-to-end happy paths. They pay back the fastest because every other downstream test depends on them passing.

2. Add visual regression for surface-level rot

Your second wave is the cheap-to-write, high-signal stuff: visual regression on the 10 most-trafficked screens. Diff per pull request. You'll catch a surprising amount of CSS-driven regressions you'd never write a unit test for.

# .github/workflows/visual.yml
on: pull_request
jobs:
  visual:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npx lepta-cli visual run --project web

3. Automate the bugs that have already happened twice

This is the rule that quietly determines whether your suite has any real value. Don't try to predict regressions — automate the ones that have actually shown up before.

When a bug ships and gets fixed, before you close the ticket, write the test that would have caught it. In Lepta QA we surface this as a "Capture as test case" action right inside the bug detail.

A pair of devs reviewing test cases on a screen

4. Save flaky end-to-end UI for last

Most teams do this exactly backwards: they start with a Playwright spec for the signup flow, hit half a dozen race conditions, and lose faith. End-to-end browser automation works, but it requires a level of test infrastructure (data setup, auth shortcuts, deterministic clocks) that you should build after layers 1 and 2 are stable.

The three numbers worth tracking

If you only track three metrics:

  1. Suite duration on the median PR. When this creeps past ~10 minutes, devs start ignoring it.
  2. Flake rate. Anything above ~2% means people will retry instead of investigate, and the suite becomes noise.
  3. Bugs caught in CI vs. production. The whole point of automation is moving discoveries left. If this ratio isn't trending toward more-in-CI, you're investing in theater.

Automation isn't a project. It's a habit you build alongside shipping.

Where Lepta QA fits

We try to make every layer above feel boringly obvious:

  • API testing with assertion chains, environments, and historical run reports — not a separate Postman silo.
  • Visual regression with auto-baselining and approval workflows that don't require a screenshot review meeting.
  • Bug-to-test-case capture so the "automate it after it bites you twice" rule is literally one click.

Stack that on top of CI and your suite stops being a pile of tests and starts being a safety net.

Try Lepta QA

Stop juggling tabs. Ship with confidence.

Run live testing rooms, capture bugs, and let AI summarize the work — all in one workspace.