@testdriverai/agent 7.11.229-canary → 7.11.231-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.
Files changed (100) hide show
  1. package/docs/_data/examples-manifest.json +16 -16
  2. package/docs/_scripts/generate-examples.js +38 -45
  3. package/docs/agent.mdx +174 -93
  4. package/docs/assert.mdx +73 -269
  5. package/docs/aws-setup.mdx +196 -314
  6. package/docs/bring-your-own-machine.mdx +139 -206
  7. package/docs/cache.mdx +144 -151
  8. package/docs/caching.mdx +99 -89
  9. package/docs/captcha.mdx +126 -111
  10. package/docs/ci-cd.mdx +154 -543
  11. package/docs/click.mdx +74 -229
  12. package/docs/client.mdx +177 -231
  13. package/docs/copilot/auto-healing.mdx +86 -370
  14. package/docs/copilot/running-tests.mdx +121 -930
  15. package/docs/customizing-devices.mdx +74 -251
  16. package/docs/dashcam.mdx +72 -405
  17. package/docs/debugging-with-screenshots.mdx +105 -371
  18. package/docs/docs.json +75 -18
  19. package/docs/double-click.mdx +48 -68
  20. package/docs/errors.mdx +102 -176
  21. package/docs/events.mdx +170 -327
  22. package/docs/examples/{hover-text-with-description.mdx → add-to-cart.mdx} +30 -35
  23. package/docs/examples/assert.mdx +28 -41
  24. package/docs/examples/click-button.mdx +71 -0
  25. package/docs/examples/{hover-image.mdx → click-icon.mdx} +32 -28
  26. package/docs/examples/element-not-found.mdx +27 -26
  27. package/docs/examples/findall-coffee-icons.mdx +28 -32
  28. package/docs/examples/installer.mdx +61 -25
  29. package/docs/examples/launch-vscode-linux.mdx +28 -51
  30. package/docs/examples/navigate-and-scroll.mdx +82 -0
  31. package/docs/examples/parse.mdx +24 -28
  32. package/docs/examples/press-keys.mdx +28 -25
  33. package/docs/examples/scroll.mdx +25 -27
  34. package/docs/examples/type.mdx +26 -21
  35. package/docs/exec.mdx +92 -256
  36. package/docs/extract.mdx +69 -170
  37. package/docs/find.mdx +140 -736
  38. package/docs/focus-application.mdx +69 -246
  39. package/docs/generating-tests.mdx +103 -137
  40. package/docs/guide/best-practices-polling.mdx +65 -141
  41. package/docs/hosted.mdx +80 -144
  42. package/docs/hover.mdx +62 -235
  43. package/docs/locating-elements.mdx +74 -369
  44. package/docs/making-assertions.mdx +116 -74
  45. package/docs/mcp-setup.mdx +80 -63
  46. package/docs/mouse-down.mdx +48 -125
  47. package/docs/mouse-up.mdx +47 -129
  48. package/docs/options.mdx +75 -48
  49. package/docs/parse.mdx +95 -184
  50. package/docs/performing-actions.mdx +104 -94
  51. package/docs/press-keys.mdx +59 -299
  52. package/docs/provision.mdx +137 -182
  53. package/docs/quickstart-claude.mdx +85 -0
  54. package/docs/quickstart-github.mdx +62 -32
  55. package/docs/quickstart-manual.mdx +60 -33
  56. package/docs/quickstart-vscode.mdx +97 -0
  57. package/docs/quickstart.mdx +25 -9
  58. package/docs/redraw.mdx +101 -165
  59. package/docs/reusable-code.mdx +97 -200
  60. package/docs/right-click.mdx +47 -89
  61. package/docs/screenshot.mdx +47 -201
  62. package/docs/screenshots.mdx +87 -137
  63. package/docs/scroll.mdx +71 -154
  64. package/docs/secrets.mdx +96 -91
  65. package/docs/self-hosted.mdx +83 -142
  66. package/docs/snippets/enterprise.mdx +15 -0
  67. package/docs/styles.css +68 -0
  68. package/docs/test-results-json.mdx +167 -204
  69. package/docs/type.mdx +56 -304
  70. package/docs/variables.mdx +121 -81
  71. package/docs/wait.mdx +33 -31
  72. package/docs/what-is-testdriver.mdx +80 -32
  73. package/examples/{hover-text-with-description.test.mjs → add-to-cart.test.mjs} +4 -5
  74. package/examples/assert.test.mjs +3 -20
  75. package/examples/{hover-text.test.mjs → click-button.test.mjs} +3 -4
  76. package/examples/{hover-image.test.mjs → click-icon.test.mjs} +5 -6
  77. package/examples/element-not-found.test.mjs +3 -5
  78. package/examples/findall-coffee-icons.test.mjs +3 -3
  79. package/examples/installer.test.mjs +1 -1
  80. package/examples/launch-vscode-linux.test.mjs +6 -33
  81. package/examples/{scroll-keyboard.test.mjs → navigate-and-scroll.test.mjs} +4 -5
  82. package/examples/parse.test.mjs +1 -2
  83. package/examples/press-keys.test.mjs +4 -4
  84. package/examples/scroll.test.mjs +3 -6
  85. package/examples/type.test.mjs +5 -2
  86. package/lib/provision.js +6 -2
  87. package/package.json +1 -1
  88. package/sdk.d.ts +4 -2
  89. package/sdk.js +1 -1
  90. package/docs/claude-mcp-plugin.mdx +0 -244
  91. package/docs/elements.mdx +0 -606
  92. package/docs/examples/ai.mdx +0 -78
  93. package/docs/examples/captcha-api.mdx +0 -92
  94. package/docs/examples/chrome-extension.mdx +0 -156
  95. package/docs/examples/drag-and-drop.mdx +0 -100
  96. package/docs/examples/formatted-logging.mdx +0 -74
  97. package/docs/examples/hover-text.mdx +0 -70
  98. package/docs/examples/match-image.mdx +0 -97
  99. package/docs/examples/scroll-keyboard.mdx +0 -80
  100. package/docs/examples/scroll-until-text.mdx +0 -109
