How to Add Tests to a Vibe-Coded App That Has None: The Five Flows That Matter First
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.
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:
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:
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
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.
