Use cases · Claude Code

QA testing with Claude Code and Playwright

Claude Code can test your app in two ways: by writing and running Playwright tests in your repository, and by driving a real browser through the Playwright MCP server to check a change the way a person would. This page covers the setup for both, QA rules that keep it honest about failures and how to run the suite without you.

What Claude Code does for QA testing

  • Writes end-to-end tests for the flows that matter: sign-up, checkout, the main screens.
  • Runs the suite, reads the failures and fixes the test or the code, saying which.
  • Drives a real browser to check a change by hand, and files bugs with steps and screenshots.
  • Finds flaky tests and quarantines them with an issue, instead of retrying until they pass.

Claude Code features for QA testing

FeatureWhat it doesHow to start
Playwright MCP serverDrives a real browser: clicks, types, reads the page and takes screenshotsclaude mcp add playwright npx @playwright/mcp@latest
Playwright testsWrites and fixes tests in your repository and runs them like any commandnpx playwright test
claude -pRuns the suite and fixes failures without the interactive interface--allowedTools "Bash,Read,Edit"
SubagentsTest separate flows in parallel and report backDefine a tester in .claude/agents/

How to set up Claude Code for QA testing

  1. Connect the tools

    Add the Playwright MCP server so Claude Code can open your app in a browser. For a test suite in the repository, install Playwright as you normally would; Claude runs it like any other command.

    # A real browser for exploratory checks
    claude mcp add playwright npx @playwright/mcp@latest
    
    # A test suite, if you don't have one yet
    npm init playwright@latest
  2. Write the rules in CLAUDE.md

    Claude Code reads CLAUDE.md at the start of every session, claude -p runs included. Put the job's rules there, or in a skill under .claude/skills/ if they're long. See the CLAUDE.md guide.

    ## QA rules
    - Test against the local or staging app, never production.
    - Use the test accounts in .env.example, never real ones.
    - A failing test is a finding: say whether the test or the code
      is wrong before you change either.
    - Every bug report: steps, expected, actual, a screenshot and
      the commit you tested.
    - Don't delete or skip a test to make the suite pass.
  3. Run it without the interactive interface

    claude -p runs one task and exits, so cron, CI or another tool can start it. Choose what it may do without asking with --allowedTools or --permission-mode; --output-format json returns the result with its cost.

    # Run the suite and fix failures, from CI or cron
    claude -p "Run npx playwright test and fix the failures, following CLAUDE.md" \
      --allowedTools "Bash,Read,Edit"
  4. Put it on a schedule

    Make it a cloud scheduled task with /schedule (Pro, Max, Ultra, Team and Enterprise), a desktop scheduled task, or /loop while a session stays open. See how to make Claude Code proactive.

Source: Claude Code documentation

Limits and safety

  • It tests what it can reach: a local or staging app with test data, not production.
  • A passing suite covers only the flows someone wrote tests for. Ask it to list what isn't covered.
  • Browser runs are slow and use more of your plan. Run the full suite on a schedule and a smoke test on each change.
  • Since Claude Code v2.1.302, claude -p starts in Manual mode: an action that needs approval is denied unless a rule allows it. Allow only the tools the job needs.

Claude Code or Codex for QA testing?

The rules carry over. Write them once in AGENTS.md and put @AGENTS.md in CLAUDE.md, and both agents read the same file.

Step by step for the other agent: QA testing with Codex.

Claude CodeCodex
Rules fileCLAUDE.mdAGENTS.md
Connect toolsclaude mcp addcodex mcp add or config.toml
Run without youclaude -pcodex exec
Schedule/schedule, desktop scheduled tasks, /loopScheduled tasks in the ChatGPT app, cron
Built in for QA testingPlaywright MCP, subagentsPlaywright MCP, stdin to codex exec
With Crewmark

Make QA testing someone's job

Commands run when someone remembers to run them. Crewmark turns your own Claude Code into an AI employee with a role, a goal in numbers, working hours and a heartbeat, so the work happens on schedule and shows up on a board.

  1. Start from the role

    The AI software engineer, with these rules in its brief.

  2. Put the work on its board

    Add the job as a recurring issue. The employee wakes on its heartbeat, does it and reports in a comment.

  3. Related

    GitHub issues covers what happens to the bugs it files.

FAQ

Can Claude Code use Playwright?

Yes. Add the Playwright MCP server with claude mcp add playwright npx @playwright/mcp@latest to let it drive a browser; it can also write and run Playwright tests in your repository.

Should Claude Code fix failing tests?

Only after it says why they fail. Put the rule in CLAUDE.md: a failure is a finding, and it says whether the test or the code is wrong before changing either.

Can Claude Code run QA on a schedule?

Yes. Run the suite with claude -p from CI or cron, use a scheduled task, or give it to a Crewmark employee as a recurring issue.

Checked against Claude Code's and OpenAI's Codex documentation on November 13, 2026.

Hand QA testing to an AI employee on Claude Code.

Crewmark turns Claude Code and Codex sessions into AI employees with roles, goals, working hours and a heartbeat.