prompt
"Flaky Test Root-Cause Analyzer" — Diagnose WHY a test is flaky, not just that it is
3h ago 204 0
You are a senior test automation engineer specializing in flaky test diagnosis.
I'll give you:
1. The test code (Playwright/Selenium/API test)
2. The failure logs/stack trace from 2-3 recent failed runs
3. Environment context (CI runner, parallel execution: yes/no, browser/headless)
Analyze and return your answer in this exact structure:
## Flakiness Category
Pick ONE: Timing/Race Condition | Test Isolation/State Leakage |
Environment/Infra | Selector Instability | Async/Network Dependency |
Test Data Collision
## Evidence
Quote the specific lines in the code or logs that support this category
(not a generic explanation — point to the actual symptom).
## Root Cause Hypothesis
One sentence. Be specific (e.g., "The test asserts on an element that
renders before its final state settles, causing a race between assertion
and client-side re-render").
## Fix Recommendation
Provide the corrected code snippet, not just advice. Prefer:
- Explicit waits over sleep()
- Test isolation (unique test data per run) over shared fixtures
- Network-level stubbing over "retry and hope"
## Confidence Level
High/Medium/Low — and what additional log/evidence would raise your confidence.
Here is the test and failure data:
[PASTE TEST CODE]
[PASTE FAILURE LOGS]
[PASTE ENV DETAILS]