Skip to main content

The 2027 Agentic QA Workflow (Claude Code, Cursor & Agnox MCP)

Coding agents such as Claude Code, Cursor and Windsurf can now write, run and fix Playwright tests on their own. What they lack is context: which manual cases matter, how your repository is organised, what failed last night and why. Without it, they generate isolated spec files that ignore your fixtures and drift from the product.

The workflow below gives the agent that context from two directions:

  • Before coding, the Automation Planner ranks your manual cases and produces an Automation Brief: the selected cases with their steps and history, written as instructions for a coding agent.
  • While coding and after every run, @agnox/mcp-server lets the agent read failures, clusters and flaky tests from Agnox, and write back quarantine decisions and new test cases.
Manual cases ──► Automation Planner ──► Automation Brief
│
▼
┌──────────── Coding agent in your IDE ────────────┐
│ inspect repo → implement → run → sync_test_cases │
└───────────────────────┬──────────────────────────┘
│ @agnox/playwright-reporter
▼
Agnox: runs, steps, failure clusters, grades
│ @agnox/mcp-server
▼
triage → heal → quarantine/release (back in the IDE)

1. Set up once​

Reporter. Add @agnox/playwright-reporter to playwright.config.ts so every local and CI run, including each test.step(), reaches Agnox.

MCP server. Register the server with your agent. For Claude Code:

claude mcp add agnox \
-e AGNOX_API_KEY=<your key> \
-e AGNOX_PROJECT_ID=<project id> \
-- npx -y @agnox/mcp-server

For Cursor, Windsurf and Claude Desktop, use the mcpServers block shown in the MCP Server guide. The server exposes 14 tools:

ToolUsed for
list_recent_executionsFind the run to look at
get_execution_failuresError, spec file, failure signature, test key and page context (URL, test ids, DOM snapshot) of each failed test
get_failing_test_contextOne failing test with its stability context (main vs branch pass rate, branch-regression suspicion)
get_rca_analysisRoot cause analysis of one failed test, classified as product regression, broken test, flaky, environment or test data, with the evidence
get_stability_timelineDaily pass rate and the commits around each drop
get_area_quality_historyRisk history of a file, folder or feature before you change it
get_release_readinessWhether the project can ship: READY, REVIEW_REQUIRED or BLOCKED from the latest CI runs, with the checks behind it (Release Readiness Gate)
audit_pr_testsAudit the tests in the agent's own diff (.only, new skips, hard waits, forced clicks, weakened assertions) before it opens a pull request (PR Test Auditor)
list_failure_clustersGroup failures by signature to tell one systemic cause from many bugs
get_flaky_and_quarantined_testsSuspected regressions, tests graded D/F, and tests already quarantined, each labelled with a kind
toggle_test_quarantineQuarantine or release a test
list_automation_candidatesManual test cases worth automating next, ranked
get_automation_briefSteps, history and naming rule to automate the chosen cases
sync_test_casesRegister automated specs as Agnox test cases, and promote the manual cases they name

Agnox Quality skill. Install the workflow and guardrails this playbook describes, so the agent follows them without being reminded:

npx -y @agnox/mcp-server@latest skill install --target all # Claude Code, Cursor and Codex (AGENTS.md)

Project context. Put your conventions where the agent reads them: a CLAUDE.md, .cursor/rules or AGENTS.md that names the fixtures module, the Page Objects folder and the selector strategy. The agent prompt tells the agent to read these first.


2. Author: from manual case to merged spec​

Plan​

Open the Automation Planner. Manual cases are ranked by severity, manual runs, failures and how well they are written. Select the ones to automate, click View Automation Brief, then Copy Prompt for IDE Agent. No AI key is needed.

Or stay in the IDE and ask:

"Which manual tests should we automate next? Automate the top two."

The agent calls list_automation_candidates, then get_automation_brief.

Implement​

Run the agent at the root of the test repository. The prompt tells it to:

  1. Inspect first: read the test configuration, fixtures, Page Objects and existing tests, and reuse them.
  2. Implement each case as one test titled <test case key>: <title>, with a named step per manual step and an assertion per expected result.
  3. Verify locally until the tests pass three times in a row, without weakening assertions or adding fixed waits.
  4. Link back with sync_test_cases. Agnox turns each manual case into the automated one and keeps its history. Without MCP, the next CI run does the same.

