explorbot 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/explorbot-cli.ts +7 -1
- package/boat/api-tester/src/config.ts +4 -2
- package/boat/doc-collector/bin/doc-collector-cli.ts +2 -0
- package/boat/doc-collector/src/ai/documentarian.ts +61 -31
- package/boat/doc-collector/src/config.ts +4 -2
- package/boat/prima/bin/prima-cli.ts +0 -0
- package/boat/prima/src/activity-line.ts +33 -0
- package/boat/prima/src/cli.ts +115 -86
- package/boat/prima/src/envelope.ts +80 -52
- package/boat/prima/src/prima.ts +547 -128
- package/boat/prima/src/pw-parser.ts +11 -1
- package/boat/prima/src/pw-registry.ts +4 -5
- package/boat/prima/src/session-log.ts +126 -0
- package/dist/bin/explorbot-cli.js +7 -1
- package/dist/boat/api-tester/bin/apibot-cli.js +2 -0
- package/dist/boat/api-tester/src/config.js +4 -2
- package/dist/boat/doc-collector/bin/doc-collector-cli.js +2 -0
- package/dist/boat/doc-collector/src/ai/documentarian.js +44 -19
- package/dist/boat/doc-collector/src/config.js +4 -2
- package/dist/boat/prima/src/activity-line.js +30 -0
- package/dist/boat/prima/src/cli.js +97 -77
- package/dist/boat/prima/src/envelope.js +70 -44
- package/dist/boat/prima/src/prima.js +515 -119
- package/dist/boat/prima/src/pw-parser.js +13 -1
- package/dist/boat/prima/src/pw-registry.js +4 -5
- package/dist/boat/prima/src/session-log.js +108 -0
- package/dist/package.json +3 -2
- package/dist/rules/navigator/verification-actions.md +20 -0
- package/dist/src/action-result.d.ts +7 -0
- package/dist/src/action-result.js +4 -0
- package/dist/src/action.d.ts +2 -0
- package/dist/src/action.js +36 -1
- package/dist/src/ai/captain/web-mode.js +6 -3
- package/dist/src/ai/captain.js +2 -0
- package/dist/src/ai/navigator.d.ts +7 -0
- package/dist/src/ai/navigator.js +10 -6
- package/dist/src/ai/pilot.d.ts +4 -0
- package/dist/src/ai/pilot.js +48 -2
- package/dist/src/ai/provider.js +2 -2
- package/dist/src/ai/rerunner.js +2 -1
- package/dist/src/ai/researcher.js +1 -1
- package/dist/src/ai/rules.js +17 -10
- package/dist/src/ai/task-agent.js +4 -1
- package/dist/src/ai/tester.d.ts +1 -1
- package/dist/src/ai/tester.js +33 -33
- package/dist/src/ai/tools.d.ts +14 -0
- package/dist/src/ai/tools.js +113 -36
- package/dist/src/config.d.ts +1 -0
- package/dist/src/config.js +13 -4
- package/dist/src/execution-controller.d.ts +2 -0
- package/dist/src/execution-controller.js +6 -0
- package/dist/src/explorbot.d.ts +2 -1
- package/dist/src/explorbot.js +3 -1
- package/dist/src/explorer.js +2 -3
- package/dist/src/playwright-recorder.js +30 -0
- package/dist/src/remote.d.ts +54 -0
- package/dist/src/remote.js +229 -0
- package/dist/src/reporter.d.ts +1 -0
- package/dist/src/reporter.js +7 -1
- package/dist/src/state-manager.d.ts +2 -1
- package/dist/src/stats.d.ts +1 -0
- package/dist/src/stats.js +1 -0
- package/dist/src/test-plan.d.ts +2 -0
- package/dist/src/test-plan.js +7 -0
- package/dist/src/utils/aria.d.ts +2 -8
- package/dist/src/utils/aria.js +69 -40
- package/dist/src/utils/html.js +1 -0
- package/dist/src/utils/logger.d.ts +6 -0
- package/dist/src/utils/logger.js +24 -0
- package/dist/src/utils/page-readiness.js +18 -1
- package/dist/src/utils/url-matcher.js +3 -0
- package/dist/src/utils/web-element.d.ts +2 -0
- package/dist/src/utils/web-element.js +8 -0
- package/dist/src/utils/web-sandbox.d.ts +1 -1
- package/dist/src/utils/web-sandbox.js +2 -3
- package/docs/api-testing/basics.md +90 -0
- package/docs/api-testing/planning.md +57 -0
- package/docs/api-testing/running-tests.md +55 -0
- package/docs/assets/cloud-report.png +0 -0
- package/docs/assets/html-report.png +0 -0
- package/docs/assets/langfuse-trace.png +0 -0
- package/docs/assets/successful-explore-run.png +0 -0
- package/docs/basics/getting-started.md +140 -0
- package/docs/basics/prerequisites.md +63 -0
- package/docs/basics/providers.md +362 -0
- package/docs/basics/running.md +78 -0
- package/docs/contributing/ai-integration-tests.md +57 -0
- package/docs/contributing/contributing.md +90 -0
- package/docs/contributing/demo-videos.md +36 -0
- package/docs/contributing/npm-package.md +138 -0
- package/docs/contributing/observability.md +227 -0
- package/docs/contributing/regression-tests.md +103 -0
- package/docs/contributing/testing.md +95 -0
- package/docs/doc-collection/basics.md +128 -0
- package/docs/doc-collection/crawling.md +67 -0
- package/docs/doc-collection/interactive-mode.md +99 -0
- package/docs/index.json +86 -0
- package/docs/reference/commands.md +994 -0
- package/docs/reference/configuration.md +569 -0
- package/docs/reference/scripting.md +303 -0
- package/docs/superpowers/plans/2026-08-01-actor-boat.md +925 -0
- package/docs/superpowers/plans/2026-08-01-prima-boat.md +1120 -0
- package/docs/superpowers/reviews/2026-08-06-prima-vs-playwright-cli.md +268 -0
- package/docs/superpowers/specs/2026-08-01-actor-boat-design.md +204 -0
- package/docs/superpowers/specs/2026-08-01-prima-boat-design.md +242 -0
- package/docs/superpowers/specs/2026-08-03-global-config-design.md +138 -0
- package/docs/superpowers/specs/2026-08-07-prima-fixes-design.md +394 -0
- package/docs/web-testing/agents.md +158 -0
- package/docs/web-testing/automated-tests.md +134 -0
- package/docs/web-testing/basics.md +91 -0
- package/docs/web-testing/customization.md +131 -0
- package/docs/web-testing/hooks.md +238 -0
- package/docs/web-testing/page-interaction.md +84 -0
- package/docs/web-testing/planner.md +122 -0
- package/docs/web-testing/rerun.md +164 -0
- package/docs/web-testing/researcher.md +380 -0
- package/docs/workflow/agentic-usage.md +233 -0
- package/docs/workflow/application-spec.md +73 -0
- package/docs/workflow/ci.md +202 -0
- package/docs/workflow/knowledge.md +310 -0
- package/docs/workflow/planning-styles.md +67 -0
- package/docs/workflow/reporting.md +133 -0
- package/docs/workflow/test-plans.md +90 -0
- package/package.json +3 -2
- package/rules/navigator/verification-actions.md +20 -0
- package/src/action-result.ts +11 -0
- package/src/action.ts +38 -2
- package/src/ai/captain/web-mode.ts +6 -3
- package/src/ai/captain.ts +3 -0
- package/src/ai/navigator.ts +14 -8
- package/src/ai/pilot.ts +53 -2
- package/src/ai/provider.ts +2 -4
- package/src/ai/rerunner.ts +2 -1
- package/src/ai/researcher.ts +1 -1
- package/src/ai/rules.ts +17 -10
- package/src/ai/task-agent.ts +3 -1
- package/src/ai/tester.ts +32 -33
- package/src/ai/tools.ts +132 -36
- package/src/config.ts +15 -4
- package/src/execution-controller.ts +8 -0
- package/src/explorbot.ts +4 -2
- package/src/explorer.ts +2 -2
- package/src/playwright-recorder.ts +23 -0
- package/src/remote.ts +238 -0
- package/src/reporter.ts +7 -1
- package/src/state-manager.ts +2 -1
- package/src/stats.ts +1 -0
- package/src/test-plan.ts +9 -0
- package/src/utils/aria.ts +65 -45
- package/src/utils/html.ts +1 -0
- package/src/utils/logger.ts +24 -1
- package/src/utils/page-readiness.ts +24 -1
- package/src/utils/url-matcher.ts +3 -0
- package/src/utils/web-element.ts +9 -0
- package/src/utils/web-sandbox.ts +3 -4
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Testing Guide
|
|
2
|
+
|
|
3
|
+
## Running Tests
|
|
4
|
+
|
|
5
|
+
### Unit Tests
|
|
6
|
+
```bash
|
|
7
|
+
# Run all unit tests
|
|
8
|
+
bun test tests/unit
|
|
9
|
+
|
|
10
|
+
# Run specific test file
|
|
11
|
+
bun test tests/unit/state-manager.test.ts
|
|
12
|
+
|
|
13
|
+
# Run tests with coverage
|
|
14
|
+
bun test tests/unit --coverage
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Coverage Reports
|
|
18
|
+
|
|
19
|
+
#### Text Coverage Report
|
|
20
|
+
```bash
|
|
21
|
+
# Get coverage with text output
|
|
22
|
+
bun run test:coverage
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
#### Coverage Summary Only
|
|
26
|
+
```bash
|
|
27
|
+
# Get just the coverage summary
|
|
28
|
+
bun run test:coverage:summary
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
#### LCOV Coverage File
|
|
32
|
+
The `--coverage` flag writes coverage data to `coverage/lcov.info`.
|
|
33
|
+
|
|
34
|
+
## Coverage Configuration
|
|
35
|
+
|
|
36
|
+
Coverage is configured in `bunfig.toml`:
|
|
37
|
+
|
|
38
|
+
- **Coverage Directory**: `coverage/`
|
|
39
|
+
- **Coverage Threshold**: 80%
|
|
40
|
+
- **Included Files**: `src/**/*.{ts,tsx,js,jsx}`
|
|
41
|
+
- **Excluded Files**: Test files, TUI components, build artifacts
|
|
42
|
+
|
|
43
|
+
## Test Structure
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
tests/
|
|
47
|
+
├── unit/ # Unit tests (Bun)
|
|
48
|
+
│ ├── state-manager.test.ts
|
|
49
|
+
│ ├── experience-tracker.test.ts
|
|
50
|
+
│ └── ...
|
|
51
|
+
├── integration/ # AI agent tests with mocked LLM
|
|
52
|
+
├── node/ # Node.js build smoke tests
|
|
53
|
+
├── regression/ # End-to-end runs with real AI
|
|
54
|
+
└── mocks/ # Test mocks
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This page covers unit tests. The other suites: integration tests exercise AI agents against a mocked LLM via aimock — see [AI integration tests](./ai-integration-tests.md). Node smoke tests in `tests/node/` verify the compiled npm build and run in CI (`bun run test:node`). Regression tests run Explorbot with real AI against a local fixture app — see [regression tests](./regression-tests.md).
|
|
58
|
+
|
|
59
|
+
## Writing Tests
|
|
60
|
+
|
|
61
|
+
### Best Practices
|
|
62
|
+
|
|
63
|
+
1. **Happy path focus**: Test successful scenarios and core functionality.
|
|
64
|
+
2. **Test isolation**: Make each test independent and clean up after itself.
|
|
65
|
+
3. **Descriptive names**: Name tests for what they check.
|
|
66
|
+
4. **Mock external dependencies**: Use `MockAIProvider` for AI-related tests.
|
|
67
|
+
5. **Temp directories**: Use `/tmp/` paths for file system tests.
|
|
68
|
+
|
|
69
|
+
### Mock AI Provider
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { MockAIProvider } from '../mocks/ai-provider.mock';
|
|
73
|
+
|
|
74
|
+
const mockAI = new MockAIProvider();
|
|
75
|
+
mockAI.setResponses([
|
|
76
|
+
{ text: 'Mock response 1' },
|
|
77
|
+
{ text: 'Mock response 2' }
|
|
78
|
+
]);
|
|
79
|
+
|
|
80
|
+
// Use mockAI.getModel() in your tests
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## CI/CD Integration
|
|
84
|
+
|
|
85
|
+
Generate coverage reports for your CI pipeline:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Generate coverage for CI
|
|
89
|
+
bun test tests/unit --coverage --coverage-reporter=lcov
|
|
90
|
+
|
|
91
|
+
# Check coverage threshold (exits with error if below 80%)
|
|
92
|
+
bun test tests/unit --coverage --coverage-reporter=text
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Upload the LCOV file (`coverage/lcov.info`) to a coverage service like Codecov or Coveralls.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Doc Collection Basics
|
|
2
|
+
|
|
3
|
+
Explorbot can document your web app for you. The doc collector opens the app in a browser, crawls it page by page, and has AI describe each page: its purpose, screenshots of its sections, and what a user can do there. The result is a browsable markdown spec.
|
|
4
|
+
|
|
5
|
+
This is useful when you need:
|
|
6
|
+
|
|
7
|
+
- documentation for an app that has none
|
|
8
|
+
- onboarding material for a new team member
|
|
9
|
+
- a machine-readable spec of your app to feed into agents or test planning
|
|
10
|
+
|
|
11
|
+
The output is honest about what it knows: every capability is marked as either proven (backed by visible UI) or assumed.
|
|
12
|
+
|
|
13
|
+
## How it works
|
|
14
|
+
|
|
15
|
+
The collector starts at the path you give it. For each page it:
|
|
16
|
+
|
|
17
|
+
1. Navigates to the page and captures its state.
|
|
18
|
+
2. Runs the [Researcher](../web-testing/researcher.md) to map sections and interactive elements.
|
|
19
|
+
3. Asks AI to write the page documentation from that research.
|
|
20
|
+
4. Saves a markdown file plus screenshots, and queues links found on the page.
|
|
21
|
+
|
|
22
|
+
It repeats this until the queue is empty or the page budget is spent. Only same-origin links are followed.
|
|
23
|
+
|
|
24
|
+
## Configure
|
|
25
|
+
|
|
26
|
+
The collector runs on your regular Explorbot setup — the AI provider and browser come from `explorbot.config.js` (see [configuration](../reference/configuration.md)). Crawl behavior lives in a separate file: `docbot.config.ts` (`.js` and `.mjs` work too).
|
|
27
|
+
|
|
28
|
+
Generate a starter config:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx explorbot docs init
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Three options matter for a first run:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
export default {
|
|
38
|
+
docs: {
|
|
39
|
+
maxPages: 100, // how many pages to document
|
|
40
|
+
output: 'docs', // subfolder inside your output dir
|
|
41
|
+
screenshot: true, // capture page and section screenshots
|
|
42
|
+
ignoreErrors: true, // skip pages that fail instead of stopping the crawl
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
If no `docbot.config` file exists, these defaults apply. `docs init` refuses to overwrite an existing file unless you pass `--force`.
|
|
48
|
+
|
|
49
|
+
One more option worth knowing early: `prompt` adds your own instructions to the AI that writes page docs — for example `prompt: 'Focus on billing workflows'`.
|
|
50
|
+
|
|
51
|
+
## First run
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx explorbot docs collect / # start from the home page
|
|
55
|
+
npx explorbot docs collect /admin --max-pages 20 # start deeper, smaller budget
|
|
56
|
+
npx explorbot docs collect https://staging.example.com/app # full URL: its origin becomes the base URL for this run
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Useful flags:
|
|
60
|
+
|
|
61
|
+
- `--max-pages <count>` — override the configured page budget for this run
|
|
62
|
+
- `-s, --show` — watch the browser while it crawls
|
|
63
|
+
- `--session [file]` — reuse a saved login session; needed for apps behind authentication. See [--session](../reference/commands.md#--session).
|
|
64
|
+
- `--docs-config <path>` — load a `docbot.config` from another location
|
|
65
|
+
- `-c, --config <path>`, `-p, --path <dir>`, `--verbose` — same as in other Explorbot commands
|
|
66
|
+
|
|
67
|
+
When the run finishes it prints how many pages were documented, how many were skipped, and where the spec index is.
|
|
68
|
+
|
|
69
|
+
## Output files
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
output/docs/
|
|
73
|
+
├── index.md # state map and index of everything documented
|
|
74
|
+
├── state-diagram.mmd # raw Mermaid state-transition artifact (reusable by other agents)
|
|
75
|
+
├── pages/ # one markdown file per page
|
|
76
|
+
└── screenshots/ # full-page and section captures
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`index.md` opens with run stats and a Mermaid state-transition map, then lists every page with its purpose and capabilities. Page nodes in the diagram link to their documentation. Transient dialogs, modals, tabs, and expanded screen areas appear as child states when interactive collection observes them. Pages that were skipped are listed at the bottom with reasons.
|
|
80
|
+
|
|
81
|
+
`state-diagram.mmd` is the same state-transition map as a standalone Mermaid file (no markdown fences), so other agents can embed or post-process it without re-rendering `index.md`.
|
|
82
|
+
|
|
83
|
+
## Use the spec in Explorbot
|
|
84
|
+
|
|
85
|
+
Pass the generated directory or its `index.md` to any Explorbot web command:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npx explorbot start / --spec output/docs
|
|
89
|
+
npx explorbot plan /admin/users --spec output/docs
|
|
90
|
+
npx explorbot explore / --spec output/docs
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
You can also set `dirs.spec: 'output/docs'` in `explorbot.config.js` to use it by default. Explorbot selects documentation for the current URL instead of loading the whole site spec into every prompt. Proven capabilities and observed transitions are supporting context; possible capabilities remain explicitly unverified until the live UI confirms them.
|
|
94
|
+
|
|
95
|
+
The format is not tied to Docbot. See [Application Specs](../workflow/application-spec.md) to create or generate a compatible bundle with another tool.
|
|
96
|
+
|
|
97
|
+
Each page file follows the same shape:
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
# /admin/users
|
|
101
|
+
|
|
102
|
+
Title: User Management
|
|
103
|
+
|
|
104
|
+
## Purpose
|
|
105
|
+
|
|
106
|
+
Lists all user accounts and provides entry points for managing them.
|
|
107
|
+
|
|
108
|
+
## Screenshots
|
|
109
|
+
|
|
110
|
+

|
|
111
|
+
|
|
112
|
+
## User Can
|
|
113
|
+
|
|
114
|
+
- user can search users by name -> list of items
|
|
115
|
+
Proof: Search input above the users table.
|
|
116
|
+
|
|
117
|
+
## User Might
|
|
118
|
+
|
|
119
|
+
- user might export the user list -> all items
|
|
120
|
+
Signal: Toolbar shows an unlabeled download icon.
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`User Can` lists capabilities proven by visible UI, each with its evidence. `User Might` lists capabilities the UI suggests but research could not fully confirm. Pages where research found almost nothing are skipped rather than padded with guesses.
|
|
124
|
+
|
|
125
|
+
## Next steps
|
|
126
|
+
|
|
127
|
+
- The crawl visited too much, too little, or the wrong pages — tune it in [Choosing What to Crawl](./crawling.md).
|
|
128
|
+
- Document what pages do, not only what they show — enable [Interactive Mode](./interactive-mode.md).
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Choosing What to Crawl
|
|
2
|
+
|
|
3
|
+
With defaults, a run crawls everything it can reach on the same origin, up to 100 pages. That is often too much — the crawler wanders into settings and profile pages — or too little, burning the budget before it reaches the part you care about. The options below control where it goes. All of them live under the `docs` key in `docbot.config.ts`.
|
|
4
|
+
|
|
5
|
+
## How the queue is built
|
|
6
|
+
|
|
7
|
+
After documenting a page, the crawler queues new targets from three sources: links found on the page, navigation entries identified by research (this is how hash-navigated pages such as OpenAPI reference docs get crawled), and URLs discovered through clicks when [interactive mode](./interactive-mode.md) is on. Every target must pass the filters on this page before it is queued. Pages already visited in this session are not revisited, and the crawl stops early if it detects a dead loop.
|
|
8
|
+
|
|
9
|
+
## maxPages — the budget
|
|
10
|
+
|
|
11
|
+
The crawl stops once this many pages are documented. Skipped pages — failed navigation, low-signal pages — do not count against the budget. `--max-pages` on the command line overrides the config for one run.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
docs: {
|
|
15
|
+
maxPages: 30,
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## scope — how far from the start path
|
|
20
|
+
|
|
21
|
+
`scope` bounds the crawl relative to the path you start from:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
docs: {
|
|
25
|
+
scope: 'subtree',
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- `site` (default) — anywhere on the same origin.
|
|
30
|
+
- `subtree` — only the start path and paths beneath it. Starting at `/admin/reports` allows `/admin/reports/2026` but blocks `/admin/users`.
|
|
31
|
+
- `section` — like `subtree`, plus sibling paths that extend the start path with a dash. Starting at `/docs/api` also allows `/docs/api-reference`.
|
|
32
|
+
|
|
33
|
+
The scope root is the start path (capped at its first four segments for deeper paths). Links outside the scope are never queued.
|
|
34
|
+
|
|
35
|
+
## includePaths and excludePaths
|
|
36
|
+
|
|
37
|
+
Path filters for finer control than `scope`:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
docs: {
|
|
41
|
+
excludePaths: ['/settings/*', '/help/*'],
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Patterns match the URL path: exact paths, `/admin/*` for a path and everything under it, glob patterns like `/users/*/edit`, or a regex prefixed with `^`.
|
|
46
|
+
|
|
47
|
+
`excludePaths` blocks matching paths. `includePaths` inverts the logic: when it is non-empty, only matching paths are crawled — and it becomes the only filter. `excludePaths` and `deniedPathSegments` are not consulted, so keep include patterns tight enough that they cannot match destructive endpoints.
|
|
48
|
+
|
|
49
|
+
## deniedPathSegments — the safety list
|
|
50
|
+
|
|
51
|
+
The crawler follows links in a real browser. Some links are dangerous to follow: `/logout` ends the session, and `delete`- or `destroy`-style endpoints can modify data with a single request. Any URL with a path segment on this list is never queued.
|
|
52
|
+
|
|
53
|
+
The default list covers sign-out endpoints (`logout`, `signout`, `sign_out`), destructive actions (`delete`, `destroy`, `remove`), and OAuth `callback` routes. Matching is by whole segment, case-insensitive: `/users/delete/3` is blocked because one segment equals `delete`; `/deleted-items` is not.
|
|
54
|
+
|
|
55
|
+
Setting `deniedPathSegments` replaces the built-in list, so keep the defaults when adding your own entries.
|
|
56
|
+
|
|
57
|
+
## collapseDynamicPages — one page per template
|
|
58
|
+
|
|
59
|
+
Apps repeat the same page under many URLs: `/users/1`, `/users/2`, and so on. By default, URLs that differ only in dynamic segments (numeric IDs, UUIDs, hashes) count as the same page, and the first one reached represents them all.
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
docs: {
|
|
63
|
+
collapseDynamicPages: false,
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Set it to `false` when such pages genuinely differ and you want each URL documented separately. Expect the page budget to fill up faster.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Interactive Mode and Screenshots
|
|
2
|
+
|
|
3
|
+
A static crawl documents what each page looks like. Interactive mode also documents what pages do: before writing a page's docs, the collector clicks a few of its controls and records what actually happens. Tabs get switched, panels get opened, and the results become observed behavior instead of guesses.
|
|
4
|
+
|
|
5
|
+
Enable it in `docbot.config.ts`:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
export default {
|
|
9
|
+
docs: {
|
|
10
|
+
interactive: true,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## What changes
|
|
16
|
+
|
|
17
|
+
The collector picks a handful of safe controls on each page and clicks them one by one. After every click it compares page state — the URL and the elements that appeared or disappeared — and records the difference. If a click navigates away, it returns to the page and continues.
|
|
18
|
+
|
|
19
|
+
These raw observations are handed to the AI as evidence for the page's capabilities, and the page file gains a `## State Transitions` section:
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
## State Transitions
|
|
23
|
+
|
|
24
|
+
### Clicked tab: Merged
|
|
25
|
+
|
|
26
|
+
**Before:** 18 elements (tab:3, link:5, text:7). URL /pulls
|
|
27
|
+
|
|
28
|
+
**After:** 21 elements (tab:3, link:8, text:7). URL /pulls
|
|
29
|
+
|
|
30
|
+
**Observed changes:**
|
|
31
|
+
- ARIA snapshot gained 6 elements
|
|
32
|
+
- Visible links after interaction: 8
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
URLs discovered through clicks join the crawl queue, so interactive mode can reach pages that no plain link points to.
|
|
36
|
+
|
|
37
|
+
## What gets tried per page
|
|
38
|
+
|
|
39
|
+
The collector does not click everything:
|
|
40
|
+
|
|
41
|
+
- **Tabs first.** If research found a tab group (2 to 6 tabs), each tab is clicked to capture the page's alternate states.
|
|
42
|
+
- **Then primary actions.** Up to `maxPrimaryCandidates` (default 3) of the most promising links and buttons from the page's content and control sections. Navigation menus, headers, and footers are excluded. Controls that open dialogs or change a local screen area are recorded as child states; controls inside an already open overlay are not explored recursively.
|
|
43
|
+
- **Hard cap.** `maxInteractions` (default 5) limits total clicks per page, tabs included.
|
|
44
|
+
|
|
45
|
+
Raise the numbers for control-dense pages you want covered deeply; lower them to speed up large crawls:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
docs: {
|
|
49
|
+
interactive: true,
|
|
50
|
+
maxInteractions: 8,
|
|
51
|
+
maxPrimaryCandidates: 5,
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Clicks that change nothing observable are discarded. If no click on a page produces a meaningful change, or interaction fails entirely, the page falls back to static documentation. Interactive mode adds evidence; it never blocks a page from being documented.
|
|
56
|
+
|
|
57
|
+
## deniedActionLabels — the click safety list
|
|
58
|
+
|
|
59
|
+
The crawling filters keep the collector away from dangerous URLs; `deniedActionLabels` does the same for clicks. A control is never clicked when its label or locator contains a denied word. The defaults cover destructive and session-ending vocabulary: `delete`, `remove`, `destroy`, `archive`, `discard`, `logout`, and similar. Matching is substring-based and case-insensitive, so "Delete account" and "Archive all" are both skipped.
|
|
60
|
+
|
|
61
|
+
Setting `deniedActionLabels` replaces the built-in list, so keep the defaults when adding words specific to your app.
|
|
62
|
+
|
|
63
|
+
## Low-signal pages
|
|
64
|
+
|
|
65
|
+
Some crawled pages have nothing worth documenting: empty states, redirect stubs, error pages. A page is skipped from the spec when both are true:
|
|
66
|
+
|
|
67
|
+
- it yields fewer proven actions than `minCanActions` (default 1), and
|
|
68
|
+
- research found fewer interactive elements than `minInteractiveElements` (default 3)
|
|
69
|
+
|
|
70
|
+
Skipped pages appear at the end of `index.md` with the reason. This filter applies in static and interactive mode alike. If real pages are being dropped, lower the thresholds; `minCanActions: 0` keeps every page.
|
|
71
|
+
|
|
72
|
+
## Screenshots
|
|
73
|
+
|
|
74
|
+
Screenshots are on by default (`screenshot: true`) in both modes. For every documented page the collector captures:
|
|
75
|
+
|
|
76
|
+
- one full-page screenshot
|
|
77
|
+
- one screenshot per section the [Researcher](../web-testing/researcher.md) identified — a sidebar, a data table, a filter bar — capped by `maxSectionScreenshots` (default 8)
|
|
78
|
+
|
|
79
|
+
Images land in `output/docs/screenshots/` and are embedded in the page files, each section shot labeled with the CSS selector it was taken from.
|
|
80
|
+
|
|
81
|
+
Interactive states are captured before the collector restores the original page. DocBot compares viewport screenshots from immediately before and after the action, finds the rectangle containing the changed pixels, adds a 30-pixel margin, and saves that fragment. If the images cannot be compared safely, it saves the current viewport instead.
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
docs: {
|
|
85
|
+
maxSectionScreenshots: 4,
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Set `screenshot: false` to turn captures off entirely. This also disables screenshot-assisted research, which makes the run cheaper and faster but text-only.
|
|
90
|
+
|
|
91
|
+
## Error handling
|
|
92
|
+
|
|
93
|
+
`ignoreErrors` controls page-level crawl failures. `true` keeps the current best-effort behavior and skips every failed page, `false` stops the crawl on the first error, and an array skips only errors whose code, name, or message contains one of the listed strings.
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
docs: {
|
|
97
|
+
ignoreErrors: ['timeout', 'navigation interrupted'],
|
|
98
|
+
}
|
|
99
|
+
```
|
package/docs/index.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Explorbot Documentation",
|
|
3
|
+
"description": "Explorbot explores your web app, plans tests, and runs them — no scripts required.",
|
|
4
|
+
"start": "basics/getting-started.md",
|
|
5
|
+
"sections": [
|
|
6
|
+
{
|
|
7
|
+
"title": "Basics",
|
|
8
|
+
"dir": "basics",
|
|
9
|
+
"pages": [
|
|
10
|
+
{ "title": "Getting started", "file": "basics/getting-started.md", "description": "Install to first test in ten minutes" },
|
|
11
|
+
{ "title": "Running Explorbot", "file": "basics/running.md", "description": "Interactive TUI vs headless CLI, and when to use each" },
|
|
12
|
+
{ "title": "Prerequisites", "file": "basics/prerequisites.md", "description": "Check that your app is a good fit" },
|
|
13
|
+
{ "title": "Providers", "file": "basics/providers.md", "description": "Set up an AI provider and pick models" }
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"title": "Web testing",
|
|
18
|
+
"dir": "web-testing",
|
|
19
|
+
"pages": [
|
|
20
|
+
{ "title": "Basics", "file": "web-testing/basics.md", "description": "The explore loop, states, and your first session" },
|
|
21
|
+
{ "title": "Customization", "file": "web-testing/customization.md", "description": "Make it work on your app: login, cookie bars, modals, test data" },
|
|
22
|
+
{ "title": "Planner", "file": "web-testing/planner.md", "description": "Tune what gets tested" },
|
|
23
|
+
{ "title": "Researcher", "file": "web-testing/researcher.md", "description": "How pages are analyzed, and how to tune it" },
|
|
24
|
+
{ "title": "Page interaction", "file": "web-testing/page-interaction.md", "description": "How agents read and act on a page" },
|
|
25
|
+
{ "title": "Automated tests", "file": "web-testing/automated-tests.md", "description": "The runnable test files you keep" },
|
|
26
|
+
{ "title": "Rerun", "file": "web-testing/rerun.md", "description": "Re-run generated tests with AI healing" },
|
|
27
|
+
{ "title": "Agents", "file": "web-testing/agents.md", "description": "What each agent does under the hood" },
|
|
28
|
+
{ "title": "Hooks", "file": "web-testing/hooks.md", "description": "Run your own code before or after an agent" }
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"title": "API testing",
|
|
33
|
+
"dir": "api-testing",
|
|
34
|
+
"pages": [
|
|
35
|
+
{ "title": "Basics", "file": "api-testing/basics.md", "description": "Chief and Curler, configuration, your first API test" },
|
|
36
|
+
{ "title": "Planning", "file": "api-testing/planning.md", "description": "Specs, endpoint knowledge, and planning styles" },
|
|
37
|
+
{ "title": "Running tests", "file": "api-testing/running-tests.md", "description": "Executing plans, request logs, autonomous explore" }
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"title": "Doc collection",
|
|
42
|
+
"dir": "doc-collection",
|
|
43
|
+
"pages": [
|
|
44
|
+
{ "title": "Basics", "file": "doc-collection/basics.md", "description": "Crawl your app and generate page docs" },
|
|
45
|
+
{ "title": "Crawling", "file": "doc-collection/crawling.md", "description": "Choose what gets visited" },
|
|
46
|
+
{ "title": "Interactive mode", "file": "doc-collection/interactive-mode.md", "description": "Document behavior, not just pages" }
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"title": "Common workflow",
|
|
51
|
+
"dir": "workflow",
|
|
52
|
+
"description": "These pages apply to web and API testing alike",
|
|
53
|
+
"pages": [
|
|
54
|
+
{ "title": "Knowledge", "file": "workflow/knowledge.md", "description": "Teach Explorbot about your app" },
|
|
55
|
+
{ "title": "Application Specs", "file": "workflow/application-spec.md", "description": "Reuse versioned application documentation" },
|
|
56
|
+
{ "title": "Test plans", "file": "workflow/test-plans.md", "description": "The plan file format and how plans are reused" },
|
|
57
|
+
{ "title": "Planning styles", "file": "workflow/planning-styles.md", "description": "Normal, curious, psycho, and your own" },
|
|
58
|
+
{ "title": "Reporting", "file": "workflow/reporting.md", "description": "Local reports and Testomat.io" },
|
|
59
|
+
{ "title": "Continuous integration", "file": "workflow/ci.md", "description": "Scheduled runs with cached experience on any CI" },
|
|
60
|
+
{ "title": "Agentic usage", "file": "workflow/agentic-usage.md", "description": "Drive Explorbot from a coding agent: config-free runs and agent-written plans" }
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"title": "Reference",
|
|
65
|
+
"dir": "reference",
|
|
66
|
+
"pages": [
|
|
67
|
+
{ "title": "Commands", "file": "reference/commands.md", "description": "Every CLI and terminal command" },
|
|
68
|
+
{ "title": "Configuration", "file": "reference/configuration.md", "description": "The config file, top to bottom" },
|
|
69
|
+
{ "title": "Scripting", "file": "reference/scripting.md", "description": "The programmatic API" }
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"title": "Contributing",
|
|
74
|
+
"dir": "contributing",
|
|
75
|
+
"pages": [
|
|
76
|
+
{ "title": "Contributing", "file": "contributing/contributing.md", "description": "How to contribute" },
|
|
77
|
+
{ "title": "Observability", "file": "contributing/observability.md", "description": "Trace and debug AI calls" },
|
|
78
|
+
{ "title": "Testing", "file": "contributing/testing.md", "description": "Run the test suite" },
|
|
79
|
+
{ "title": "AI integration tests", "file": "contributing/ai-integration-tests.md", "description": "How agent tests work" },
|
|
80
|
+
{ "title": "Regression tests", "file": "contributing/regression-tests.md", "description": "The real-AI e2e harness" },
|
|
81
|
+
{ "title": "Demo videos", "file": "contributing/demo-videos.md", "description": "Turn recorded sessions into demo clips" },
|
|
82
|
+
{ "title": "npm package", "file": "contributing/npm-package.md", "description": "Build and publish" }
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|