DEV Community

Neethu George
Neethu George

Posted on

Stop Jumping Into Code — Why Planning Saves Your Playwright MCP Setup

I learned this the hard way.
When I first started using Playwright MCP, I was impressed. You describe what you want, it generates the test, done. Felt like a superpower. I was shipping tests 10x faster than before.
Two weeks later, I wanted to kill everything I'd built.
The Trap Nobody Warns You About
MCP makes test generation so fast and easy that you skip the one thing that actually matters — planning your structure before you write a single line.
I didn't plan. I just prompted. And it worked... until it didn't.
Here's what my project looked like after two weeks of "moving fast":
Selectors hardcoded in 15 different files
The same login flow copy-pasted in 8 test files
No page objects, no shared utilities, nothing reusable
Folder structure that made zero sense
One small UI change in the app → 40 tests broke overnight
It wasn't Playwright's fault. It wasn't MCP's fault. It was mine.
I treated MCP like a quick fix machine instead of a tool that fits inside a proper architecture.
What Actually Goes Wrong (Be Honest With Yourself)
When you skip planning with Playwright MCP, here's exactly what happens:

  1. No reusability You ask MCP to generate a checkout test. It works. Then you need login in another test — you ask MCP again. Now you have two versions of the same login logic floating around. Change the login page? Fix it in two places. Miss one? Flaky tests forever.
  2. Messy selectors everywhere MCP generates selectors based on what it sees. Without a plan, those selectors are scattered randomly across files. No consistency, no pattern, no single source of truth.
  3. Quick fix mentality Every time something breaks, you ask MCP to patch it. It patches it. Now you have patches on top of patches. The codebase becomes something nobody wants to touch — including you.
  4. Zero maintainability Six months later, a new team member joins. They open your test folder. They close it and cry quietly. The Fix: Plan First, Prompt Second This is the mindset shift that changed everything for me. Before touching MCP, spend 30 minutes answering these questions: Map your pages List every page in your app. Login, Dashboard, Checkout, Profile — whatever exists. Each page gets its own Page Object. That's your foundation. Define what's reusable What actions happen on multiple pages? Login, navigation, form fills, API calls. These become shared utilities before MCP writes a single test. Plan your folder structure first tests/ e2e/ smoke/ pages/ LoginPage.ts DashboardPage.ts utils/ auth.ts api.ts fixtures/ Set this up. Empty folders. Before any code. THEN use MCP Now when you prompt MCP, you tell it exactly where things go. "Generate a test for checkout using the CheckoutPage object in pages/CheckoutPage.ts." MCP fills your structure instead of creating its own chaos. The Result Same speed. Zero mess. Your tests are reusable because the structure forced it. One UI change? You fix it in one Page Object. Done. Everything else still works. New team member joins? They open the folder, understand it in 5 minutes, contribute on day one. That's what maintainable looks like. The One Rule I Follow Now Never open MCP until the folder structure and page objects are planned. Treat MCP as a code generator that fits inside your architecture — not a replacement for thinking about architecture. Playwright MCP is genuinely powerful. But power without structure is just expensive chaos. Plan first. Always. Have you run into this with Playwright MCP? Would love to know how others are structuring their setups — drop it in the comments.

Top comments (0)