> ## Documentation Index
> Fetch the complete documentation index at: https://docs.testdino.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Playwright Flaky Tests

> Detect, classify, and track flaky Playwright tests automatically.

A flaky test produces different results across runs without code changes. It passes on one execution and fails on the next, or passes only after a retry.

## Quick Reference

| View                                    | Path                         | Best for                               |
| :-------------------------------------- | :--------------------------- | :------------------------------------- |
| [Dashboard](#dashboard)                 | Dashboard → Most Flaky Tests | Top flaky tests in the selected period |
| [Analytics Summary](#analytics-summary) | Analytics → Summary          | Flakiness trends                       |
| [Test Run Summary](#test-run-summary)   | Test Runs → Summary          | Per-run flaky breakdown                |
| [Test Case History](#test-case-history) | Test Case → History          | Single test stability                  |
| [Test Explorer](#test-explorer)         | Test Explorer                | Flaky rate by file and test case       |

## How Detection Works

Flaky test detection activates automatically when [retries are enabled](https://playwright.dev/docs/test-retries) in Playwright. No additional configuration required.

```typescript playwright.config.ts theme={null}
export default defineConfig({
  retries: process.env.CI ? 2 : 0,
});
```

TestDino detects flaky tests in two ways:

**Within a single run.** A test that fails initially but passes on retry is marked flaky. The retry count appears in the test details.

<img src="https://tdstorageus.blob.core.windows.net/public/docs/debug-and-analyze/quality-checks/playwright-flaky-test-detection/retry-attempts.webp" alt="Test marked as flaky after passing on retry" />

**Across multiple runs.** Tests with inconsistent outcomes on the same code are flagged. TestDino tracks pass/fail patterns and calculates a stability percentage.

<img src="https://tdstorageus.blob.core.windows.net/public/docs/debug-and-analyze/quality-checks/playwright-flaky-test-detection/test-metrics.webp" alt="Stability percentage showing inconsistent test results across runs" />

<Note>
  **Note**

  Both detection methods indicate that the test result depends on something other than your code.
</Note>

## Flaky Test Categories

TestDino classifies flaky tests by root cause:

| Category               | Description                                                 |
| :--------------------- | :---------------------------------------------------------- |
| Timing Related         | Race conditions, order dependencies, and insufficient waits |
| Environment Dependent  | Fails only in specific environments or runners              |
| Network Dependent      | Intermittent API or service failures                        |
| Assertion Intermittent | Non-deterministic data causes occasional mismatches         |
| Other                  | Unstable for reasons outside the above                      |

### Common causes

* Fixed waits instead of waiting for the page to be ready
* Missing `await` causes steps to run out of order
* Weak selectors that match more than one element
* Tests share data and affect each other
* Parallel runs collide on the same user or record
* Slow or unstable network or third-party APIs
* CI setup differs from local environment

## Where to Find Flaky Tests

### Dashboard

Open the [Dashboard](/platform/playwright-test-dashboard). The **Most Flaky Tests** panel lists tests with the highest flaky rates in the selected period.

Each entry shows the test name, spec file, flaky rate percentage, and a link to the latest run. Click any test to open its most recent execution.

<img src="https://tdstorageus.blob.core.windows.net/public/docs/debug-and-analyze/quality-checks/playwright-flaky-test-detection/dashboard-most-flaky.webp" alt="Most Flaky Tests panel showing test names with flaky percentages" />

### Analytics Summary

Open **Analytics → Summary**. The **Flakiness & Test Issues** chart shows the flaky rate trend over time and a list of flaky tests with spec file and execution date.

A rising trend indicates increasing instability in your test suite.

<img src="https://tdstorageus.blob.core.windows.net/public/docs/debug-and-analyze/quality-checks/playwright-flaky-test-detection/flakiness.webp" alt="Flakiness trend chart with percentage over time and list of affected tests" />

### Test Run Summary

Open any test run. The **Summary** tab shows flaky test counts grouped by category: Timing Related, Environment Dependent, Network Dependent, Assertion Intermittent, and Other Flaky.

<img src="https://tdstorageus.blob.core.windows.net/public/docs/debug-and-analyze/quality-checks/playwright-flaky-test-detection/kpi-tiles.webp" alt="Test run summary showing flaky test counts by category" />

Click a category to filter the detailed analysis table.

### Test Case History

Open a specific test case and go to the **History** tab. The stability percentage shows how often the test passes:

Stability = (Passed Runs / Total Runs) x 100

A test with 100% stability has never failed or been flaky. Any value below 100% indicates inconsistent behavior. The **Last Flaky** tile links to the most recent run where the test was marked flaky.

<img src="https://tdstorageus.blob.core.windows.net/public/docs/debug-and-analyze/quality-checks/playwright-flaky-test-detection/last-flaky.webp" alt="Test case history showing stability percentage and last flaky run" />

### Test Explorer

Open **Test Explorer** from the sidebar. The **Flaky Rate** column shows the percentage of executions with flaky results for each spec file or test case.

Sort by flaky rate to find the most unstable tests across the project.

<video controls loop preload="metadata" aria-label="Test Explorer showing flaky rates for test cases" poster="https://tdstorageus.blob.core.windows.net/public/docs/debug-and-analyze/quality-checks/playwright-flaky-test-detection/specs.jpg" src="https://tdstorageus.blob.core.windows.net/public/docs/debug-and-analyze/quality-checks/playwright-flaky-test-detection/specs.mp4" />

### Flakiness trend

Add the [Flakiness trend](/platform/playwright-test-analytics#reliability) widget to an analytics dashboard to track flaky-run rate over time. Set the widget's environment filter to compare stability across staging, production, and other environments.

<Note>
  **Note**

  High flaky rates in specific environments suggest environment-dependent issues like resource constraints or service availability.
</Note>

## CI Check Behavior

GitHub CI Checks handle flaky tests in two modes:

| Mode    | Behavior                            | Use case                                    |
| :------ | :---------------------------------- | :------------------------------------------ |
| Strict  | Flaky tests count as failures       | Production branches where stability matters |
| Neutral | Flaky tests excluded from pass rate | Development branches to reduce noise        |

See [GitHub CI Checks](/guides/github-status-checks) for configuration details.

## Export Flaky Test Data

Use the TestDino MCP server to query flaky tests programmatically:

```bash theme={null}
List flaky tests from the last 7 days on the main environment
```

<iframe className="w-full rounded-lg" style={{ height:"400px" }} src="https://www.youtube.com/embed/Qg4e0kEHVK0?start=64" title="TestDino MCP - List Flaky Tests" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowFullScreen />

<Tip>
  **Tip**

  The MCP server returns test names, flaky rates, and run IDs for further analysis.
</Tip>

See [TestDino MCP](/mcp/overview) for more details.

## Related

<CardGroup cols={2}>
  <Card title="Test Explorer" icon="file-code" href="/platform/playwright-test-explorer">
    Analyze flaky rates across spec files and test cases
  </Card>

  <Card title="GitHub CI Checks" icon="check" href="/guides/github-status-checks">
    Configure flaky handling in CI
  </Card>

  <Card title="TestDino MCP" icon="plug" href="/mcp/overview">
    Query flaky data with AI
  </Card>

  <Card title="Analytics" icon="chart-line" href="/platform/playwright-test-analytics">
    Project-wide test analytics
  </Card>
</CardGroup>
