Audit tests for flake risks
audit-testsDetect flake risks in Playwright test code, rank files by historical flakiness, and optionally auto-fix mechanical issues with re-run and revert on failure.
Instructions
Audit the Playwright test code for flake risks (hard waits, one-shot assertions instead of web-first ones, missing awaits, .only, force clicks, networkidle, element handles, layout selectors, acting right after goto on a server-rendered app before it hydrates) and rank files by how flaky their tests have been in the run history. fix: true rewrites the mechanical ones, re-runs the touched files and restores them if the run fails. TS/JS specs and pytest-playwright modules.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "audit-tests"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fix | No | Rewrite the mechanical findings (web-first assertions, missing awaits, .only), re-run the touched files and restore them if the run fails | |
| limit | No | Max findings to list (default 50); the summary counts all | |
| config | No | playwright.config path or 1-based index, for the verify run | |
| filter | No | Case-insensitive substring filter on the file path | |
| verify | No | With fix: re-run the touched files (default true) | |
| testDir | No | Audit only this directory (inside the project); defaults to the config testDir | |
| timeoutMs | No | Wall-clock limit for the verify run | |
| historyRuns | No | How many recent runs of the local history to weigh in (default 50) | |
| minSeverity | No | Report findings at or above this severity (default low) | |
| projectRoot | No | Project directory; defaults to the server working directory |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | false when the call failed (see error) or the tests it ran failed | |
| error | No | ||
| total | No | ||
| applied | No | ||
| findings | No | ||
| verified | No | ||
| truncated | No |