@@ -1,244 +0,0 @@
1
- ---
2
- title: Using TestDriver with Claude Code (MCP)
3
- ---
4
-
5
- TestDriver ships as a native [Claude Code plugin](https://docs.claude.com/en/docs/claude-code/plugins) that bundles the **TestDriver MCP server**, the **`testdriver` expert sub-agent**, and all **TestDriver skills**. You get everything you need to drive TestDriver from Claude Code with a single install.
6
-
7
- > The plugin lives inside the `testdriverai` npm package at `ai/.claude-plugin/plugin.json`, and the marketplace entry lives at `.claude-plugin/marketplace.json` in this repo.
8
-
9
- ## 1. Get a TestDriver API key
10
-
11
- - Visit your team page (e.g. `https://console.testdriver.ai/settings`)
12
- - Create or copy a **Team API Key** (or User API Key)
13
- - Export it in your shell so Claude Code can pass it to the MCP server:
14
-
15
- ```bash
16
- export TD_API_KEY="your_api_key_here"
17
- ```
18
-
19
- ## 2. Install the plugin in Claude Code
20
-
21
- From inside Claude Code, add this repo as a plugin marketplace and install the `testdriver` plugin:
22
-
23
- ```text
24
- /plugin marketplace add testdriverai/testdriverai
25
- /plugin install testdriver@testdriver
26
- ```
27
-
28
- That registers three things:
29
-
30
- - **`testdriver` MCP server** — spawned via `npx -p testdriverai testdriverai-mcp`, with `TD_API_KEY` forwarded from your environment.
31
- - **`testdriver` sub-agent** — the TestDriver expert agent from `ai/agents/testdriver.md`. Invoke it with `@testdriver ...`.
32
- - **TestDriver skills** — every `ai/skills/testdriver-*` skill, auto-loaded by Claude Code.
33
-
34
- ## 3. Write tests with the agent
35
-
36
- In a Claude Code session, delegate to the agent:
37
-
38
- ```text
39
- @testdriver Write a test that signs into https://example.com and adds an item to the cart.
40
- ```
41
-
42
- The agent will use the TestDriver MCP tools (`session_start`, `find`, `click`, `type`, `assert`, …) to interactively build a Vitest test, append generated code to your test file after every action, and run it with `vitest run` until it passes.
43
-
44
- For the full agent guide, see the [`testdriver` agent definition](https://github.com/testdriverai/testdriverai/blob/main/ai/agents/testdriver.md) and the [MCP workflow skill](https://github.com/testdriverai/testdriverai/blob/main/ai/skills/testdriver-mcp-workflow/SKILL.md).
45
-
46
- ## Manual MCP configuration (no plugin)
47
-
48
- If you prefer not to use the plugin, you can register the MCP server manually in any MCP-compatible client (Claude Desktop, Cursor, VS Code, …):
49
-
50
- ```json
51
- {
52
- "mcpServers": {
53
- "testdriver": {
54
- "command": "npx",
55
- "args": ["-p", "testdriverai", "testdriverai-mcp"],
56
- "env": {
57
- "TD_API_KEY": "${TD_API_KEY}"
58
- }
59
- }
60
- }
61
- }
62
- ```
63
-
64
- This is the same config the plugin wires up for you — the plugin just bundles it alongside the agent and skills.
65
-
66
- ---
67
-
68
- ## Remote (hosted URL) install — no CLI, browser login
69
-
70
- TestDriver also runs a **hosted MCP server** you can connect to with just a URL. There is no `npx` command and no API key to paste: the server speaks OAuth 2.1, so your client opens a browser, you sign in with TestDriver, and the tools appear. It exposes the **full live tool set** (`session_start`, `find`, `click`, `type`, `assert`, …) plus the read-only data tools, all scoped to your team.
71
-
72
- Hosted endpoint:
73
-
74
- ```text
75
- https://mcp.testdriver.ai/mcp
76
- ```
77
-
78
- The server advertises its authorization server (Auth0) via [RFC 9728](https://www.rfc-editor.org/rfc/rfc9728) protected-resource metadata at:
79
-
80
- ```text
81
- https://mcp.testdriver.ai/.well-known/oauth-protected-resource
82
- ```
83
-
84
- Spec-compliant clients discover and complete the OAuth flow automatically:
85
-
86
- - **Claude** — add a custom connector pointing at the URL above; Claude runs the browser login for you.
87
- - **VS Code / Copilot** — add a remote MCP server entry with the URL; VS Code handles the OAuth handshake.
88
- - **ChatGPT** — add it as a connector by URL.
89
- - **Any spec-compliant client** — point it at the URL; it will read the metadata, sign you in, and connect.
90
-
91
- ```json
92
- {
93
- "mcpServers": {
94
- "testdriver": {
95
- "url": "https://mcp.testdriver.ai/mcp"
96
- }
97
- }
98
- }
99
- ```
100
-
101
- Each connection gets its own isolated sandbox, so multiple people (or multiple chats) can run tests at the same time without interfering. The API-key paths above still work for automation and CI.
102
-
103
- ---
104
-
105
- ## Observing test runs via HTTP MCP
106
-
107
- TestDriver also exposes **test results and analytics** over an HTTP MCP endpoint, so Claude Code (or any MCP-compatible client) can inspect your test runs, failures, and filters without provisioning a sandbox.
108
-
109
- ### HTTP MCP endpoint contract
110
-
111
- The HTTP endpoint lives at:
112
-
113
- ```text
114
- POST /api/v1/mcp
115
- ```
116
-
117
- It expects the TestDriver API key in the `X-Api-Key` header (or `Authorization: Bearer <key>`).
118
-
119
- Common request shapes:
120
-
121
- - **List tools**
122
-
123
- ```json
124
- {
125
- "kind": "list_tools"
126
- }
127
- ```
128
-
129
- - **Call a tool**
130
-
131
- ```json
132
- {
133
- "kind": "call_tool",
134
- "tool": "list_test_runs",
135
- "arguments": {
136
- "status": "failed",
137
- "page": 1,
138
- "limit": 20
139
- }
140
- }
141
- ```
142
-
143
- Responses from tool calls follow the MCP content convention:
144
-
145
- ```json
146
- {
147
- "content": [
148
- {
149
- "type": "json",
150
- "json": {
151
- "testRuns": [],
152
- "totalCount": 0,
153
- "hasMore": false
154
- }
155
- }
156
- ]
157
- }
158
- ```
159
-
160
- ### Available tools
161
-
162
- The MCP server advertises at least these tools in `list_tools`:
163
-
164
- - `list_test_runs`
165
- List recent TestDriver test runs for the current team, with filters and pagination.
166
-
167
- - `get_test_run_detail`
168
- Get a single test run and its test cases (including replay IDs / share keys when available).
169
-
170
- - `list_test_cases`
171
- List individual test cases for the team with status, duration, error messages, and replay info.
172
-
173
- - `get_filter_options`
174
- Get branch, suite, repo, filename, commit, status, platform, and test name options for building queries.
175
-
176
- ### Pointing Claude Code at the HTTP MCP endpoint
177
-
178
- You can point Claude Code at the HTTP MCP endpoint using a JSON configuration similar to:
179
-
180
- ```json
181
- {
182
- "$schema": "https://schema.anthropic.com/mcp/servers.json",
183
- "mcpServers": {
184
- "testdriver-cloud": {
185
- "type": "sse",
186
- "url": "https://your-api-host.example.com/api/v1/mcp",
187
- "requestHeaders": {
188
- "X-Api-Key": "${TD_API_KEY}"
189
- },
190
- "description": "Query TestDriver test runs, test cases, and filters for your team using an API key."
191
- }
192
- }
193
- }
194
- ```
195
-
196
- You can find this exact snippet in the repo at:
197
-
198
- - `claude-mcp-config.example.json`
199
-
200
- Replace `https://your-api-host.example.com` with your actual API origin (e.g. `https://api.testdriver.ai` or `http://localhost:1337` in development).
201
-
202
- ### Local development
203
-
204
- For local development:
205
-
206
- - Run your API server on `http://localhost:1337`
207
- - Point `baseUrl` at `http://localhost:1337/api/v1/mcp`
208
- - Use a local team or user API key in `TD_API_KEY`
209
-
210
- ```json
211
- {
212
- "mcpServers": {
213
- "testdriver-cloud-local": {
214
- "type": "sse",
215
- "url": "http://localhost:1337/api/v1/mcp",
216
- "requestHeaders": {
217
- "X-Api-Key": "${TD_API_KEY}"
218
- }
219
- }
220
- }
221
- }
222
- ```
223
-
224
- ### Skills documentation for Claude
225
-
226
- Claude Code loads the agent and skills automatically when you install the plugin (see step 2). The underlying sources are:
227
-
228
- - `ai/agents/testdriver.md` contains the **full TestDriver Agent Guide**
229
- - `ai/skills/testdriver-*/SKILL.md` provide task-specific skills (MCP workflow, assertions, provisioning, etc.)
230
-
231
- Use these as the primary reference for:
232
-
233
- - How to initialize the `TestDriver` SDK in Vitest
234
- - The MCP workflow for building tests interactively with visual feedback
235
- - How to find elements, click, type, scroll, assert, and capture screenshots
236
-
237
- The MCP tools described above are **read-only** helpers for:
238
-
239
- - Inspecting recent test runs and failures
240
- - Discovering branches, files, and suites to focus on
241
- - Pulling detailed test case and replay information into Claude for analysis
242
-
243
- Use the SDK (`testdriverai`) for **driving tests**, and the HTTP MCP server (`/api/v1/mcp`) for **observing and debugging** them from Claude Code.
244
-