How do I run existing Playwright tests through playwright-mcp so an AI agent can fix failures?
The GitHub thread asks how to run existing Playwright tests through playwright-mcp so an AI agent can identify failures and fix them. No specific version, client, or OS is mentioned, and no error message was reported. A maintainer closed the issue as completed and pointed to the official Test Agents documentation.
Originally asked on GitHub: https://github.com/microsoft/playwright-mcp/issues/520
3 answers
The issue is closed as completed. A maintainer said the feature was being worked on and later pointed to the official Playwright Test Agents documentation at https://playwright.dev/docs/test-agents (opens external site), which is the current supported approach.
Two community approaches appeared in the thread before that:
- VS Code MCP tools: One commenter described using the
runTestsMCP tool, which runs all tests in the current file, adding.onlyto a specific test to target it, then usingtestFailureto get information about the last failure. They also noted that running tests through the Playwright CLI in a terminal gives more flexibility. This was a description of available tools, not a confirmed end-to-end workflow. - Reuse the playwright-mcp browser: Another commenter said they got existing tests working with AI agents by writing a dedicated Playwright config that uses
channel, so the test runs against the browser started by playwright-mcp instead of Playwright downloading and launching its own browser. The exact channel value was not shared in the thread, so check the Playwright channel option in the official docs.
General advice: the maintainer's final answer points to the Test Agents docs, so start there for running and fixing tests with an agent. The thread does not mention any error messages, versions, or operating systems.
Did this work for you?- VS Code MCP tools: One commenter described using the
What @mykhailo-e tried on GitHub (Outcome unclear)
A commenter described using VS Code MCP tools:
runTeststo run all tests in the file,.onlyto target a single test, andtestFailureto get details about the last failure. They also suggested running tests via the Playwright CLI for more flexibility, but did not confirm this workflow succeeded.Source: https://github.com/microsoft/playwright-mcp/issues/520#issuecomment-3160798782 (opens external site)
Did this work for you?What @nathanstoll tried on GitHub (Worked)
A commenter reported making existing tests work with AI agents by writing a dedicated Playwright config that uses
channel, so requests go to the browser launched by playwright-mcp rather than Playwright setting up its own browser. The exact channel value was not included.Source: https://github.com/microsoft/playwright-mcp/issues/520#issuecomment-3416478651 (opens external site)
Did this work for you?
Related questions
- Playwright MCP browser_take_screenshot shows no saved file or unreadable image in Cursor or VS Code
- Windows: playwright-mcp via Claude Desktop fails: Chromium distribution 'chrome' is not found
- playwright-mcp fails to start in Cursor after 0.0.19/0.0.20 (Client closed / Connection closed)
- Can I generate codegen-style Playwright test code from a prompt-driven playwright-mcp flow?
- Does Playwright MCP have a quiet mode to reduce page snapshot tokens?