How to use Claude to write Playwright tests
Claude Code explored web app features with Playwright MCP, documented workflows, and wrote and debugged browser tests, with human corrections for more complex scenarios.
Suggested prompt
Suggested prompt written by Agents In Use, not the source author. Replace bracketed inputs and review tool permissions first.
At [development URL], use Playwright MCP to explore [user journey]. Document execution steps, write Playwright tests, add data-testid selectors where needed, then run and debug the tests. Record the process in task.md and separate feature task files.
Reach people exploring AI agents
See placements →Evidence at a glance
Sourced account- Source poster / publisher
- sickcodebruh
- Original account
- Read the source ↗
- Published
- Source link checked
- Reported result
- The author calls the work highly effective and estimates days saved, while noting imperfect accuracy and corrections for more complex features.
- Human involvement
- The author defined the process and user journeys, then supplied additional context and code corrections for complex features.
A linked account supports attribution. It does not mean we independently reproduced its result.
Report an issue with this case
Open correction emailOpens your email app with the case link included. Nothing is sent automatically.
How the agent did it
- Explain user journeys and provide a development-server path.
- Explore each feature through Playwright MCP and document execution steps.
- Write Playwright tests and add data-testid selectors where needed.
After unsuccessful attempts to have Claude Code implement challenging features in a large work application, the author tried a more bounded backlog task: writing Playwright tests. They created a new workspace within the monorepo, explained user experiences as they would to another person, and supplied a path on their development server.
The requested process began with Playwright MCP loading the page and discovering how the feature worked. Claude was then to document execution steps, write tests from that discovery, run them and debug errors through Playwright MCP. The author also instructed it to locate relevant UI code and add data-testid selectors where needed.
Claude recorded the process in a master task.md and created additional task files for individual features. Some scenarios required two users interacting through two browsers. The author describes the effort as highly effective, while acknowledging imperfect accuracy and additional context and code corrections for complex features. They estimate it saved days of frustrating work.
Who it's for: Developers expanding browser test coverage who can explain user journeys and correct complex scenarios.
Prompt
Suggested prompt (written by Agents In Use, not the author's)
Source: Hacker News · sickcodebruh
Frequently asked questions
How did Claude learn the application's behavior?
The author explained user experiences and supplied a development-server path, then instructed Claude to explore the feature with Playwright MCP and document execution steps.
Did complex scenarios need human corrections?
Yes. The author says accuracy was imperfect and more complex features required additional context and code corrections, including scenarios involving two users and browsers.
More details
Remaining steps
- Run the tests and debug errors using Playwright MCP.
- Supply context and code corrections for complex scenarios.
About this account
Claude was instructed to discover UI behavior, document workflows, write tests, run them and debug failures through Playwright MCP.
Platform: Hacker News. Attribution: https://news.ycombinator.com/item?id=44846096. Prompt: Suggested (written by Agents In Use, not the author's). Sourced by the Agents In Use pipeline.
Credit: sickcodebruh on Hacker News
Source published
Added to Agents In Use
Source checked
Tools and topics
Claude Code · Playwright · Playwright MCP · Markdown task files
Playwright · Browser testing · Test automation
Editorial completeness: 100/100. Measures documented fields, not agent performance or verified outcomes.