@testdriverai/mcp 7.9.149-test → 7.9.151-test
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/agent/interface.js +6 -0
- package/ai/skills/testdriver-caching/SKILL.md +13 -6
- package/ai/skills/testdriver-client/SKILL.md +5 -1
- package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +14 -4
- package/ai/skills/testdriver-find/SKILL.md +2 -0
- package/ai/skills/testdriver-generating-tests/SKILL.md +159 -8
- package/ai/skills/testdriver-machine-setup/SKILL.md +75 -8
- package/ai/skills/testdriver-making-assertions/SKILL.md +78 -2
- package/ai/skills/testdriver-performing-actions/SKILL.md +97 -2
- package/ai/skills/testdriver-quickstart/SKILL.md +47 -28
- package/ai/skills/testdriver-wait/SKILL.md +1 -1
- package/ai/skills/testdriver:generating-tests/SKILL.md +0 -11
- package/docs/changelog.mdx +1 -1
- package/docs/docs.json +14 -39
- package/docs/v7/assert.mdx +0 -1
- package/docs/v7/caching.mdx +14 -10
- package/docs/v7/client.mdx +1 -1
- package/docs/v7/copilot/auto-healing.mdx +167 -18
- package/docs/v7/copilot/running-tests.mdx +915 -54
- package/docs/v7/debugging-with-screenshots.mdx +17 -7
- package/docs/v7/generating-tests.mdx +166 -10
- package/docs/v7/making-assertions.mdx +81 -4
- package/docs/v7/performing-actions.mdx +100 -4
- package/docs/v7/quickstart.mdx +299 -21
- package/docs/v7/wait.mdx +1 -1
- package/interfaces/cli/commands/init.js +2 -0
- package/lib/init-project.js +7 -0
- package/mcp-server/dist/server.mjs +2 -0
- package/mcp-server/src/server.ts +2 -0
- package/package.json +3 -3
- package/docs/v7/ai/agent.mdx +0 -72
- package/docs/v7/ai/mcp.mdx +0 -228
- package/docs/v7/ai/skills.mdx +0 -73
- package/docs/v7/ai.mdx +0 -205
- package/docs/v7/copilot/creating-tests.mdx +0 -156
- package/docs/v7/copilot/github.mdx +0 -143
- package/docs/v7/copilot/setup.mdx +0 -143
- package/docs/v7/device-config.mdx +0 -317
- package/docs/v7/locating-elements.mdx +0 -71
- package/docs/v7/machine-setup.mdx +0 -331
- package/docs/v7/running-tests.mdx +0 -185
- package/docs/v7/waiting-for-elements.mdx +0 -90
package/docs/v7/quickstart.mdx
CHANGED
|
@@ -10,6 +10,53 @@ TestDriver makes it easy to write automated computer-use tests for web browsers,
|
|
|
10
10
|
<Tip><a href="https://discord.com/invite/cWDFW8DzPm" target="_blank" rel="noreferrer">Join our Discord</a> if you have any questions or need help getting started!</Tip>
|
|
11
11
|
|
|
12
12
|
<Tabs>
|
|
13
|
+
<Tab title="Add to GitHub" icon="github">
|
|
14
|
+
|
|
15
|
+
Drop-in UI testing for any GitHub repository. Mention `@testdriverai` anywhere in your repo and it writes UI tests and catches regressions before they merge.
|
|
16
|
+
|
|
17
|
+
<Card
|
|
18
|
+
title="Add to GitHub"
|
|
19
|
+
icon="github"
|
|
20
|
+
href="https://go.testdriver.ai/github"
|
|
21
|
+
arrow
|
|
22
|
+
horizontal
|
|
23
|
+
>
|
|
24
|
+
Install the TestDriver GitHub app and start testing in minutes — no setup required.
|
|
25
|
+
</Card>
|
|
26
|
+
|
|
27
|
+
<Steps>
|
|
28
|
+
<Step title="Install the GitHub App">
|
|
29
|
+
Click **Add to GitHub** above and install TestDriver on the repositories you want to test.
|
|
30
|
+
</Step>
|
|
31
|
+
|
|
32
|
+
<Step title="Mention @testdriverai">
|
|
33
|
+
Open a pull request or issue and mention `@testdriverai` to have it write and run UI tests:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
@testdriverai Write a test that verifies the homepage loads and the signup button works.
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
TestDriver spawns a sandbox, writes the test, and posts results right in the conversation.
|
|
40
|
+
</Step>
|
|
41
|
+
|
|
42
|
+
<Step title="Catch Regressions Automatically">
|
|
43
|
+
Once your tests are committed, TestDriver runs them on every pull request and flags regressions before they merge.
|
|
44
|
+
</Step>
|
|
45
|
+
</Steps>
|
|
46
|
+
|
|
47
|
+
Want to use TestDriver from GitHub Copilot or the GitHub Mobile app instead? See the full GitHub guide:
|
|
48
|
+
|
|
49
|
+
<Card
|
|
50
|
+
title="GitHub Integration Guide"
|
|
51
|
+
icon="arrow-right"
|
|
52
|
+
href="/v7/copilot/auto-healing#use-testdriver-in-github"
|
|
53
|
+
arrow
|
|
54
|
+
horizontal
|
|
55
|
+
>
|
|
56
|
+
Use TestDriver from GitHub web, Copilot chat, PR reviews, and mobile.
|
|
57
|
+
</Card>
|
|
58
|
+
|
|
59
|
+
</Tab>
|
|
13
60
|
<Tab title="CLI" icon="terminal">
|
|
14
61
|
|
|
15
62
|
Get started quickly with the TestDriver CLI.
|
|
@@ -40,32 +87,263 @@ TestDriver makes it easy to write automated computer-use tests for web browsers,
|
|
|
40
87
|
</Step>
|
|
41
88
|
</Steps>
|
|
42
89
|
</Tab>
|
|
43
|
-
<Tab title="
|
|
90
|
+
<Tab title="AI Setup" icon="robot">
|
|
44
91
|
|
|
45
|
-
|
|
92
|
+
Plug TestDriver into your AI client so you can write, run, and debug real end-to-end tests right from chat. There are three pieces, and `testdriverai init` installs all of them for you:
|
|
46
93
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
href="vscode:extension/testdriver.testdriver"
|
|
51
|
-
arrow
|
|
52
|
-
horizontal
|
|
53
|
-
>
|
|
54
|
-
</Card>
|
|
94
|
+
- **The agent** — an expert test-creator that drives a live sandbox, writes code after each step, and reruns the test until it passes.
|
|
95
|
+
- **Skills** — small instruction files that teach the agent the exact syntax for each TestDriver capability (`find`, `click`, `type`, `assert`, …).
|
|
96
|
+
- **The MCP server** — exposes TestDriver's computer-use tools over the [Model Context Protocol](https://modelcontextprotocol.io) so any MCP-capable client can use them.
|
|
55
97
|
|
|
56
|
-
|
|
98
|
+
### Quick install (recommended)
|
|
57
99
|
|
|
58
|
-
|
|
100
|
+
`testdriverai init` wires up the agent, skills, and MCP server for you, writing each client's config in the exact format and location it expects:
|
|
59
101
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
102
|
+
```bash
|
|
103
|
+
# interactive — pick your client(s)
|
|
104
|
+
npx testdriverai init
|
|
105
|
+
|
|
106
|
+
# one client
|
|
107
|
+
npx testdriverai init --client claude-code
|
|
108
|
+
|
|
109
|
+
# several
|
|
110
|
+
npx testdriverai init --client claude-code,cursor,vscode
|
|
111
|
+
|
|
112
|
+
# everything
|
|
113
|
+
npx testdriverai init --client all
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
<Info>
|
|
117
|
+
`init` detects clients already present in your project and pre-selects them in the picker. Re-running `init` is safe — it merges the TestDriver entry into existing config without overwriting your other servers.
|
|
118
|
+
</Info>
|
|
119
|
+
|
|
120
|
+
You'll need a TestDriver API key. Create one at [console.testdriver.ai/team](https://console.testdriver.ai/team) and `init` will save it to `.env` as `TD_API_KEY`.
|
|
121
|
+
|
|
122
|
+
### The agent
|
|
123
|
+
|
|
124
|
+
The **TestDriver agent** is an expert test-creator that runs inside your AI client (Claude Code, Cursor, VS Code, and others). It writes, runs, and debugs real end-to-end tests by driving your app the same way a person would — using AI vision to find elements, click, type, and assert — through the TestDriver MCP server.
|
|
125
|
+
|
|
126
|
+
Unlike a chat assistant that only suggests code, the agent works **iteratively against a live sandbox**: it starts a session, performs each action, writes the generated code to your test file, verifies the result with a screenshot, and reruns the test until it passes.
|
|
127
|
+
|
|
128
|
+
During init you'll be asked which AI client(s) to install into. The agent is written to the location each client expects:
|
|
129
|
+
|
|
130
|
+
| Client | Agent location |
|
|
131
|
+
| --- | --- |
|
|
132
|
+
| Claude Code | `.claude/agents/testdriver.md` |
|
|
133
|
+
| VS Code (Copilot) | `.github/agents/testdriver.agent.md` |
|
|
134
|
+
| Cursor | `.cursor/rules/testdriver.mdc` |
|
|
135
|
+
| Windsurf | `.windsurf/rules/testdriver.md` |
|
|
136
|
+
| Codex | `AGENTS.md` |
|
|
137
|
+
| Zed | `.rules` |
|
|
138
|
+
|
|
139
|
+
Once installed, invoke it from your client's chat:
|
|
140
|
+
|
|
141
|
+
```text
|
|
142
|
+
@testdriver write a test that logs in and verifies the dashboard loads
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The agent will spin up a sandbox, perform the steps live, write them into a test file under `tests/`, and run it for you.
|
|
146
|
+
|
|
147
|
+
### Skills
|
|
148
|
+
|
|
149
|
+
**Skills** are small, focused instruction files — one per TestDriver capability — that teach your AI client exactly how to use each part of the TestDriver SDK and MCP tools. They follow the [Anthropic `SKILL.md` format](https://code.claude.com/docs/en/skills): a folder per skill, each containing a `SKILL.md` with YAML frontmatter and a markdown body.
|
|
150
|
+
|
|
151
|
+
There are **106 skills**, generated directly from the TestDriver documentation, covering every action and concept: `find`, `click`, `type`, `assert`, `check`, `scroll`, `press-keys`, `provision`, caching, secrets, CI/CD, and more. They're written to the directory each client expects:
|
|
152
|
+
|
|
153
|
+
| Client | Skills location |
|
|
154
|
+
| --- | --- |
|
|
155
|
+
| Claude Code | `.claude/skills/<name>/SKILL.md` |
|
|
156
|
+
| Zed | `.agents/skills/<name>/SKILL.md` |
|
|
157
|
+
| Codex | referenced from `AGENTS.md` |
|
|
158
|
+
| VS Code · Cursor · Windsurf | folded into the agent rules/instructions |
|
|
159
|
+
|
|
160
|
+
<Note>
|
|
161
|
+
Skills are **generated, not hand-edited** — each is built from a `.mdx` docs page and carries a `DO NOT EDIT` marker. To change a skill, edit the corresponding documentation page and run `node docs/_scripts/generate-skills.js`.
|
|
162
|
+
</Note>
|
|
163
|
+
|
|
164
|
+
### MCP server
|
|
165
|
+
|
|
166
|
+
The **TestDriver MCP server** exposes TestDriver's computer-use tools — `session_start`, `find`, `click`, `type`, `assert`, `check`, `screenshot`, and more — over the [Model Context Protocol](https://modelcontextprotocol.io). It runs as a local stdio process:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npx -p testdriverai testdriverai-mcp
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
and authenticates with your `TD_API_KEY`. `testdriverai init` configures it for you, but you can also wire it up by hand:
|
|
173
|
+
|
|
174
|
+
| Client | Auto-install | MCP config file | Config key |
|
|
175
|
+
| --- | --- | --- | --- |
|
|
176
|
+
| Claude Code | ✅ | `.mcp.json` | `mcpServers` |
|
|
177
|
+
| Claude Desktop | ✅ | OS-specific | `mcpServers` |
|
|
178
|
+
| Cursor | ✅ | `.cursor/mcp.json` | `mcpServers` |
|
|
179
|
+
| VS Code (Copilot) | ✅ | `.vscode/mcp.json` | `servers` |
|
|
180
|
+
| Windsurf | ✅ | `~/.codeium/windsurf/mcp_config.json` | `mcpServers` |
|
|
181
|
+
| Codex | ✅ | `~/.codex/config.toml` | `[mcp_servers]` |
|
|
182
|
+
| Zed | ✅ | `.zed/settings.json` | `context_servers` |
|
|
183
|
+
| Lovable | ⚙️ partial | GitHub `AGENTS.md` + UI | — |
|
|
184
|
+
| Replit | ⚙️ partial | `replit.md` + UI | — |
|
|
185
|
+
| v0 (Vercel) | 📝 manual | web UI only | — |
|
|
186
|
+
|
|
187
|
+
<Note>
|
|
188
|
+
Each client uses a **different top-level key** for MCP servers. The most common mistake when configuring by hand is using `mcpServers` for VS Code (it wants `servers`), Codex (TOML `[mcp_servers]`), or Zed (`context_servers`).
|
|
189
|
+
</Note>
|
|
190
|
+
|
|
191
|
+
<Tabs>
|
|
192
|
+
<Tab title="Claude Code">
|
|
193
|
+
Add to `.mcp.json` at your project root (or `~/.claude.json` for all projects):
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"mcpServers": {
|
|
198
|
+
"testdriver": {
|
|
199
|
+
"type": "stdio",
|
|
200
|
+
"command": "npx",
|
|
201
|
+
"args": ["-p", "testdriverai", "testdriverai-mcp"],
|
|
202
|
+
"env": { "TD_API_KEY": "${TD_API_KEY}" }
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
</Tab>
|
|
208
|
+
|
|
209
|
+
<Tab title="Claude Desktop">
|
|
210
|
+
Edit the Claude Desktop config file:
|
|
211
|
+
|
|
212
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
213
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
214
|
+
- **Linux:** `~/.config/Claude/claude_desktop_config.json`
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"mcpServers": {
|
|
219
|
+
"testdriver": {
|
|
220
|
+
"command": "npx",
|
|
221
|
+
"args": ["-p", "testdriverai", "testdriverai-mcp"],
|
|
222
|
+
"env": { "TD_API_KEY": "your_api_key" }
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Restart Claude Desktop after saving.
|
|
229
|
+
</Tab>
|
|
230
|
+
|
|
231
|
+
<Tab title="Cursor">
|
|
232
|
+
Add to `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global):
|
|
233
|
+
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"mcpServers": {
|
|
237
|
+
"testdriver": {
|
|
238
|
+
"type": "stdio",
|
|
239
|
+
"command": "npx",
|
|
240
|
+
"args": ["-p", "testdriverai", "testdriverai-mcp"],
|
|
241
|
+
"env": { "TD_API_KEY": "${TD_API_KEY}" }
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
</Tab>
|
|
247
|
+
|
|
248
|
+
<Tab title="VS Code">
|
|
249
|
+
Add to `.vscode/mcp.json`. VS Code uses the `servers` key and an `inputs` prompt for secrets:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"servers": {
|
|
254
|
+
"testdriver": {
|
|
255
|
+
"type": "stdio",
|
|
256
|
+
"command": "npx",
|
|
257
|
+
"args": ["-p", "testdriverai", "testdriverai-mcp"],
|
|
258
|
+
"env": { "TD_API_KEY": "${input:testdriver-api-key}" }
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"inputs": [
|
|
262
|
+
{
|
|
263
|
+
"type": "promptString",
|
|
264
|
+
"id": "testdriver-api-key",
|
|
265
|
+
"description": "TestDriver API Key From https://console.testdriver.ai/team",
|
|
266
|
+
"password": true
|
|
267
|
+
}
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
</Tab>
|
|
272
|
+
|
|
273
|
+
<Tab title="Windsurf">
|
|
274
|
+
Windsurf reads MCP config globally. Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
275
|
+
|
|
276
|
+
```json
|
|
277
|
+
{
|
|
278
|
+
"mcpServers": {
|
|
279
|
+
"testdriver": {
|
|
280
|
+
"command": "npx",
|
|
281
|
+
"args": ["-p", "testdriverai", "testdriverai-mcp"],
|
|
282
|
+
"env": { "TD_API_KEY": "${TD_API_KEY}" }
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
</Tab>
|
|
288
|
+
|
|
289
|
+
<Tab title="Codex">
|
|
290
|
+
Codex uses TOML. Add to `~/.codex/config.toml`:
|
|
291
|
+
|
|
292
|
+
```toml
|
|
293
|
+
[mcp_servers.testdriver]
|
|
294
|
+
command = "npx"
|
|
295
|
+
args = ["-p", "testdriverai", "testdriverai-mcp"]
|
|
296
|
+
env = { TD_API_KEY = "${TD_API_KEY}" }
|
|
297
|
+
```
|
|
298
|
+
</Tab>
|
|
299
|
+
|
|
300
|
+
<Tab title="Zed">
|
|
301
|
+
Zed calls them "context servers". Add to `.zed/settings.json` (project) or `~/.config/zed/settings.json` (global):
|
|
302
|
+
|
|
303
|
+
```json
|
|
304
|
+
{
|
|
305
|
+
"context_servers": {
|
|
306
|
+
"testdriver": {
|
|
307
|
+
"command": "npx",
|
|
308
|
+
"args": ["-p", "testdriverai", "testdriverai-mcp"],
|
|
309
|
+
"env": { "TD_API_KEY": "${TD_API_KEY}" }
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
```
|
|
314
|
+
</Tab>
|
|
315
|
+
</Tabs>
|
|
316
|
+
|
|
317
|
+
**Web-based clients** — Lovable, Replit, and v0 run in the browser, so the MCP server can't be launched as a local process. Configure them through each product's UI:
|
|
318
|
+
|
|
319
|
+
<AccordionGroup>
|
|
320
|
+
<Accordion title="Lovable">
|
|
321
|
+
1. Connect your GitHub repo and run `npx testdriverai init --client lovable` — this writes `AGENTS.md` and the skills into the repo so Lovable's agent picks them up.
|
|
322
|
+
2. In Lovable, open **Settings → MCP** and add the TestDriver server.
|
|
323
|
+
</Accordion>
|
|
324
|
+
|
|
325
|
+
<Accordion title="Replit">
|
|
326
|
+
1. Run `npx testdriverai init --client replit` to write `replit.md` with the TestDriver agent guidance.
|
|
327
|
+
2. In Replit, open **Tools → Integrations → MCP** and add a custom MCP server.
|
|
328
|
+
</Accordion>
|
|
329
|
+
|
|
330
|
+
<Accordion title="v0 (Vercel)">
|
|
331
|
+
v0 is fully UI-driven and does not read repo files.
|
|
332
|
+
|
|
333
|
+
1. Open **[v0.app/chat/settings/mcp-connections](https://v0.app/chat/settings/mcp-connections)** and add the TestDriver MCP connection.
|
|
334
|
+
2. Paste the agent guidance into **Instructions** (the **+** in the prompt bar).
|
|
335
|
+
</Accordion>
|
|
336
|
+
</AccordionGroup>
|
|
337
|
+
|
|
338
|
+
### Verifying the install
|
|
339
|
+
|
|
340
|
+
Open your client's chat and ask the agent to write a test:
|
|
341
|
+
|
|
342
|
+
```text
|
|
343
|
+
@testdriver write a test that opens the homepage and asserts the title
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
If the MCP server is wired up correctly, the agent will start a session and you'll see screenshots come back as it works. If tools don't appear, check that `TD_API_KEY` is set and restart the client.
|
|
69
347
|
|
|
70
348
|
</Tab>
|
|
71
349
|
<Tab title="Manual" icon="wrench">
|
package/docs/v7/wait.mdx
CHANGED
|
@@ -49,4 +49,4 @@ await testdriver.wait();
|
|
|
49
49
|
const element = await testdriver.find('success message');
|
|
50
50
|
```
|
|
51
51
|
- Avoid excessively long timeouts to keep tests efficient.
|
|
52
|
-
- Use sparingly — TestDriver's [redraw detection](/v7/waiting-for-
|
|
52
|
+
- Use sparingly — TestDriver's [redraw detection](/v7/performing-actions#waiting-for-dynamic-content) automatically waits for screen and network stability after each action.
|
|
@@ -59,6 +59,8 @@ class InitCommand extends BaseCommand {
|
|
|
59
59
|
targetDir: process.cwd(),
|
|
60
60
|
apiKey: apiKey,
|
|
61
61
|
skipInstall: false,
|
|
62
|
+
// --no-sample-test sets flags["sample-test"] to false
|
|
63
|
+
skipSampleTest: flags["sample-test"] === false,
|
|
62
64
|
clients: clients && clients.length ? clients : undefined,
|
|
63
65
|
channel: channelConfig.active,
|
|
64
66
|
onProgress: printProgress,
|
package/lib/init-project.js
CHANGED
|
@@ -39,6 +39,7 @@ function runInstall(cmd, args, cwd, label) {
|
|
|
39
39
|
* @param {string} [options.targetDir] - Target directory (defaults to current working directory)
|
|
40
40
|
* @param {string} [options.apiKey] - TestDriver API key (will be saved to .env)
|
|
41
41
|
* @param {boolean} [options.skipInstall=false] - Skip npm install step
|
|
42
|
+
* @param {boolean} [options.skipSampleTest=false] - Skip scaffolding the example test files (tests/example.test.js + tests/login.js). The tests/ dir, config, workflow, etc. are still created.
|
|
42
43
|
* @param {boolean} [options.interactive=false] - Whether to prompt for missing values (CLI mode)
|
|
43
44
|
* @param {string[]} [options.clients] - AI client ids to wire up (e.g. ["claude-code","cursor"] or ["all"]). When set, native per-client config is written instead of the interactive add-mcp flow.
|
|
44
45
|
* @param {string} [options.channel] - Release channel (dev|test|canary|stable) the generated GitHub workflow should pin the action to. Defaults to the SDK's own active channel.
|
|
@@ -100,6 +101,11 @@ async function initProject(options = {}) {
|
|
|
100
101
|
fs.mkdirSync(testDir, { recursive: true });
|
|
101
102
|
}
|
|
102
103
|
|
|
104
|
+
// Sample test files (login snippet + example test). Skipped when the caller
|
|
105
|
+
// opts out (e.g. /eve, which scaffolds the project but writes its own tests).
|
|
106
|
+
if (options.skipSampleTest) {
|
|
107
|
+
progress("⊘ Skipped sample test files (tests/example.test.js, tests/login.js)");
|
|
108
|
+
} else {
|
|
103
109
|
// Create login snippet file
|
|
104
110
|
const loginSnippetFile = path.join(testDir, "login.js");
|
|
105
111
|
if (!fs.existsSync(loginSnippetFile)) {
|
|
@@ -176,6 +182,7 @@ test('should login and add item to cart', async (context) => {
|
|
|
176
182
|
fs.writeFileSync(testFile, vitestContent);
|
|
177
183
|
progress("✓ Created test file: tests/example.test.js");
|
|
178
184
|
}
|
|
185
|
+
}
|
|
179
186
|
|
|
180
187
|
// 3. Create vitest.config.js
|
|
181
188
|
const configFile = path.join(targetDir, "vitest.config.js");
|
|
@@ -1483,6 +1483,7 @@ API Key: The apiKey parameter is optional. If not provided, you'll need to manua
|
|
|
1483
1483
|
directory: z.string().optional().describe("Target directory (defaults to current working directory)"),
|
|
1484
1484
|
apiKey: z.string().optional().describe("TestDriver API key (will be saved to .env)"),
|
|
1485
1485
|
skipInstall: z.boolean().default(false).describe("Skip npm install step"),
|
|
1486
|
+
skipSampleTest: z.boolean().default(false).describe("Skip scaffolding the example test files (tests/example.test.js + tests/login.js). Useful when an agent writes its own tests."),
|
|
1486
1487
|
}),
|
|
1487
1488
|
}, async (params) => {
|
|
1488
1489
|
const startTime = Date.now();
|
|
@@ -1497,6 +1498,7 @@ API Key: The apiKey parameter is optional. If not provided, you'll need to manua
|
|
|
1497
1498
|
targetDir,
|
|
1498
1499
|
apiKey: params.apiKey,
|
|
1499
1500
|
skipInstall: params.skipInstall,
|
|
1501
|
+
skipSampleTest: params.skipSampleTest,
|
|
1500
1502
|
});
|
|
1501
1503
|
const duration = Date.now() - startTime;
|
|
1502
1504
|
logger.info("init: Completed", { targetDir, duration, success: result.success });
|
package/mcp-server/src/server.ts
CHANGED
|
@@ -1802,6 +1802,7 @@ API Key: The apiKey parameter is optional. If not provided, you'll need to manua
|
|
|
1802
1802
|
directory: z.string().optional().describe("Target directory (defaults to current working directory)"),
|
|
1803
1803
|
apiKey: z.string().optional().describe("TestDriver API key (will be saved to .env)"),
|
|
1804
1804
|
skipInstall: z.boolean().default(false).describe("Skip npm install step"),
|
|
1805
|
+
skipSampleTest: z.boolean().default(false).describe("Skip scaffolding the example test files (tests/example.test.js + tests/login.js). Useful when an agent writes its own tests."),
|
|
1805
1806
|
}),
|
|
1806
1807
|
},
|
|
1807
1808
|
async (params): Promise<CallToolResult> => {
|
|
@@ -1820,6 +1821,7 @@ API Key: The apiKey parameter is optional. If not provided, you'll need to manua
|
|
|
1820
1821
|
targetDir,
|
|
1821
1822
|
apiKey: params.apiKey,
|
|
1822
1823
|
skipInstall: params.skipInstall,
|
|
1824
|
+
skipSampleTest: params.skipSampleTest,
|
|
1823
1825
|
});
|
|
1824
1826
|
|
|
1825
1827
|
const duration = Date.now() - startTime;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testdriverai/mcp",
|
|
3
|
-
"version": "7.9.
|
|
3
|
+
"version": "7.9.151-test",
|
|
4
4
|
"description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
|
|
5
5
|
"main": "sdk.js",
|
|
6
6
|
"types": "sdk.d.ts",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"start": "node bin/testdriverai.js",
|
|
49
49
|
"dev": "DEV=true node bin/testdriverai.js",
|
|
50
50
|
"debug": "DEV=true VERBOSE=true node bin/testdriverai.js",
|
|
51
|
-
"docs": "npm run docs:skills && cd docs && npx mint@latest dev --port
|
|
52
|
-
"docs:dev": "cd docs && npx mint dev --port
|
|
51
|
+
"docs": "npm run docs:skills && cd docs && npx mint@latest dev --port 3003",
|
|
52
|
+
"docs:dev": "cd docs && npx mint dev --port 3003",
|
|
53
53
|
"docs:build": "npm run docs:skills && cd docs && npx mint@latest build",
|
|
54
54
|
"docs:links": "node docs/_scripts/link-replacer.js",
|
|
55
55
|
"docs:skills": "node docs/_scripts/generate-skills.js",
|
package/docs/v7/ai/agent.mdx
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Agent"
|
|
3
|
-
sidebarTitle: "Agent"
|
|
4
|
-
description: "The TestDriver test-creator agent that writes and debugs end-to-end tests for you"
|
|
5
|
-
icon: "robot"
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
The **TestDriver agent** is an expert test-creator that runs inside your AI client (Claude Code, Cursor, VS Code, and others). It writes, runs, and debugs real end-to-end tests by driving your app the same way a person would — using AI vision to find elements, click, type, and assert — through the [TestDriver MCP Server](/v7/ai/mcp).
|
|
11
|
-
|
|
12
|
-
Unlike a chat assistant that only suggests code, the agent works **iteratively against a live sandbox**: it starts a session, performs each action, writes the generated code to your test file, verifies the result with a screenshot, and reruns the test until it passes.
|
|
13
|
-
|
|
14
|
-
## What it does
|
|
15
|
-
|
|
16
|
-
- **Builds tests from scratch** using TestDriver [skills](/v7/ai/skills) and best practices.
|
|
17
|
-
- **Drives a live sandbox** via MCP tools (`session_start`, `find`, `click`, `type`, `assert`, `check`, …), getting a screenshot and generated code after every action.
|
|
18
|
-
- **Writes code immediately** to the test file after each successful step — never all at once at the end.
|
|
19
|
-
- **Verifies visually** with `check` to confirm each action did what was intended.
|
|
20
|
-
- **Runs the test itself** with `vitest run` and iterates until it passes reliably.
|
|
21
|
-
- **Shares the run report** — after each run it surfaces the `TESTDRIVER_RUN_URL` so you can watch the recording.
|
|
22
|
-
|
|
23
|
-
## Installation
|
|
24
|
-
|
|
25
|
-
The agent is installed automatically by `testdriverai init`, alongside the [skills](/v7/ai/skills) and the [MCP server](/v7/ai/mcp):
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npx testdriverai init
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
During init you'll be asked which AI client(s) to install into. The agent is written to the location each client expects:
|
|
32
|
-
|
|
33
|
-
| Client | Agent location |
|
|
34
|
-
| --- | --- |
|
|
35
|
-
| Claude Code | `.claude/agents/testdriver.md` |
|
|
36
|
-
| VS Code (Copilot) | `.github/agents/testdriver.agent.md` |
|
|
37
|
-
| Cursor | `.cursor/rules/testdriver.mdc` |
|
|
38
|
-
| Windsurf | `.windsurf/rules/testdriver.md` |
|
|
39
|
-
| Codex | `AGENTS.md` |
|
|
40
|
-
| Zed | `.rules` |
|
|
41
|
-
|
|
42
|
-
To install for a specific client without the interactive picker:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
npx testdriverai init --client claude-code
|
|
46
|
-
# or several at once
|
|
47
|
-
npx testdriverai init --client claude-code,cursor,vscode
|
|
48
|
-
# or everything
|
|
49
|
-
npx testdriverai init --client all
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
See the [MCP Server](/v7/ai/mcp) page for the full client matrix, including web-based clients (Lovable, Replit, v0) that require a few manual steps.
|
|
53
|
-
|
|
54
|
-
## Prerequisites
|
|
55
|
-
|
|
56
|
-
You need a TestDriver API key. Create one at [console.testdriver.ai/team](https://console.testdriver.ai/team) and `init` will save it to `.env` as `TD_API_KEY`.
|
|
57
|
-
|
|
58
|
-
## Using the agent
|
|
59
|
-
|
|
60
|
-
Once installed, invoke it from your client's chat:
|
|
61
|
-
|
|
62
|
-
```text
|
|
63
|
-
@testdriver write a test that logs in and verifies the dashboard loads
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
The agent will spin up a sandbox, perform the steps live, write them into a test file under `tests/`, and run it for you.
|
|
67
|
-
|
|
68
|
-
## Related
|
|
69
|
-
|
|
70
|
-
- [Skills](/v7/ai/skills) — the building blocks the agent composes tests from
|
|
71
|
-
- [MCP Server](/v7/ai/mcp) — the tools the agent uses to drive your app
|
|
72
|
-
- [Generating tests](/v7/generating-tests) — how test generation works end-to-end
|