With an AI key, Generate AI strategy also writes a longer document with spec scaffolds, from your product spec and repository.

Review​

Treat the agent's change like any pull request. Check that:

  • every step name matches the manual case, so step-level results in Agnox read like the manual run;
  • no selector, URL or credential was invented (the prompt asks the agent to leave a // TODO: instead);
  • the tests use your fixtures, not new ad-hoc setup.

3. Triage: let the agent read the failure first​

When a run goes red, ask the agent in the IDE rather than opening the dashboard:

"Look at the latest failed run in Agnox and tell me whether it's one problem or several."

The agent calls list_recent_executions with { "status": "FAILED", "limit": 1 }, then list_failure_clusters. One cluster covering most of the failures usually means a shared cause (an expired login, a service down, a changed API) rather than many separate bugs. Fix that once.

For a single failure, get_execution_failures returns the error, the spec file, and the page context captured at failure: the URL, the data-testid values on the page and a DOM snapshot. get_rca_analysis then classifies it, with the evidence: likely_product_regression (the test is probably right), likely_broken_test (UI or locator drift), likely_flaky, likely_environment or likely_test_data. When the pass rate fell, get_stability_timeline shows the drop and the commits that landed around it. That is usually enough for the agent to tell a product bug from a test bug without re-running anything.

Before the agent edits a page or a spec, have it call get_area_quality_history for that area. A high risk means a suspected regression lives there: read it first, and don't touch it as part of an unrelated change.

Everything the MCP server returns from a test run sits under untrusted_data. The tool descriptions tell the agent to treat it as data, never as instructions, so text on a page under test cannot steer the agent.


4. Heal: fix the test, prove the fix​

For a broken locator, the snapshot and test ids from get_execution_failures let the agent propose a new selector that exists on the page. Ask it to:

  1. update the Page Object, not the spec, so every test using that element is fixed at once;
  2. prefer getByRole / getByTestId over CSS or XPath;
  3. run the affected spec with --repeat-each=3 before calling it fixed.

If the failure is a product bug, the right outcome is a bug report, not a greener test. Auto-Bug drafts one from the same failure data. A test that is regressionSuspected, or classified likely_product_regression, is never "healed": the agent reports it with the evidence and leaves the test as it is.

Changing what a test expects (an amount, a text, a status) is a business decision. The Agnox Quality skill makes the agent ask a person first, even when the product change looks intended.


5. Quarantine: a decision, not a reflex​

When a test is flaky and the fix will take time, quarantining keeps CI honest without blocking everyone:

"Which tests in this project are flaky right now? Quarantine checkout › pays with card until the payment sandbox is stable."

The agent calls get_flaky_and_quarantined_tests, then toggle_test_quarantine with the test key. A test listed with "kind": "suspected_regression" is a likely product bug, not a flake: don't quarantine it. Quarantined failures stop failing reporter runs (the quality gate passes only when every failure belongs to a quarantined test and every result arrived). Release the test with the same tool once the fix lands. See Flakiness Governance for when to quarantine and when not to.

Write tools carry MCP destructiveHint annotations, so clients can ask before running them. Keep that confirmation on for toggle_test_quarantine.


Guardrails that make this safe​

RiskGuardrail
Agent invents selectors or credentialsThe prompt forbids it and asks for // TODO: markers; review catches the rest
Agent "fixes" a test by weakening itThe prompt and the Agnox Quality skill forbid test.skip(), test.fixme(), weaker assertions and fixed waits; require --repeat-each=3
Agent "fixes" a product regressionget_rca_analysis and get_flaky_and_quarantined_tests flag likely regressions; the skill makes the agent report them instead of changing the test
Quarantine used to hide real bugsAgnox never auto-quarantines a suspected regression; confirm write tools; review quarantined tests weekly
Prompt injection from pages under testMCP results are wrapped as untrusted_data; spec and repo context are passed to the planner as delimited data
API key leaksThe MCP server sends the key only in x-api-key, never logs it and never follows redirects