Vibe coded app
Vibe Coding Rescue

How to Add Tests to a Vibe-Coded App That Has None: The Five Flows That Matter First

7 min read | Updated September 2026

Every guide in this series ends up at the same instruction: get a test suite, then make the AI run it before saying “done.” This is the how. Not a testing philosophy — a practical sequence for adding the first useful tests to an app that has none, written for a founder who’s never written one, in the order that buys the most safety per hour.

Short answer

Don’t try to test everything. Write five end-to-end tests for the five flows that would end your week if they broke (sign up, log in, the core action, paying, and the thing you changed most recently). Wire them to run automatically on every change. That’s a day of work and it catches the majority of “the AI broke something I didn’t touch” incidents. Everything after that is optional refinement.

Why AI-built apps have no tests

Because nobody asked. Chat-based tools build what you describe, and you described features, not proof. The result is an app where “it works” means “it worked the last time I clicked through it” — and every new prompt is a chance to silently undo an old one. Tests turn that into a fact the machine checks for you, which is the whole difference between prompting nervously and prompting freely.

Step 1: Pick the five flows

Write them down as plain sentences before touching code. For most SaaS apps:

1
A new user can sign up and lands somewhere sensible
Covers registration, email verification if you have it, and the first-run screen.
2
An existing user can log in and see their own data — and only theirs
Two accounts. Account A must not see account B’s records. This is the 5-minute security test made permanent.
3
The core action works end to end
Whatever your product is for: create a project, upload a file, generate a report. Create it, see it, edit it, delete it.
4
Paying changes what the user can do
Using the payment provider’s test mode: complete checkout, confirm the entitlement flips; cancel, confirm it flips back. Stripe in a vibe-coded app explains why the second half matters.
5
The thing you changed most recently
Whatever the last three prompts touched. It’s the most likely to regress next.

Step 2: Write them as end-to-end tests

End-to-end (E2E) tests drive a real browser through the real app, the way a user would. For a founder, they’re the right first kind: you don’t need to understand the code’s internals to write “click the Sign up button, fill the form, expect to see the dashboard.” Playwright is the standard tool and the one AI assistants know best. The prompt that works, in Claude Code or your tool of choice:

Add Playwright to this project. Write end-to-end tests for these five flows:
[paste your five sentences]
Use a separate test database / test environment, never production.
Create test users inside the tests; don't depend on existing data.
Add an "npm test" script that runs them. Run it and show me the output.
Don't change any application code to make tests pass — if a test fails,
tell me why and stop.

That last line matters. Left alone, an AI will “fix” a failing test by editing the test until it passes. You want the failure — it’s the tool telling you something is already broken.

Step 3: Make them run without you

A test suite only counts if it runs on every change. Two places to wire it:

In CI, on every pull request
GitHub Actions (or your host’s equivalent). The prompt: “Add a GitHub Actions workflow that runs npm test on every pull request and blocks merging if it fails.” Now nothing reaches main untested — whether a person or an AI wrote it.
In your CLAUDE.md / tool instructions
“Run npm test before reporting any task as done. If tests fail, report the failure; don’t modify tests to pass.” This makes the AI’s “done” mean something on your machine, before CI ever sees it.

Step 4: Add the second layer when it earns its place

E2E tests are slow and broad. Once they exist, add fast, narrow unit tests only where logic is intricate and expensive to get wrong: money calculations, date and timezone handling, permissions, anything with “if” chains you can’t hold in your head. Ask the AI to “list the five functions in this codebase with the most branching logic” and start there. Most vibe-coded apps need surprisingly few — the risk is in the seams, and E2E covers seams.

What this changes about how you build

From here on, every prompt gets a free safety net. You can say “refactor this” or “upgrade that library” — the changes that used to be terrifying — and get a yes/no answer within minutes instead of a customer email within days. It’s also the precondition for everything in the 12-point audit: hardening without tests is guessing. And if you bring in an engineer, tests are the first thing they’ll add anyway — arriving with five in place shortens the handoff and the bill.

FAQ

How long does this take?
For a typical single-product app with a founder driving the AI: a day for the five E2E tests and the CI wiring, sometimes two if the app has no test environment yet. Setting up a separate test database is usually the slowest part.
Tests keep failing randomly — what’s wrong?
Usually the test depends on timing (waiting a fixed second instead of waiting for an element) or on data left over from a previous run. Ask the AI to fix exactly those two things; don’t let it add retries as a cure.
Can I skip this if I’m on Lovable / Bolt / v0?
You can’t run CI inside the builder, which is one of the ceilings in moving off the prototype platform. You can still write Playwright tests against the deployed URL and run them locally before each publish — better than nothing.
Do I need 100% coverage?
No. Coverage numbers reward testing easy code. Five flows that matter beat five hundred assertions on helpers nobody breaks.

Want the safety net installed with you?

A one-day session: test environment, the five flows as Playwright tests, CI wiring and the tool instructions that make “done” mean done.

Book a Test-Setup Day →

Engineering Insights

Latest from Syntaxa Studio.

Loading latest posts