QA AND TEST AUTOMATION · PART 11 · AI TOOLS FOR TESTERS · TOOLS · 99 OF 112

Coding Agents for QA: Working on a Test Repo

A coding agent reads your test repo, runs commands and edits files. How to set one up for QA work: a rules file, Playwright's agent skills, playwright-cli and the trace command line (all run for real on Playwright 1.63 against ShopRung), the permissions to grant, and a review checklist. Plus a finding: a trace file held the test password and a login token in plain text.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
  53. 53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
  62. 67
  63. 68
  64. 69
  65. 70
  66. 71
  67. 72
  68. 73
  69. 74
  70. 75
  71. 76
  72. 77
  73. 78
  74. 79
  75. 80
  76. 81
  77. 82
  78. 83
  79. 84
  80. 85
  81. 86
  82. 87
  83. 88
  84. 89
  85. 90
  86. 91
  87. 92
  88. 93
  89. 94
  90. 95
  91. 96
  92. 97
  93. 98
  94. 99
  95. 100
  96. 101
  97. 102
  98. 103
  99. 104
  100. 105
  101. 106
  102. 107
  103. 108
  104. 109
  105. 110
  106. 111
  107. 112
1 / 11

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • AGENTS.md rules
  • init-skills
  • playwright-cli
  • trace CLI
  • traces hold secrets
  • permissions
  • review checklist

Notes

Give it a map

Start with a rules file at the root of the repo, named AGENTS dot md or the name your tool reads. It tells the agent how to start the app, reset data and run the tests, which locators the team prefers, and the rules that protect test quality: never change an expected value without the requirement behind it, never add retries, sleeps or skips to make a test pass, and use test accounts only. The agent reads it before every task.

AGENTS.md (or CLAUDE.md)
  • start: cd shoprung && npm start
  • reset: POST /api/test/reset
  • run: npx playwright test, pytest -q
  • locators: roles and labels
  • never change an expected value without the requirement id
  • never add retries, sleeps or .skip to make a test pass
  • test accounts only

Tools for agents

Playwright now ships tools for agents. Init skills installs three skills, playwright CLI, component testing and trace, each a short instruction file that tells an agent when to use the tool and the exact commands. They are plain files in your repo: read them and keep them in version control. The trace skill even declares which commands it needs, npx only, which helps you set permissions.

npx playwright init-skills
installs 3 skills into
  .claude/skills/:
  playwright-cli
  playwright-component-testing
  playwright-trace
each SKILL.md: when to use it
  and the exact commands
trace skill: allowed-tools:
  Bash(npx:*)

playwright-cli

Playwright CLI gives the agent a browser through ordinary shell commands: go to a page, take a snapshot, fill and click by ref, list console messages and network requests. Each action prints the Playwright code it ran. A difference from the MCP server: page snapshots after navigation are saved to files instead of being printed, four of them came to about ten kilobytes, so the agent reads them only when it needs to. That saves tokens.

Run against ShopRung
$ playwright-cli goto .../#/login
  Snapshot saved to
  .playwright-cli/page-....yml
$ playwright-cli snapshot
  textbox "Email" [ref=f1e18]
$ playwright-cli fill f1e18 alice@...
  await page.getByRole('textbox',
  { name: 'Email' }).fill(...)
$ playwright-cli requests
  [GET] /api/products/4 => 200

Debug from traces

The trace command line lets an agent debug a failed test without opening the trace viewer. We traced the ShopRung coupon test with the coupon boundary bug on. Open showed thirty two actions, sixteen requests and one error. Actions pointed at step twenty three, which waited five seconds. Errors gave the message, and requests showed the coupon call returned four hundred. That is enough for an agent, or you, to see it is a product bug.

npx playwright trace ...
open trace.zip: 32 actions,
  16 requests, 1 error
actions:
  23 Expect "toHaveText" 5.0s ✗
errors: "This coupon needs a
  subtotal of at least $50.00"
requests:
  16 POST coupon  400  2ms
request 16: headers and body

A real finding

