Skip to content
agentusehub
Sign in+ Submit
Write Playwright tests with Playwright MCP and Claude Code

Write Playwright tests with Playwright MCP and Claude Code

A walkthrough of using Playwright MCP with Claude Code to generate Playwright tests in minutes.

Read the experience
Time saved
Not reported
Setup time
Not reported
Running cost
Not reported
Cost range
Not reported

Use case overview

“Write Playwright tests with Playwright MCP and Claude Code” is a Software & DevOps AI agent workflow from Any. It connects Claude Code in 3 steps.

A walkthrough of using Playwright MCP with Claude Code to generate Playwright tests in minutes.

Reported experience

  1. What they did

    The Playwright MCP server is registered with Claude Code, loaded with a saved logged-in session through storage state. A three-part prompt carries the environment facts, a plain-English scenario, and standing rules. The agent explores the live app through the accessibility tree, writes the test, runs it, and fixes failures itself. A person reviews the code and the scenario's meaning.

  2. How it went

    The agent produced a runnable test with locators read from the live page. It also fixed a strict-mode locator error on its own. It struggles with long flows, changing data, deep conditionals, and OAuth. The source gives no timing numbers.

  3. Worth knowing

    Add .auth/ to .gitignore before committing, because this setup saves the session outside Playwright's default ignored path, and run the test with --repeat-each 5 to check for flakiness.

Example prompts

Try with Claude Code
Set up Playwright MCP in this project, then open [app URL] and explore the flow for [user journey, e.g. sign up and checkout]. Write Playwright tests that cover it using stable locators, and run them until they pass. Finish by showing me the test files and the passing run output.

Frequently asked questions

What does the “Write Playwright tests with Playwright MCP and Claude Code” workflow do?

A walkthrough of using Playwright MCP with Claude Code to generate Playwright tests in minutes.

Which tools do I need?

You need Claude Code.

How long does it take to set up?

The guide walks through 3 steps, starting with “What they did”.

Add this badge to your site

Built this workflow? Show it is featured on AgentUseHub with a live upvote count that links back here. About badges

Featured on AgentUseHub