Self-Healing
When you pass --heal, Kovar runs the generated test immediately after recording. If the test fails, it sends the failure output back to the AI, which rewrites the test code to fix the issue. This loop repeats up to --heal-attempts times (default: 3).
kovar record https://your-app.com --healAllow up to 5 healing attempts:
kovar record https://your-app.com --heal --heal-attempts 5What It Fixes
Section titled “What It Fixes”Typical fixes the self-healing loop catches:
- Incorrect or flaky locators (element not found, wrong role name)
- Missing
awaitor missing waits for navigation/network idle - Assertion mismatches (wrong expected text or URL pattern)
How It Works
Section titled “How It Works”- After recording, Kovar generates test files as usual.
- It runs the generated test with
npx playwright test. - If the test fails, the failure output (error message, stack trace) is sent back to the AI.
- The AI rewrites the failing code to fix the issue.
- Steps 2-4 repeat until the test passes or the max attempts are reached.
Each healing attempt makes an additional LLM call, so costs scale with the number of retries. A typical session with 1-2 healing attempts costs ~$0.10-0.30 total (including the initial generation).
When Healing Fails
Section titled “When Healing Fails”If the test still fails after all attempts, Kovar prints the last error and exits. You can:
- Review the error output and fix manually.
- Run
--healagain with a higher--heal-attemptsvalue. - Check Codebase Awareness to improve locator confidence.
Related
Section titled “Related”- CLI Reference — all command-line options including
--heal. - What Gets Generated — output file format.
- Codebase Awareness — improve locator reliability.