Look closer at the same trace. The action list shows the password typed into the login form, in plain text, and the request details include the login token in the authorization header. Traces are often uploaded as CI artifacts, shared in bug reports and now read by agents. So: test accounts only, short-lived tokens, private artifacts, and never a trace from a real customer account.

Inside our trace.zip
actions:
  13 Fill "Alice123!"
     getByRole('textbox',
     { name: 'Password' })
request 16 headers:
  Authorization: Bearer
  eyJhbGciOiJIUzI1NiIs...
traces are uploaded as CI
  artifacts and read by agents

Permissions

Give the agent only what the task needs. Allow reading files, running the test commands and editing the tests folder. Make it ask before installing packages, editing CI configuration or deleting files. Deny pushing to the main branch, production systems and real credentials. Most agents support allow and deny lists, and running the agent in a sandbox or container limits the damage of a wrong command.

Agent permissions
  • allow: read files, run the test commands, edit tests/ ask: install packages, edit CI files, delete files
  • deny: git push to main, production URLs and data, real credentials
  • run it in a sandbox or a container when you can

Review

Then review the result like any pull request, with a tester's checklist. Did expected values change, and which requirement says so? Any new skips, fix mes, retries, longer timeouts or sleeps? Were assertions deleted or weakened? Ask for the test output, and make every new test fail once on purpose, for example with ShopRung's bug switch, to prove it can fail. And check for secrets in code and artifacts.

Agent pull request checklist
  • changed expected values? → requirement id, or reject
  • new .skip, fixme, retries, longer timeouts, sleeps?
  • deleted or weakened asserts?
  • tests run: show the output
  • new test seen failing once (break it on purpose)
  • secrets in code or traces?

Common mistakes

Mistakes. No rules file, so the agent guesses your commands and conventions. A task that says only make the tests pass, which invites the agent to weaken them. Full permissions and no sandbox. Real accounts that end up in traces and logs. Accepting a diff without running it yourself. And new tests that nobody ever saw fail, which may test nothing at all.

Avoid these
  • no rules file
  • "make the tests pass" as the whole task
  • full permissions, no sandbox
  • real accounts in traces
  • accepting a diff without running it
  • new tests never seen failing

Say it like this

In the interview: I give the agent a rules file with our commands and our test quality rules, install Playwright's agent skills, and run it with tight permissions in a sandbox. It debugs failures from traces with the command line. I review every diff for changed expectations, new skips and retries, make each new test fail once on purpose, and keep real secrets out of traces and logs.

In the interview
  • "With a rules file for commands
  • and test-quality rules, the Playwright skills, and tight
  • permissions in a sandbox. Agents
  • debug from traces with the CLI.
  • I review every diff for changed
  • expectations, skips and retries, see each new test fail once, and keep secrets out of traces."

Interview questions

Q1What is a coding agent?

An AI assistant that works in your repository in a loop: it reads files, runs commands such as tests, edits code and repeats until it judges the task done.

Q2What goes in an AGENTS.md for a test repo?

How to start the app, reset data and run tests, locator conventions, and test-quality rules such as never changing expected values without a requirement or adding skips, retries or sleeps.

Q3What does npx playwright init-skills install?

Agent skills (on 1.63: playwright-cli, playwright-component-testing and playwright-trace): instruction files telling an agent when and how to use each tool.

Q4What is playwright-cli?

A command-line way to drive a browser: goto, snapshot, fill, click, console, requests; each action prints the Playwright code, and snapshots are saved to files.

Q5How can an agent debug a failed test without a GUI?

With npx playwright trace: open, actions, errors, requests and request <n> show what happened, as with ShopRung's 400 on the coupon call.

Q6Why are traces sensitive?

They record typed values and request headers: ShopRung's trace showed the test password and a bearer token in plain text.

Q7Which permissions should a coding agent get?

Read, run test commands and edit tests; ask before installs, CI edits or deletions; never push to main, touch production or use real credentials.

Q8What do you check in an agent's pull request?

Changed expected values, new skips, retries, timeouts or sleeps, weakened assertions, test output, each new test seen failing once, and secrets.