﻿---
title: Debug Scout test runs
description: This page lists the fastest ways to debug Scout tests locally and in CI. If your tests use the log fixture, messages are printed in local console output.For...
url: https://www.elastic.co/elastic/docs-builder/docs/2915/extend/kibana/scout/debugging
products:
  - Kibana
---

# Debug Scout test runs
This page lists the fastest ways to debug Scout tests locally and in CI.

## Local runs

- If your tests use the `log` fixture, messages are printed in local console output.
- For more verbose output, set `SCOUT_LOG_LEVEL=debug`.


### Open the HTML report

After a run, Playwright generates an HTML report. The console output includes the report path. To open the latest report:
```bash
npx playwright show-report <plugin-path>/test/scout/ui/output/reports
```

<note>
  **CI runs**: in Buildkite, the Playwright HTML report is typically available under the job’s **Artifacts**.
</note>


### Playwright UI mode

[UI Mode](https://playwright.dev/docs/test-ui-mode) lets you run and debug tests interactively.
```bash
npx playwright test \
  --config <plugin-path>/test/scout/ui/playwright.config.ts \
  --project local \
  --ui \
  --grep @<location>-<arch>-<domain>
```

The `--grep` value should match the suite tags you use. See [Deployment tags](https://www.elastic.co/elastic/docs-builder/docs/2915/extend/kibana/scout/deployment-tags).

## Debug flaky tests

When you add new tests, fix flakes, or make significant changes, run the same tests multiple times (recommended: **20–50** runs). See [Best practices](/elastic/docs-builder/docs/2915/extend/kibana/scout/best-practices#use-the-flaky-test-runner-to-catch-flaky-tests-early).

### Repeat the same test locally

To reproduce flakiness locally, you can run the same test multiple times with the `--repeatEach` flag.

#### Using Scout `run-tests`

The `run-tests` command supports a `--repeatEach` flag that forwards Playwright's `--repeat-each` option. Scout resolves the correct `--project` and `--grep` tag automatically from the `--arch` and `--domain` flags.
```bash
node scripts/scout run-tests \
  --arch stateful \
  --domain classic \
  --config src/platform/plugins/shared/dashboard/test/scout/ui/parallel.playwright.config.ts \
  --repeatEach 30
```

The value must be a positive integer. See [Run tests](https://www.elastic.co/elastic/docs-builder/docs/2915/extend/kibana/scout/run-tests) for the full list of `run-tests` flags.

#### Using Playwright directly

If you need more control (for example, targeting a specific spec file), you can call Playwright directly with `--repeat-each`.
**Grepping is key**: always pass `--grep` with the test title or tag that matches the target environment you’re running against, otherwise you may run suites that aren’t compatible with your chosen `--project`.
Example (repeat a single spec 30 times):
```bash
npx playwright test dashboard_search_by_value.spec.ts \
  --project mki \
  --grep @cloud-serverless-search \
  --config src/platform/plugins/shared/dashboard/test/scout/ui/parallel.playwright.config.ts \
  --repeat-each 30
```

`--project mki` runs against **cloud serverless**, so you’ll typically want a `@cloud-serverless-<domain>` grep (for example `@cloud-serverless-search`). For local runs (`--project local`), use `@local-...` tags.
If you’re unsure what to use for `--grep`, check the tags on the `test.describe(...)` block (see [Deployment tags](https://www.elastic.co/elastic/docs-builder/docs/2915/extend/kibana/scout/deployment-tags)).

### Run the Flaky Test Runner (CI)

There are two common ways to trigger the Flaky Test Runner (Elasticians only):
- **UI**: open `https://ci-stats.kibana.dev/trigger_flaky_test_runner` and follow the prompts.
- **GitHub PR comment**: post a comment on your pull request:

```bash
/flaky scoutConfig:<Playwright config path>:<number of runs>
```

Example:
```bash
/flaky scoutConfig:src/platform/plugins/shared/dashboard/test/scout/ui/parallel.playwright.config.ts:30
```