mirror of
https://github.com/tester-army/e2e.git
synced 2026-11-25 02:24:26 +08:00
* fix(explore): share the change brief's patch budget, shortest patches first The brief filled its 8 KB patch budget in path order, so a few long patches early in the order (docs/, a generated file) took it all and the files after them were listed by counts only, however small their patch. Every listed file's patch is now read, then the budget is split evenly, shortest first: patches that fit stay whole, and what they leave goes to the longer ones, none past 2.5 KB. A cut patch keeps at least 400 bytes, since 200 left little more than the hunk's leading context. Refs ENG-1284 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(explore): give the planner the pull request's title and description `e2e explore --changed-since` planned from commit messages and patches only. Commit messages often say "wip" or "fix"; the pull request description is where the author says what a user should see change, which is what the planner writes charters from. In a GitHub Actions `pull_request` or `pull_request_target` job, the title and description come from the event payload; in a GitLab merge request pipeline, from CI_MERGE_REQUEST_TITLE and _DESCRIPTION. Anywhere else, on a payload that can't be read, or on an interrupt (which the change read after it reports as INTERRUPTED), there is none. The section opens the brief within 1,500 bytes, and the commit messages beside it get 1,000 instead of 2,000. HTML comments from description templates are dropped, and the description is indented so no line reads as one of the brief's own. Every text the brief takes is now redacted and has `</change` defused before it is cut, so the fence no longer grows the brief past its budgets; together they stay under the 16 KiB agent context limit. The skip rule says it is never decided from what the pull request claims, and `complete` never reads it. Refs ENG-1284 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(explore): keep the newest commit message beside a pull request A message was cut to 800 bytes before the bullet and indentation were added, so a message of many short lines grew past the 1,000 bytes the commits get beside a pull request, and the loop left out every commit. The cut now measures the entry as the brief lists it, so the newest always fits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(explore): share the patch budget by what the brief shows of each patch Two ways a share went to a patch that showed nothing of its change: - Patches were ordered by their raw size, so a one-line change to a file with one very long line sorted last and got no share, though the brief shows that line capped at 300 characters. They are now ordered by the size the brief would show whole. - A share cut a patch at whole lines, so three long context lines could fill it before the first change, and every file got its hunk header and context and none of its edits. A cut patch with no added or removed line, and no mode change, now gets its counts only, and its share goes to the rest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(explore): show the pull request description as the page shows it - The description was cut with the patch cut, which caps every line at 300 characters, so a one-line paragraph lost its end, often the sentence that says what a user should see. It is now cut by bytes only, against its 1,500-byte budget, between characters. - An unclosed `<!--` dropped the rest of the description, even in a code span or in the middle of a line, where the page shows it. Only a closed comment, or an unclosed one that starts a line, is dropped now, and a comment in a code span or block is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
228 lines
7.9 KiB
Plaintext
228 lines
7.9 KiB
Plaintext
---
|
||
title: Exploring without a test
|
||
description: Give the agent a goal, not a test file. It plans its steps, operates the app, and reports what it finds.
|
||
"og:image": "https://e2e.com/docs/images/og/explore.png?v=8969611dd1"
|
||
"twitter:image": "https://e2e.com/docs/images/og/explore.png?v=8969611dd1"
|
||
---
|
||
|
||
import { Video } from './snippets/video.jsx';
|
||
|
||
`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()`.
|
||
|
||
<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>
|
||
|
||
A limit can be "stop before placing the order." With no goal, explore uses
|
||
`Explore the app and find bugs`. A failed step does not stop the run.
|
||
|
||
With no `e2e.config.ts`, explore runs the
|
||
[`e2e init`](/reference/cli#e2e-init) wizard first. The exploration starts
|
||
right after when nothing is left to do by hand. Otherwise init lists the
|
||
steps left, such as `npm install` or setting the model key.
|
||
Without a terminal, as in CI, explore fails with `CONFIG_NOT_FOUND`.
|
||
|
||
## 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](/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](/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](/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 a defect the change can cause is an `issue`. A defect elsewhere in the
|
||
app is a `warning` and doesn't fail the run.
|
||
|
||
With no goal, the goal is `Explore what this change affects and find bugs in
|
||
it`. The planner can then skip a change no user can see, such as docs or
|
||
tests only. The run ends `skipped` and passes. It skips only when it read
|
||
the whole change. A large diff, a binary file, or an uncommitted file rules
|
||
a skip out.
|
||
|
||
The branch's own commit messages, pull request description, and code can
|
||
sway the call. To tell a skip from a clean exploration, read
|
||
`run.explore.ended`.
|
||
|
||
For what the model reads, see
|
||
[Security](/reference/security#mcp-and-explore).
|
||
|
||
On GitHub Actions, run it in its own job on `pull_request`. With the
|
||
[GitHub reporter](/github) in the config, the findings go to their own pull
|
||
request comment. A fork's run can't post; see
|
||
[when nothing is posted](/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` puts the base branch in the checkout. Without it, the run
|
||
fails with `INVALID_CHANGED_SINCE`.
|
||
|
||
In a `pull_request` job or a GitLab merge request pipeline, the planner also
|
||
reads the pull request's title and description. Say there what a user should
|
||
see change. GitHub gives the text from the event that started the job, so an
|
||
edit shows after the next push, not on a re-run.
|
||
|
||
Keep the working tree clean after install and build, or the run is never
|
||
skipped. Ignore `.e2e/` and build output. Run e2e with `npx`, not
|
||
`pnpm exec`, which can rewrite `pnpm-lock.yaml`.
|
||
|
||
<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.
|
||
|
||
## Explore from code
|
||
|
||
To start an exploration from your own code, with a config value,
|
||
cancellation, and progress events, call
|
||
[`explore` from `e2e/runner`](/reference/runner#explore).
|
||
|
||
## Next
|
||
|
||
<CardGroup cols={2}>
|
||
<Card title="Bug bashes" icon="bug" href="/bug-bash">
|
||
Explore a whole app or branch with many explorations, and prove each bug with a test.
|
||
</Card>
|
||
<Card title="Agents and personas" icon="users" href="/agents">
|
||
The agents explore can run as.
|
||
</Card>
|
||
</CardGroup>
|