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

# Exploration and bug bashes

> Run exploratory testing with e2e explore: give the AI agent a goal, not a test file, or run a bug bash that proves each bug it finds with a failing test.

`e2e explore` runs the agent against your app with a goal instead of a test
file. The agent plans a step, does it, and records findings until the goal
is covered or a budget ends, then writes an assessment. It uses the same
model, tools, and action rules as `agent.act()`. To cover a whole app or
branch, run many explorations at once as a [bug bash](#bug-bashes).

<Video>
  <video src="/images/explore.mp4" aria-label="e2e explore drives the app in a headed browser and reports findings in the terminal." muted loop playsInline controls />

  `e2e explore --headed` drives the app and reports findings as it goes.
</Video>

## Start an exploration

Name the flow and the user goal, and add limits if necessary:

<CodeGroup>
```bash npm
npx e2e explore 'Explore the checkout flow like a first-time buyer and report anything off'
```

```bash pnpm
pnpm exec e2e explore 'Explore the checkout flow like a first-time buyer and report anything off'
```

```bash bun
bunx e2e explore 'Explore the checkout flow like a first-time buyer and report anything off'
```
</CodeGroup>

Add any limits right in the prompt (for example, "stop before placing the
order"). Without a prompt, `e2e explore` defaults to `"Explore the app and
find bugs"`. Individual failed steps don't abort the exploration.

If you don't have an `e2e.config.ts` yet, `explore` runs the
[`e2e init`](https://e2e.com/docs/reference/cli#e2e-init) wizard first and starts exploring
immediately when setup completes. In non-interactive environments like CI,
it exits with a missing-config error instead.

## Read the results

The terminal shows each finding and each finished step as they happen:

```text
 ❯  web  Exploring  Explore this bookshop like a careful first-time buyer: browse the catalog, ...
   ⚑ medium issue  Home greeting exposes an unresolved userName template (/)
   ⚑ high issue  Neuromancer shows an impossible negative stock availability (/catalog)
   ✓ 1  Catalog browsing 31.46s · 7 actions · 4 findings
   ⚑ high issue  Cart total does not update when Hyperion quantity increases (/cart)
   ⚑ trivial warning  Checkout newsletter label misspells Receive (/checkout)
   ✓ 2  Cart quantities and removal 19.47s · 4 actions · 3 findings
   ended: the agent covered the goal
```

An `issue` fails the run with exit code 1. A `warning` does not. The final
report puts the most severe issues first. Each finding has the steps to
reproduce it and, when possible, a screenshot. Compare each finding with
its evidence before you act on it. For the other exit codes, the JSON
report, and artifact paths, see the [CLI reference](https://e2e.com/docs/reference/cli#e2e-explore).

## Check other screen sizes

When the target's engine can resize the viewport (the web engine can), a
goal can ask for layouts at other widths:

<CodeGroup>
```bash npm
npx e2e explore 'Check the pricing page at desktop, tablet, and phone widths for broken layouts'
```

```bash pnpm
pnpm exec e2e explore 'Check the pricing page at desktop, tablet, and phone widths for broken layouts'
```

```bash bun
bunx e2e explore 'Check the pricing page at desktop, tablet, and phone widths for broken layouts'
```
</CodeGroup>

## Start signed in

Add `--session <name>`, the name of a session that a
[setup test](https://e2e.com/docs/authentication) saves:

<CodeGroup>
```bash npm
npx e2e explore --session admin 'Explore the admin settings and find bugs'
```

```bash pnpm
pnpm exec e2e explore --session admin 'Explore the admin settings and find bugs'
```

```bash bun
bunx e2e explore --session admin 'Explore the admin settings and find bugs'
```
</CodeGroup>

Explore runs only that setup test and restores the session. The explorer
knows the app starts signed in and plans no sign-in step.

Screenshots mask the password field. A value the app shows anywhere else
reaches the model. See
[screenshots after a secret fill](https://e2e.com/docs/reference/security#screenshots-after-a-secret-fill).

## Explore a pull request's change

Add `--changed-since <ref>` to explore what the branch changed. The planner
reads the commit messages and the committed diff since the merge base with
the ref. It spends its steps on the screens that the change can affect.

<CodeGroup>
```bash npm
npx e2e explore --changed-since origin/main
```

```bash pnpm
pnpm exec e2e explore --changed-since origin/main
```

```bash bun
bunx e2e explore --changed-since origin/main
```
</CodeGroup>

Only defects that the change could have caused count as an `issue`;
unrelated issues elsewhere in the app are reported as `warning`s and won't
fail the run.

Without an explicit prompt, `explore` focuses on what your diff changed and
may skip changes users can't see (like docs-only or test-only PRs) if the
working tree is clean and the whole diff fits. A skipped run passes; the
branch's own commit messages, PR text, and code can sway that call (read
`run.explore.ended` to tell a skip from a clean exploration). See
[Security](https://e2e.com/docs/reference/security#mcp-and-explore) for what gets sent to the
model.

On GitHub Actions, run `explore` in its own `pull_request` job. With the
[GitHub reporter](https://e2e.com/docs/github), findings post straight to a PR comment (fork PRs
won't post; see [when nothing is posted](https://e2e.com/docs/github#when-nothing-is-posted)).

```yaml title=".github/workflows/explore.yml"
on: pull_request

jobs:
  explore:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
    # An issue exits 1. Keep the findings as a review aid, not a merge gate.
    continue-on-error: true
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          fetch-depth: 0
      # ...install, browsers
      - run: npx e2e explore --changed-since origin/${{ github.base_ref }} --max-steps 4
        env:
          AI_GATEWAY_API_KEY: ${{ secrets.AI_GATEWAY_API_KEY }}
          GITHUB_TOKEN: ${{ github.token }}
```

`fetch-depth: 0` gives git the base branch history it needs to diff your
branch; without it, the run fails. On GitHub pull requests and GitLab merge
requests, the planner also reads the PR title and description, so mention
what should visibly change.

Keep the working tree clean after install and build so docs-only PRs can
still be skipped (run `npx` instead of `pnpm exec` if `pnpm` touches your
lockfile).

<Warning>
Never run it on `pull_request_target`. That run holds your secrets, and the
model reads the diff, commit messages, and pull request description a fork
wrote.
</Warning>

## If the run stops too early

A run stops after 8 steps or 10 minutes. To reach further into the flow,
raise `--max-steps <n>` (up to 100) or `--timeout <ms>` (up to `7200000`, 2
hours).

A run with time left after the main flows returns to them with edge-case
inputs, combined filters, reloads, and, with more than one account configured
and no `--session`, another account. It finishes early only when nothing new
is reachable.

## Choose the target and agent

Explore uses the targets, app command, models, and agents from
`e2e.config.ts`. Select them with `--target <name>` and `--agent <name>`.
Without `--target`, explore uses the first target.

An agent that runs on [your coding agent](https://e2e.com/docs/subscriptions#use-your-coding-agent)
explores on it and needs no model.

## Explore from code

To start an exploration from your own code, with a config value,
cancellation, and progress events, call
[`explore` from `e2e/runner`](https://e2e.com/docs/reference/runner#explore).

## Bug bashes

A bug bash runs many `e2e explore` sessions at the same time, each on one
area of the app. A coding agent then writes a test for each finding and
reports it as a bug only when the test fails.

<Video>
  <video src="/images/bug-bash.mp4" aria-label="A coding agent runs a bug bash in headed browsers." muted loop playsInline controls />

  Each browser is one explore session.
</Video>

### Before you start

- Make sure your app can serve several explorers at once. Either start the
  app once with `reuseExisting: true` on `app.command`, or use port `0` in
  the URL so each run gets its own copy. (In CI, e2e ignores
  `reuseExisting`, so use port `0`.) See
  [Starting your app](https://e2e.com/docs/web#starting-your-app).
- On mobile, configure one target per simulator or emulator so each explorer
  has its own device.
- Each explore session makes model calls and prints its token usage, cost,
  and duration when it finishes.
- Don't mutate data on a shared or production site.

The agent does the rest of the setup, such as seeded accounts and sign-in,
from the skill.

### Install the skill

The coding agent runs the bug bash from the [`e2e` skill](https://e2e.com/docs/coding-agents),
which `e2e init` installs. To install it without `init`:

<CodeGroup>
```bash npm
npx skills add e2e-inc/e2e
```

```bash pnpm
pnpm dlx skills add e2e-inc/e2e
```

```bash bun
bunx skills add e2e-inc/e2e
```
</CodeGroup>

### Start a bug bash

Give a prompt to your coding agent:

```text
Bug bash the checkout and account settings on this branch.
```

### What the agent does

<ShowMore id="bug-bash-steps">

1. Reads the routes of the app. On a branch, it also reads the diff.
2. Writes 5 to 10 charters. A charter is a one-sentence goal for one area,
   with one posture: first-time user, numbers and copy, edge input, state
   after reload, or error paths.
3. Runs one `e2e explore` for each charter, 4 at the same time, each with
   its own persona (`--agent`) and output directory (`--output`).
4. Merges the findings of all charters.
5. Rejects findings that have a known cause. The cause can be a limit of
   the explorer (for example, a link that opens a new tab), the local
   environment, the intended design, or the seed data.
6. Writes a repro test for each remaining finding: the finding's steps as
   `agent.act` calls and its expected behavior as the closing
   `agent.assert`. It can start one subagent per area.
7. Runs the repro tests. A finding is only confirmed as a bug if its repro
   test actually fails on the reported defect.
8. Reports, in this order: confirmed bugs, production risks that it cannot
   verify locally, rejected findings by reason, and warnings.

</ShowMore>

Each confirmed bug has its repro test and steps. It also has the
explorer's screenshot and video when the engine records them.

<Warning>
The video is not masked. If the explorer typed a password, check the video
before you share it.
</Warning>

To read the full procedure, run `npx e2e guide bug-bash`.

### Repro tests

A repro test fails until the bug is fixed. The agent tags each one
`bugbash`. Keep them out of the run that gates merges:

<CodeGroup>
```bash npm
npx e2e run --exclude-tag bugbash
```

```bash pnpm
pnpm exec e2e run --exclude-tag bugbash
```

```bash bun
bunx e2e run --exclude-tag bugbash
```
</CodeGroup>

After the fix, the test passes. Remove the tag and keep the test as a
regression test.

## Next

<CardGroup cols={2}>
  <Card title="Agents and personas" icon="users" href="/agents">
    The agents explore can run as.
  </Card>
  <Card title="MCP server" icon="plug" href="/coding-agents#let-the-agent-use-the-app">
    Live sessions for coding agents, several at once.
  </Card>
</CardGroup>
