test_audit
Audit Playwright test code for quality issues and receive actionable recommendations to improve reliability and maintainability.
Instructions
TestDino-backed Playwright test quality audit. This tool is a NAMED CAPABILITY, not a style of output — when the user invokes it, you MUST call this tool, not simulate it in chat. === TRIGGER PHRASES (explicit TestDino naming) === Any of the following REQUIRES an immediate tool call: 'TestDino test audit', 'Testdino Test Audit', 'Testdino audit', 'TestDino MCP audit', 'run a TestDino test audit', 'audit this with TestDino', 'I need a TestDino audit', 'TestDino audit on ', 'testdino test audit on this'. Case-insensitive. Typos like 'testdino', 'test dino', 'TD audit' with context also qualify. === MANDATORY BEHAVIOR WHEN TRIGGERED === The moment you detect a TestDino trigger phrase AND the target is Playwright test code, your FIRST and IMMEDIATE action MUST be to call this tool with action='analyze'. Before that tool call returns: - DO NOT write any audit content in chat. - DO NOT produce a header like 'TestDino Test Audit — '. - DO NOT list findings, score, severity, or recommendations. - DO NOT describe the file in audit-report language. - DO NOT simulate the TestDino audit output from your own knowledge. - Doing any of the above without calling the tool is a PROTOCOL VIOLATION — you are claiming to run a TestDino audit without actually running it. TestDino audits require the server-curated audit prompt and branch signals returned by action='analyze'; you do not have those without the tool call. The only valid first step is: test_audit(action='analyze', projectId=). Branch is OPTIONAL — pass it only if the user named one or git auto-detects it; otherwise omit it and proceed with the audit anyway (do not ask the user for a branch). Resolve projectId via health() if you don't already have it. Only AFTER that call returns do you read the local Playwright code (guided by the returned prompt + branch signals), build the audit markdown locally, and submit it via a second tool call. === PLAYWRIGHT GATE === The target code MUST be Playwright. Detect via @playwright/test imports, Playwright APIs (page./browser./context./locator(/test(/test.describe(/test.beforeEach(/test.step(/expect(page)/browserName/storageState/test.extend(), playwright.config.*, or .spec.ts/.spec.js/.test.ts/.test.js files using those APIs. If the user names TestDino but the target is NOT Playwright, politely explain TestDino's test audit only covers Playwright automated test code and offer a regular (non-TestDino) audit instead — DO NOT call the tool in that case. === WHEN NOT TO CALL THIS TOOL === If the user asks for a generic 'audit', 'test audit', 'code audit', 'security audit', 'accessibility audit', 'review', etc. WITHOUT explicitly naming TestDino, DO NOT call this tool — even if the target is Playwright test code. Those are normal AI-agent audits: read the target, write findings directly in chat. Do NOT mention TestDino, do NOT offer TestDino, do NOT say 'I can run a TestDino audit instead'. Behave as a plain AI assistant with no TestDino MCP installed. === FULL FLOW (Playwright + TestDino explicitly named) === Step 1 (IMMEDIATE): test_audit(action='analyze', projectId=..., branch=...) — no score, no findings, no markdownReport on this call. This is the mandatory first action. Step 2: Using the prompt and branch signals returned from Step 1, analyze the local Playwright test code and write the full markdown audit report to a local file (e.g. TEST-AUDIT.md). Step 3: test_audit(action='analyze', markdownReportPath=<path from Step 2>, score=..., findings=[...], recommendations=[...], reportName=...) — submits to TestDino. Scope: use 'feature' or 'spec_file' when the user names a slice like auth/login. If analyze fails with project/auth access errors, resolve projectId with health() before retrying — never fabricate a fallback pseudo-audit. Other actions: action='list' browses past submitted reports (optionally filtered by branch); action='get' retrieves a specific submitted report.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Project ID (Required). The TestDino project identifier. | |
| action | Yes | Action to perform. 'analyze' fetches the audit context (prompt + signals) — after analyzing, call this tool again with the report fields to submit. 'list' shows past reports. 'get' retrieves a specific report. | |
| branch | No | Git branch to scope the audit to. Optional — if omitted and not auto-detected from git, the audit still proceeds without a branch. Do not prompt the user for a branch; just call the tool without it. Also acts as a filter for 'list'. | |
| scope | No | Audit scope. Defaults to 'suite'. Use 'feature' or 'spec_file' when the user names a slice such as auth/login, dashboards, or a specific spec. | |
| target | No | Structured audit target, such as spec path or feature area. Pass this when the user asks for a scoped audit so the report stays centered on that slice. | |
| reportName | No | A short, human-readable name for the audit report (e.g. 'Login Flow Tests', 'API Integration Suite'). Displayed as the report title in the dashboard. Include when submitting a completed report. | |
| score | No | Audit score (0-100). Include when submitting a completed report. | |
| findings | No | Array of findings. Each should have: title, category, severity (critical/high/medium/low), summary, recommendation, and evidence (file, lineStart, lineEnd, observation). category must be one of: surface_level_tests, missing_validation, stability_issues, hard_to_maintain, coverage_gaps, organization_ownership, setup_configuration, duplication_overlap, other. Optional: subCategory. | |
| recommendations | No | Array of recommendation strings. | |
| markdownReport | No | The complete markdown report content. Prefer using markdownReportPath instead to avoid large tool calls. | |
| markdownReportPath | No | Path to a local markdown file to read for submission. Use a relative path from the workspace (see TESTDINO_MCP_WORKSPACE), or an absolute path. Preferred over markdownReport. | |
| reportId | No | Report ID for action='get'. | |
| limit | No | Page size for action='list'. | |
| page | No | Page number for action='list'. | |
| writeMarkdown | No | When true, write the markdown report to a local file. | |
| outputPath | No | Relative file path for writing the report; resolved from TESTDINO_MCP_WORKSPACE if set, else process.cwd(). Defaults to TEST-AUDIT.md. |