Practical MCP: English to e2e Tests in Minutes with Playwright
Nathan Clement · September 8, 2026 · 2 min read
If you have ever hand-written playwright tests, you know it can be a cumbersome process, but well worth the effort for the security of validating certain critical flows across your application.
I had some spare time today and decided to see what all the fuss was about with MCP, it seemed like e2e tests were a good place to start, since it made sense that this area of development could be significantly improved using AI and related tooling.
The results were FAR more impressive than I imagined.
I’ve documented two things:
- A simple example of how easy it is to use
- A TLDR on how to set it up yourself
How easy is it to use?
Let me show you…
Today, I wrote the following prompt in Cursor:
Within a few minutes, the Cursor Agent had:
- Ran through my workflow
2. Fixed issues preventing the test from running outside MCP
3. Written a working playwright text spec
4. Ran the test
5. Generated summary of Coverage Gaps
Maybe I have low expectations, but this is pretty darn impressive, especially given how simple it was to set up.
How to set it up yourself
Luckily, this is not rocket science.
Go to playwright-mcp on Github: https://github.com/microsoft/playwright-mcp and click the button to add it to Cursor
Put a file somewhere in your codebase that looks like this:
It literally doesn’t matter where.
---
tools: ["playwright"]
mode: "agent"
---
- You are a Playwright test generator.
- For any scenario I describe:
1. Use MCP tools step-by-step (navigate, click, type…) to exercise the flow.
2. Only after the flow succeeds, emit a Playwright TypeScript test (`@playwright/test`)
with role-based locators and no arbitrary sleeps.
3. Save under `tests/` and run `npx playwright test <file>`; iterate until it passes.
4. Summarise coverage gaps at the end.
This prompt was a result of a chatGPT session, but it actually cited this article, so I will put it here for reference! https://dev.to/debs\_obrien/letting-playwright-mcp-explore-your-site-and-write-your-tests-mf1
When you write your test prompt (in plain English!) just make sure to reference your file above with @ in the Cursor context
That’s it!
If you have any questions, feel free to comment below?
Am I late to the game? Has everyone already been doing this for ages?
Originally published on 2025-07-13 on Medium.