Autohealing Failing Tests
AutoReg’s autoheal loop finds the root cause of a failing test and regenerates it against the live app — no manual selector hunting required.
The autoheal workflow
Run test(s)
↓ failure detected
test_run_analyzer
Parses execution.log and failure artifacts
Identifies: selector not found / assertion failed / navigation error / timeout
Outputs root cause + suggested fix per scenario
↓
test_regenerator
For selector failures: re-navigates the live page, captures DOM snapshot
Generates corrected E2ESpecFile with updated selectors
↓
apply_scenario_fix
Writes corrected scenario-NNN.json to disk
Updates .ar manifest
↓
Re-run test to verify fixTriggering autoheal
From the chat panel
After a failed run, type:
"Fix the failing tests"
"Analyze and heal scenario-004"
"Why is scenario-007 failing?"The agent runs the full loop: analyze → regenerate → apply.
Targeted healing
"Heal scenario-003 — the login button selector changed"
"The email field on /signup now has aria-label 'Work email', update scenario-002"For targeted cases, the agent skips re-navigation and applies the fix directly.
What test_run_analyzer reports
For each failing scenario:
| Field | Description |
|---|---|
scenarioId | Which scenario failed |
failureType | selector / assertion / navigation / timeout |
failedStep | The exact step that failed |
suggestedFix | What to change |
confidence | high / medium / low |
High-confidence fixes (e.g. element moved but still exists with different ARIA label) are applied automatically. Low-confidence cases are shown in chat for your review before applying.
What test_regenerator does
For selector failures:
- Opens a headed or headless browser
- Navigates to the page where the failure occurred
- Captures a fresh DOM snapshot
- Asks the LLM to regenerate the failing steps using the new snapshot
- Returns an updated
E2ESpecFile
For assertion failures:
- Inspects current page state vs. expected state
- Updates
valueorassertionTypeto match the app’s current behavior
For navigation / timeout failures:
- Checks if the URL changed (redirects, route renames)
- Updates
navigatesteps accordingly
Reviewing a fix before applying
If the agent proposes a fix and asks for confirmation:
Agent: "I found that [aria-label='Email address'] is now [aria-label='Work email'].
Updated scenario-002 step 2. Apply this fix?"
You: "yes" ← applies the fix
You: "no, the label is 'Company email'" ← agent uses your correctionBulk healing after a deployment
After a large UI change, run the full suite and then:
"Heal all failing tests"The agent batches test_run_analyzer across all failures, then calls test_regenerator + apply_scenario_fix for each one. Progress is shown in the chat thread.
When autoheal cannot fix a test
Some failures require human judgment:
| Situation | What to do |
|---|---|
| Feature was removed from the app | Delete the scenario: "Delete scenario-011" |
| Business logic changed | Update autoreg.md and regenerate: "Regenerate scenario-005" |
| Multi-step flow redesigned | Describe the new flow in chat; the agent regenerates from scratch |
| Flaky test (timing issue) | Add a wait step or increase timeout: "Add a 2s wait before step 4 in scenario-008" |
Regenerating a scenario from scratch
"Regenerate scenario-006 from scratch using the current app"This triggers generate_single_scenario, which re-navigates the live page and generates a fresh test — discarding the old steps entirely.
Tips
- Run autoheal after every deploy — paste the run output in chat or just type “heal failing tests” after each run.
- Keep
autoreg.mdup to date — if features change, update your spec so regenerated tests reflect the new behavior. - Check
confidence: lowsuggestions — the agent flags uncertain fixes; review these before applying. - Videos help diagnosis — enable video recording in settings so you can see exactly what happened before the failure.