@testdriverai/mcp 7.10.0-canary.0 → 7.10.1-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 (196) hide show
  1. package/.claude-plugin/marketplace.json +17 -0
  2. package/agent/index.js +116 -71
  3. package/agent/interface.js +13 -1
  4. package/agent/lib/commands.js +35 -15
  5. package/agent/lib/provision-commands.js +92 -11
  6. package/agent/lib/sandbox.js +263 -30
  7. package/agent/lib/sdk.js +16 -12
  8. package/agent/lib/system.js +107 -31
  9. package/ai/.claude-plugin/plugin.json +89 -4
  10. package/ai/agents/testdriver.md +4 -8
  11. package/ai/skills/testdriver-assert/SKILL.md +0 -1
  12. package/ai/skills/testdriver-aws-setup/SKILL.md +1 -1
  13. package/ai/skills/testdriver-caching/SKILL.md +13 -6
  14. package/ai/skills/testdriver-ci-cd/SKILL.md +57 -14
  15. package/ai/skills/testdriver-client/SKILL.md +10 -6
  16. package/ai/skills/testdriver-customizing-devices/SKILL.md +7 -5
  17. package/ai/skills/testdriver-dashcam/SKILL.md +36 -3
  18. package/ai/skills/testdriver-debugging-with-screenshots/SKILL.md +28 -4
  19. package/ai/skills/testdriver-device-config/SKILL.md +5 -5
  20. package/ai/skills/testdriver-find/SKILL.md +50 -11
  21. package/ai/skills/testdriver-generating-tests/SKILL.md +163 -8
  22. package/ai/skills/testdriver-hosted/SKILL.md +1 -1
  23. package/ai/skills/testdriver-machine-setup/SKILL.md +331 -0
  24. package/ai/skills/testdriver-making-assertions/SKILL.md +78 -2
  25. package/ai/skills/testdriver-mcp-workflow/SKILL.md +2 -2
  26. package/ai/skills/testdriver-parse/SKILL.md +1 -1
  27. package/ai/skills/testdriver-performing-actions/SKILL.md +97 -3
  28. package/ai/skills/testdriver-provision/SKILL.md +0 -20
  29. package/ai/skills/testdriver-quickstart/SKILL.md +299 -21
  30. package/ai/skills/testdriver-reusable-code/SKILL.md +3 -3
  31. package/ai/skills/testdriver-running-tests/SKILL.md +1 -1
  32. package/ai/skills/testdriver-screenshot/SKILL.md +5 -5
  33. package/ai/skills/testdriver-scroll/SKILL.md +30 -160
  34. package/ai/skills/testdriver-test-writer/SKILL.md +3 -5
  35. package/ai/skills/testdriver-testdriver/SKILL.md +3 -7
  36. package/ai/skills/testdriver-wait/SKILL.md +1 -1
  37. package/{docs/v7/ai.mdx → ai/skills/testdriver:ai/SKILL.md} +3 -4
  38. package/ai/skills/testdriver:assert/SKILL.md +315 -0
  39. package/ai/skills/testdriver:aws-setup/SKILL.md +448 -0
  40. package/ai/skills/testdriver:cache/SKILL.md +221 -0
  41. package/ai/skills/testdriver:caching/SKILL.md +124 -0
  42. package/ai/skills/testdriver:captcha/SKILL.md +158 -0
  43. package/ai/skills/testdriver:ci-cd/SKILL.md +659 -0
  44. package/ai/skills/testdriver:click/SKILL.md +286 -0
  45. package/ai/skills/testdriver:client/SKILL.md +477 -0
  46. package/ai/skills/testdriver:customizing-devices/SKILL.md +319 -0
  47. package/ai/skills/testdriver:dashcam/SKILL.md +451 -0
  48. package/ai/skills/testdriver:debugging-with-screenshots/SKILL.md +415 -0
  49. package/{docs/v7/device-config.mdx → ai/skills/testdriver:device-config/SKILL.md} +8 -8
  50. package/ai/skills/testdriver:double-click/SKILL.md +102 -0
  51. package/ai/skills/testdriver:elements/SKILL.md +605 -0
  52. package/ai/skills/testdriver:enterprise/SKILL.md +7 -0
  53. package/ai/skills/testdriver:errors/SKILL.md +246 -0
  54. package/ai/skills/testdriver:events/SKILL.md +356 -0
  55. package/ai/skills/testdriver:exec/SKILL.md +317 -0
  56. package/ai/skills/testdriver:find/SKILL.md +860 -0
  57. package/ai/skills/testdriver:focus-application/SKILL.md +293 -0
  58. package/ai/skills/testdriver:generating-tests/SKILL.md +25 -0
  59. package/ai/skills/testdriver:hosted/SKILL.md +156 -0
  60. package/ai/skills/testdriver:hover/SKILL.md +278 -0
  61. package/{docs/v7/locating-elements.mdx → ai/skills/testdriver:locating-elements/SKILL.md} +3 -3
  62. package/ai/skills/testdriver:making-assertions/SKILL.md +32 -0
  63. package/ai/skills/testdriver:mcp/SKILL.md +7 -0
  64. package/ai/skills/testdriver:mouse-down/SKILL.md +161 -0
  65. package/ai/skills/testdriver:mouse-up/SKILL.md +164 -0
  66. package/ai/skills/testdriver:parse/SKILL.md +236 -0
  67. package/ai/skills/testdriver:performing-actions/SKILL.md +53 -0
  68. package/ai/skills/testdriver:press-keys/SKILL.md +348 -0
  69. package/ai/skills/testdriver:provision/SKILL.md +331 -0
  70. package/ai/skills/testdriver:quickstart/SKILL.md +172 -0
  71. package/ai/skills/testdriver:redraw/SKILL.md +214 -0
  72. package/ai/skills/testdriver:reusable-code/SKILL.md +249 -0
  73. package/ai/skills/testdriver:right-click/SKILL.md +123 -0
  74. package/{docs/v7/running-tests.mdx → ai/skills/testdriver:running-tests/SKILL.md} +4 -4
  75. package/ai/skills/testdriver:screenshot/SKILL.md +248 -0
  76. package/ai/skills/testdriver:screenshots/SKILL.md +184 -0
  77. package/ai/skills/testdriver:scroll/SKILL.md +205 -0
  78. package/ai/skills/testdriver:secrets/SKILL.md +115 -0
  79. package/ai/skills/testdriver:self-hosted/SKILL.md +147 -0
  80. package/ai/skills/testdriver:test-results-json/SKILL.md +257 -0
  81. package/ai/skills/testdriver:testdriver/SKILL.md +624 -0
  82. package/ai/skills/testdriver:type/SKILL.md +357 -0
  83. package/ai/skills/testdriver:variables/SKILL.md +111 -0
  84. package/ai/skills/testdriver:wait/SKILL.md +50 -0
  85. package/{docs/v7/waiting-for-elements.mdx → ai/skills/testdriver:waiting-for-elements/SKILL.md} +3 -3
  86. package/ai/skills/testdriver:what-is-testdriver/SKILL.md +54 -0
  87. package/debugger/index.html +12 -0
  88. package/docs/_data/examples-manifest.json +54 -46
  89. package/docs/_data/examples-manifest.schema.json +12 -2
  90. package/docs/_scripts/extract-example-urls.js +21 -3
  91. package/docs/_scripts/generate-examples.js +64 -16
  92. package/docs/changelog.mdx +29 -2
  93. package/docs/claude-mcp-plugin.mdx +65 -18
  94. package/docs/docs.json +16 -33
  95. package/docs/snippets/tests/scroll-yaml.mdx +2 -2
  96. package/docs/v6/commands/scroll-until-image.mdx +1 -1
  97. package/docs/v6/commands/scroll-until-text.mdx +2 -2
  98. package/docs/v6/commands/scroll.mdx +2 -2
  99. package/docs/v7/_drafts/agents.mdx +0 -4
  100. package/docs/v7/_drafts/best-practices.mdx +0 -12
  101. package/docs/v7/_drafts/commands/scroll-until-image.mdx +1 -1
  102. package/docs/v7/_drafts/commands/scroll-until-text.mdx +2 -2
  103. package/docs/v7/_drafts/commands/scroll.mdx +1 -1
  104. package/docs/v7/_drafts/configuration.mdx +0 -12
  105. package/docs/v7/_drafts/faq.mdx +2 -10
  106. package/docs/v7/_drafts/readme.mdx +0 -1
  107. package/docs/v7/_drafts/troubleshooting.mdx +1 -4
  108. package/docs/v7/assert.mdx +0 -1
  109. package/docs/v7/aws-setup.mdx +1 -1
  110. package/docs/v7/caching.mdx +14 -10
  111. package/docs/v7/ci-cd.mdx +98 -14
  112. package/docs/v7/client.mdx +10 -6
  113. package/docs/v7/copilot/auto-healing.mdx +167 -18
  114. package/docs/v7/copilot/running-tests.mdx +915 -54
  115. package/docs/v7/customizing-devices.mdx +7 -5
  116. package/docs/v7/dashcam.mdx +36 -3
  117. package/docs/v7/debugging-with-screenshots.mdx +31 -7
  118. package/docs/v7/examples/ai.mdx +13 -8
  119. package/docs/v7/examples/assert.mdx +1 -1
  120. package/docs/v7/examples/chrome-extension.mdx +30 -13
  121. package/docs/v7/examples/element-not-found.mdx +1 -1
  122. package/docs/v7/examples/findall-coffee-icons.mdx +3 -2
  123. package/docs/v7/examples/formatted-logging.mdx +74 -0
  124. package/docs/v7/examples/hover-image.mdx +1 -1
  125. package/docs/v7/examples/hover-text-with-description.mdx +2 -2
  126. package/docs/v7/examples/hover-text.mdx +1 -1
  127. package/docs/v7/examples/installer.mdx +1 -1
  128. package/docs/v7/examples/launch-vscode-linux.mdx +27 -27
  129. package/docs/v7/examples/match-image.mdx +1 -1
  130. package/docs/v7/examples/parse.mdx +3 -2
  131. package/docs/v7/examples/press-keys.mdx +2 -2
  132. package/docs/v7/examples/scroll-keyboard.mdx +2 -2
  133. package/docs/v7/examples/scroll-until-text.mdx +1 -1
  134. package/docs/v7/examples/scroll.mdx +1 -1
  135. package/docs/v7/examples/type.mdx +1 -1
  136. package/docs/v7/find.mdx +50 -11
  137. package/docs/v7/generating-tests.mdx +166 -10
  138. package/docs/v7/hosted.mdx +1 -1
  139. package/docs/v7/making-assertions.mdx +81 -4
  140. package/docs/v7/parse.mdx +1 -1
  141. package/docs/v7/performing-actions.mdx +100 -5
  142. package/docs/v7/provision.mdx +0 -20
  143. package/docs/v7/quickstart.mdx +299 -21
  144. package/docs/v7/reusable-code.mdx +3 -3
  145. package/docs/v7/screenshot.mdx +5 -5
  146. package/docs/v7/scroll.mdx +30 -160
  147. package/docs/v7/wait.mdx +1 -1
  148. package/examples/chrome-extension.test.mjs +29 -12
  149. package/examples/config.mjs +1 -1
  150. package/examples/launch-vscode-linux.test.mjs +25 -25
  151. package/interfaces/cli/commands/init.js +84 -2
  152. package/interfaces/vitest-plugin.mjs +51 -61
  153. package/lib/core/Dashcam.js +43 -2
  154. package/lib/core/index.d.ts +13 -1
  155. package/lib/github-comment.mjs +11 -5
  156. package/lib/init-project.js +98 -44
  157. package/lib/install-clients.js +470 -0
  158. package/lib/provision.js +749 -0
  159. package/lib/resolve-channel.js +2 -2
  160. package/lib/sentry.js +15 -2
  161. package/lib/vitest/hooks.mjs +44 -34
  162. package/mcp-server/README.md +32 -0
  163. package/mcp-server/dist/core/actions.d.ts +176 -0
  164. package/mcp-server/dist/core/actions.js +753 -0
  165. package/mcp-server/dist/env-utils.d.ts +45 -0
  166. package/mcp-server/dist/env-utils.js +63 -0
  167. package/mcp-server/dist/provision-types.d.ts +6 -2
  168. package/mcp-server/dist/provision-types.js +3 -1
  169. package/mcp-server/dist/server.mjs +449 -751
  170. package/mcp-server/package-lock.json +384 -1
  171. package/mcp-server/package.json +5 -2
  172. package/mcp-server/src/core/actions.ts +912 -0
  173. package/mcp-server/src/env-utils.test.ts +82 -0
  174. package/mcp-server/src/env-utils.ts +77 -0
  175. package/mcp-server/src/provision-types.ts +4 -1
  176. package/mcp-server/src/server.ts +533 -954
  177. package/mcp-server/tsconfig.json +1 -1
  178. package/mcp-server/vitest.config.ts +7 -0
  179. package/package.json +15 -3
  180. package/sdk.d.ts +11 -9
  181. package/sdk.js +116 -746
  182. package/setup/aws/spawn-runner.sh +24 -3
  183. package/docs/v7/_drafts/caching-ai.mdx +0 -215
  184. package/docs/v7/_drafts/caching.mdx +0 -366
  185. package/docs/v7/_drafts/prompt-cache.mdx +0 -200
  186. package/docs/v7/copilot/creating-tests.mdx +0 -156
  187. package/docs/v7/copilot/github.mdx +0 -143
  188. package/docs/v7/copilot/setup.mdx +0 -143
  189. package/docs/v7/examples/exec-output.mdx +0 -84
  190. package/docs/v7/examples/exec-pwsh.mdx +0 -82
  191. package/docs/v7/examples/focus-window.mdx +0 -61
  192. package/docs/v7/examples/scroll-until-image.mdx +0 -82
  193. package/docs/v7/examples/windows-installer.mdx +0 -95
  194. package/examples/formatted-logging.test.mjs +0 -27
  195. package/examples/match-image.test.mjs +0 -55
  196. package/manual/exec-stream-logs.test.mjs +0 -25
@@ -1,200 +0,0 @@
1
- # Prompt Cache System
2
-
3
- ## Overview
4
-
5
- The TestDriver SDK includes automatic caching of `.ai()` responses. When you use the SDK to execute natural language prompts, the YAML commands generated by the AI are cached locally to improve performance and reduce API calls.
6
-
7
- **Caching is enabled by default** and can be controlled per-call using the `cache` parameter.
8
-
9
- ## How It Works
10
-
11
- 1. **First Call**: When you call `.ai('click the submit button')` for the first time:
12
-
13
- - The SDK sends the prompt and screenshot to the API
14
- - The API returns YAML commands in markdown format
15
- - The response is cached to `.testdriver/.cache/{prompt-hash}.yaml`
16
-
17
- 2. **Subsequent Calls**: When you call `.ai('click the submit button')` again:
18
-
19
- - The SDK checks the cache first
20
- - If found, it uses the cached YAML instead of calling the API
21
- - You'll see `(using cached response)` in the output
22
-
23
- 3. **Disable Caching**: Pass `false` as the second parameter:
24
- - `.ai('click the submit button', false)` bypasses the cache
25
- - Forces a fresh API call and updates the cache
26
-
27
- ## Cache Location
28
-
29
- Cached responses are stored in:
30
-
31
- ```
32
- .testdriver/.cache/
33
- ```
34
-
35
- Files are named using a combination of:
36
-
37
- - Sanitized prompt (first 50 chars, alphanumeric only)
38
- - MD5 hash of the full prompt for uniqueness
39
-
40
- Example:
41
-
42
- ```
43
- .testdriver/.cache/click-the-submit-button-a1b2c3d4e5f6.yaml
44
- ```
45
-
46
- ## Benefits
47
-
48
- - **Faster execution**: No API call needed for repeated prompts
49
- - **Cost savings**: Reduces API usage for repeated operations
50
- - **Offline testing**: Can rerun tests without network access
51
- - **Deterministic tests**: Same prompt always produces same commands
52
-
53
- ## Disabling Cache
54
-
55
- To disable caching for a specific `.ai()` call, pass `false` as the second parameter:
56
-
57
- ```javascript
58
- // Force fresh API call, bypass cache
59
- await client.ai("click the submit button", false);
60
- ```
61
-
62
- Caching is **enabled by default** (equivalent to passing `true`):
63
-
64
- ```javascript
65
- // These are equivalent
66
- await client.ai("click the submit button");
67
- await client.ai("click the submit button", true);
68
- ```
69
-
70
- ## Clearing Cache
71
-
72
- To clear all cached prompts:
73
-
74
- ```bash
75
- rm -rf .testdriver/.cache/*.yaml
76
- ```
77
-
78
- Or programmatically:
79
-
80
- ```javascript
81
- const promptCache = require("testdriverai/agent/lib/cache.js");
82
- promptCache.clearCache();
83
- ```
84
-
85
- ## Usage Examples
86
-
87
- ### Basic Usage (Automatic Caching)
88
-
89
- ```javascript
90
- const TestDriver = require("testdriverai");
91
-
92
- const client = new TestDriver(process.env.TD_API_KEY);
93
- await client.connect();
94
-
95
- // First call - makes API request and caches
96
- await client.ai("click the login button");
97
-
98
- // Second call - uses cache (instant)
99
- await client.ai("click the login button");
100
-
101
- // Force fresh API call, bypass cache
102
- await client.ai("click the login button", false);
103
- ```
104
-
105
- ### Check Cache Status
106
-
107
- ```javascript
108
- const promptCache = require("testdriverai/agent/lib/cache.js");
109
-
110
- // Check if a prompt is cached
111
- if (promptCache.hasCache("click the login button")) {
112
- console.log("This prompt is cached");
113
- }
114
-
115
- // Get cache statistics
116
- const stats = promptCache.getCacheStats();
117
- console.log(`Cached prompts: ${stats.count}`);
118
- console.log(`Files: ${stats.files}`);
119
- ```
120
-
121
- ### Read Cached YAML
122
-
123
- ```javascript
124
- const promptCache = require("testdriverai/agent/lib/cache.js");
125
-
126
- const yaml = promptCache.readCache("click the login button");
127
- if (yaml) {
128
- console.log("Cached YAML:", yaml);
129
- }
130
- ```
131
-
132
- ### Manual Cache Control
133
-
134
- ```javascript
135
- const promptCache = require("testdriverai/agent/lib/cache.js");
136
-
137
- // Write to cache manually
138
- promptCache.writeCache("custom prompt", yamlContent);
139
-
140
- // Clear entire cache
141
- promptCache.clearCache();
142
-
143
- // Get cache path for a prompt
144
- const path = promptCache.getCachePath("my prompt");
145
- console.log(`Cache file: ${path}`);
146
- ```
147
-
148
- ## Important Notes
149
-
150
- 1. **Prompt Matching**: Cache keys are based on the exact prompt text (case-insensitive, trimmed)
151
-
152
- - `'Click the button'` and `'click the button'` will match
153
- - `'Click the button'` and `'Click the button '` will match (trailing space trimmed)
154
- - `'Click button'` and `'Click the button'` will NOT match
155
-
156
- 2. **No Screenshot Comparison**: The cache does NOT compare screenshots
157
-
158
- - Cached responses assume the UI state is similar
159
- - Use different prompts if the UI state has changed significantly
160
-
161
- 3. **Manual Cache Management**: The cache never expires automatically
162
-
163
- - Clear it periodically if needed
164
- - Delete specific files if a prompt's behavior should change
165
-
166
- 4. **Version Compatibility**: Cache files are plain YAML
167
- - Compatible across TestDriver versions
168
- - Safe to commit to version control (though not recommended)
169
-
170
- ## Testing
171
-
172
- Run the test suite to verify caching:
173
-
174
- ```bash
175
- node test-prompt-cache.js
176
- ```
177
-
178
- This will:
179
-
180
- - Make an initial `.ai()` call that caches the response
181
- - Make a second `.ai()` call that uses the cache
182
- - Show cache statistics and file locations
183
-
184
- ## Troubleshooting
185
-
186
- ### Cache not being used
187
-
188
- - Check that prompts match exactly (case-insensitive)
189
- - Verify `TD_NO_PROMPT_CACHE` is not set
190
- - Check `.testdriver/.cache/` directory exists and is writable
191
-
192
- ### Stale cache data
193
-
194
- - Clear the cache directory
195
- - Or delete specific cached prompt files
196
-
197
- ### Permission errors
198
-
199
- - Ensure `.testdriver/.cache/` is writable
200
- - Check file system permissions
@@ -1,156 +0,0 @@
1
- ---
2
- title: "Creating Tests"
3
- sidebarTitle: "Creating Tests"
4
- description: "Use the TestDriver agent and MCP to create tests through natural language"
5
- icon: "wand-magic-sparkles"
6
- ---
7
-
8
- With GitHub Copilot and TestDriver's MCP server, you can create tests by chatting with an AI agent. The agent spawns a virtual machine, executes actions, and writes test code for you.
9
-
10
- ## Start a Conversation
11
-
12
- Open GitHub Copilot Chat in VS Code. If your project has no other agents configured, the TestDriver agent is used by default. Otherwise, select **testdriver** from the agent dropdown in the chat panel.
13
-
14
- Describe what you want to test:
15
-
16
- ```
17
- Create a test that logs into my app at https://myapp.com
18
- ```
19
-
20
- The agent will:
21
- 1. Start a new session and spawn a Linux virtual machine
22
- 2. Launch Chrome and navigate to your URL
23
- 3. Execute actions based on your instructions
24
- 4. Write the test code to a `.test.mjs` file
25
-
26
- <Note>
27
- The TestDriver agent appears in the agent selection dropdown if you have other agents configured (like `copilot-instructions.md` or other `.agent.md` files). Make sure to select **testdriver** to use TestDriver's MCP tools.
28
- </Note>
29
-
30
- ## Live Preview Panel
31
-
32
- When the agent starts a session, a **live preview panel** opens in VS Code. This lets you:
33
-
34
- - **Watch tests execute** in real-time
35
- - **Interact with the VM** — click, type, and navigate manually
36
- - **Debug issues** — see exactly what the AI sees
37
-
38
- <Note>
39
- The live preview panel requires the TestDriver VS Code extension. Set `TD_PREVIEW=ide` in your MCP configuration to enable it. See the [device configuration docs](/v7/device-config) for all preview options.
40
- </Note>
41
-
42
- ## Interactive Workflow
43
-
44
- The recommended workflow for creating tests:
45
-
46
- <Steps>
47
- <Step title="Describe Your Test">
48
- Tell the agent what you want to test:
49
-
50
- ```
51
- Test the checkout flow on https://shop.example.com
52
- ```
53
- </Step>
54
-
55
- <Step title="Watch and Guide">
56
- The agent will start executing. Watch the preview panel and provide guidance if needed:
57
-
58
- ```
59
- The login modal appeared. Use test@example.com and password123
60
- ```
61
- </Step>
62
-
63
- <Step title="Add Assertions">
64
- Ask the agent to verify specific conditions:
65
-
66
- ```
67
- Assert that the order confirmation page is shown with the order number
68
- ```
69
- </Step>
70
-
71
- <Step title="Review the Code">
72
- The agent writes test code as it works. Review the generated `.test.mjs` file and make any adjustments.
73
- </Step>
74
- </Steps>
75
-
76
- ## Example Conversation
77
-
78
- Here's a complete example of creating a login test:
79
-
80
- ```
81
- You: Create a test for the login flow at https://console.testdriver.ai
82
-
83
- Agent: I'll create a test for the login flow. Starting a session...
84
- [Screenshot: Login page loaded]
85
-
86
- I can see the login page. Let me find the email input.
87
- [Screenshot: Email input highlighted]
88
-
89
- Now I'll type the email and find the password field...
90
-
91
- You: Use test@example.com for the email
92
-
93
- Agent: Got it. Typing test@example.com...
94
- [Screenshot: Email entered]
95
-
96
- Now entering the password and clicking Sign In...
97
- [Screenshot: Dashboard loaded]
98
-
99
- ✅ Login successful! I've written the test to tests/login.test.mjs
100
- ```
101
-
102
- ## Generated Test Code
103
-
104
- The agent generates standard Vitest test files:
105
-
106
- ```javascript tests/login.test.mjs
107
- import { describe, expect, it } from "vitest";
108
- import { TestDriver } from "testdriverai/vitest/hooks";
109
-
110
- describe("Login Flow", () => {
111
- it("should log in successfully", async (context) => {
112
- const testdriver = TestDriver(context);
113
-
114
- await testdriver.provision.chrome({
115
- url: "https://console.testdriver.ai"
116
- });
117
-
118
- const emailInput = await testdriver.find("email input field");
119
- await emailInput.click();
120
- await testdriver.type("test@example.com");
121
-
122
- const passwordInput = await testdriver.find("password input field");
123
- await passwordInput.click();
124
- await testdriver.type("password123");
125
-
126
- const signInButton = await testdriver.find("Sign In button");
127
- await signInButton.click();
128
-
129
- const result = await testdriver.assert("dashboard is visible");
130
- expect(result).toBeTruthy();
131
- });
132
- });
133
- ```
134
-
135
- ## Tips for Better Tests
136
-
137
- <AccordionGroup>
138
- <Accordion title="Be specific with element descriptions">
139
- Instead of "click the button", say "click the blue Sign In button in the header". More context helps the AI find the right element.
140
- </Accordion>
141
- <Accordion title="Add waits for dynamic content">
142
- If your app has animations or loading states, tell the agent to wait:
143
- ```
144
- Wait for the loading spinner to disappear before continuing
145
- ```
146
- </Accordion>
147
- <Accordion title="Use assertions liberally">
148
- Add assertions after each major action to catch regressions early:
149
- ```
150
- Assert that the product was added to the cart
151
- ```
152
- </Accordion>
153
- <Accordion title="Break complex flows into steps">
154
- For long workflows, create the test incrementally and verify each step works before moving on.
155
- </Accordion>
156
- </AccordionGroup>
@@ -1,143 +0,0 @@
1
- ---
2
- title: "GitHub Integration"
3
- sidebarTitle: "GitHub"
4
- description: "Use TestDriver from GitHub's web interface and mobile app"
5
- icon: "github"
6
- ---
7
-
8
- TestDriver works directly in GitHub's web interface and mobile app. The same MCP server that powers VS Code integration also works in GitHub, letting you create and manage tests from anywhere.
9
-
10
- ## How It Works
11
-
12
- When you add a TestDriver agent file to your repository at `.github/agents/testdriver.agent.md`, GitHub Copilot can use TestDriver's MCP tools directly in:
13
-
14
- - GitHub.com (web browser)
15
- - GitHub Mobile app (iOS/Android)
16
- - Pull request conversations
17
- - Issue comments
18
-
19
- ## Using TestDriver in GitHub Web
20
-
21
- <Steps>
22
- <Step title="Navigate to Your Repository">
23
- Open your repository on GitHub.com. Make sure you have the TestDriver agent file at `.github/agents/testdriver.agent.md`.
24
- </Step>
25
-
26
- <Step title="Start a Copilot Chat">
27
- Click the **Copilot icon** in the GitHub interface to open a chat. You can find this in:
28
- - The repository's Code tab
29
- - Pull request pages
30
- - Issue pages
31
- </Step>
32
-
33
- <Step title="Invoke the TestDriver Agent">
34
- Start your message with `@testdriver`:
35
-
36
- ```
37
- @testdriver Create a test that verifies the homepage loads correctly at https://myapp.com
38
- ```
39
-
40
- The agent will spawn a sandbox environment and begin executing, just like in VS Code.
41
- </Step>
42
-
43
- <Step title="View Screenshots in Chat">
44
- As the test runs, screenshots appear directly in the chat. You can see what the AI sees and provide guidance if needed.
45
- </Step>
46
- </Steps>
47
-
48
- ## Creating Tests from PR Comments
49
-
50
- You can create tests directly from pull request reviews. Comment on a PR and mention Copilot:
51
-
52
- ```
53
- @copilot create a TestDriver test that verifies this new feature works.
54
- Test the checkout flow with a guest user.
55
- ```
56
-
57
- Copilot will:
58
- 1. Use the TestDriver MCP server
59
- 2. Create a test based on your description
60
- 3. Commit the test file to the PR branch
61
-
62
- This is useful for:
63
- - Adding test coverage during code review
64
- - Verifying bug fixes before merging
65
- - Creating regression tests for new features
66
-
67
- ## Creating Tests from Issues
68
-
69
- You can also create tests from issue comments:
70
-
71
- ```
72
- @copilot Use TestDriver to create a test that reproduces this bug.
73
- Navigate to /settings, change the theme, and verify it persists after refresh.
74
- ```
75
-
76
- The test will be created in a new branch and linked to the issue.
77
-
78
- ## Mobile App Support
79
-
80
- The GitHub Mobile app supports Copilot chat, which means you can use TestDriver from your phone:
81
-
82
- 1. Open the GitHub app
83
- 2. Navigate to your repository
84
- 3. Tap the Copilot icon
85
- 4. Type `@testdriver` followed by your request
86
-
87
- Screenshots and test progress appear in the chat, letting you create and debug tests on the go.
88
-
89
- ## Example: PR Review Workflow
90
-
91
- Here's a complete workflow for adding tests during code review:
92
-
93
- <Steps>
94
- <Step title="Developer Opens PR">
95
- A developer opens a pull request with a new feature.
96
- </Step>
97
-
98
- <Step title="Reviewer Requests Tests">
99
- The reviewer comments:
100
- ```
101
- @copilot Create a TestDriver test for this user registration flow.
102
- Test both successful registration and validation errors.
103
- ```
104
- </Step>
105
-
106
- <Step title="Copilot Creates Tests">
107
- Copilot spawns TestDriver, creates the tests, and commits them to the PR branch.
108
- </Step>
109
-
110
- <Step title="Tests Run in CI">
111
- The new tests run automatically in CI, validating the feature works as expected.
112
- </Step>
113
- </Steps>
114
-
115
- ## Agent File Reference
116
-
117
- The agent file at `.github/agents/testdriver.agent.md` contains the configuration for GitHub Copilot to use TestDriver. Here's the structure:
118
-
119
- ```yaml
120
- ---
121
- name: testdriver
122
- description: An expert at creating and refining automated tests using TestDriver.ai
123
- mcp-servers:
124
- testdriver:
125
- command: npx
126
- args:
127
- - -p
128
- - testdriverai
129
- - testdriverai-mcp
130
- env:
131
- TD_API_KEY: ${TD_API_KEY}
132
- ---
133
-
134
- # TestDriver Expert
135
-
136
- You are an expert at writing automated tests using TestDriver...
137
- ```
138
-
139
- The `TD_API_KEY` is pulled from your repository secrets when running in GitHub Actions or from your environment when using the web interface.
140
-
141
- <Warning>
142
- Make sure `TD_API_KEY` is set in your repository secrets for CI workflows. Go to **Settings → Secrets and variables → Actions** to add it.
143
- </Warning>
@@ -1,143 +0,0 @@
1
- ---
2
- title: "GitHub Copilot Setup"
3
- sidebarTitle: "IDE Setup"
4
- description: "Install the TestDriver extension and configure MCP for GitHub Copilot"
5
- icon: "wrench"
6
- ---
7
-
8
- TestDriver integrates with GitHub Copilot through the VS Code extension and MCP server. This guide walks you through the complete setup.
9
-
10
- ## Prerequisites
11
-
12
- Before you begin, you'll need:
13
-
14
- - **GitHub Copilot** — A subscription with MCP access. A [free tier](https://github.com/features/copilot/plans) is available.
15
- - **TestDriver Account** — Create a free account at [console.testdriver.ai](https://console.testdriver.ai/team) to get your API key. 60 free device minutes, no credit card required.
16
- - **VS Code** — The TestDriver extension provides the best experience with live preview and integrated test running.
17
-
18
- ## Setup Steps
19
-
20
- <Steps>
21
- <Step title="Install the TestDriver Extension">
22
- <Card
23
- horizontal
24
- title="Install TestDriver for VS Code"
25
- arrow
26
- href="vscode:extension/testdriver.testdriver"
27
- icon="/images/content/extension/vscode.svg"
28
- ></Card>
29
-
30
- The extension provides:
31
- - One-click sign-in and project initialization
32
- - Live preview panel for watching tests execute
33
- - MCP server configuration
34
- </Step>
35
-
36
- <Step title="Sign Into TestDriver">
37
- Sign in to connect your account and API key.
38
-
39
- 1. Open the command palette (`Cmd+Shift+P` or `Ctrl+Shift+P`)
40
- 2. Run **TestDriver: Login**
41
- 3. Your browser will open to the TestDriver sign-in page
42
- 4. Sign in (or create an account)
43
- 5. You'll be redirected back to VS Code, now signed in
44
-
45
- <Tip>
46
- The extension automatically saves your API key to VS Code's secure storage and your workspace `.env` file.
47
- </Tip>
48
- </Step>
49
-
50
- <Step title="Initialize Your Project">
51
- Set up TestDriver in your project with a single command.
52
-
53
- 1. Open the command palette (`Cmd+Shift+P` or `Ctrl+Shift+P`)
54
- 2. Run **TestDriver: Init Project**
55
-
56
- This command:
57
- - Creates a `package.json` with TestDriver and Vitest dependencies
58
- - Generates a `vitest.config.mjs` with proper timeout settings
59
- - Creates example test files in `tests/`
60
- - Sets up `.env` with your API key
61
- - Creates the TestDriver agent file at `.github/agents/testdriver.agent.md`
62
- - Configures the MCP server
63
-
64
- <Note>
65
- If you already have a `package.json`, the command will add the necessary dependencies to it.
66
- </Note>
67
- </Step>
68
-
69
- <Step title="Start the MCP Server">
70
- The MCP server enables GitHub Copilot to control TestDriver sandboxes.
71
-
72
- After initialization, the MCP configuration is created at `.vscode/mcp.json`:
73
-
74
- ```json .vscode/mcp.json
75
- {
76
- "servers": {
77
- "testdriver": {
78
- "command": "npx",
79
- "args": ["-p", "testdriverai", "testdriverai-mcp"],
80
- "env": {
81
- "TD_PREVIEW": "ide",
82
- "TD_API_KEY": "your-api-key"
83
- }
84
- }
85
- }
86
- }
87
- ```
88
-
89
- **To start the MCP server:**
90
-
91
- 1. Open the command palette (`Cmd+Shift+P` or `Ctrl+Shift+P`)
92
- 2. Run **MCP: List Servers**
93
- 3. Click on the **testdriver** server
94
- 4. Select **Start Server**
95
-
96
- You can also click the MCP icon in the status bar to manage servers.
97
-
98
- <Tip>
99
- See the [VS Code MCP documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) for more details on managing MCP servers.
100
- </Tip>
101
-
102
- <Warning>
103
- Make sure your API key is set. The extension uses the key from your sign-in, but you can also set it via the `TD_API_KEY` environment variable.
104
- </Warning>
105
- </Step>
106
-
107
- <Step title="Install Vitest Extension (Recommended)">
108
- For the best experience running tests, install the Vitest extension:
109
-
110
- <Card
111
- horizontal
112
- title="Vitest Extension"
113
- arrow
114
- href="vscode:extension/vitest.explorer"
115
- icon="flask-vial"
116
- >
117
- Run tests with GUI mode from the Test Explorer
118
- </Card>
119
-
120
- After installation, you'll see a beaker icon in the sidebar for accessing the Test Explorer.
121
- </Step>
122
- </Steps>
123
-
124
- ## Verify Your Setup
125
-
126
- To verify everything is configured correctly:
127
-
128
- 1. Open the command palette and run **TestDriver: Check Status**
129
- 2. You should see:
130
- - ✅ Signed in
131
- - ✅ MCP server configured
132
- - ✅ Project initialized
133
-
134
- ## The Agent File
135
-
136
- During initialization, TestDriver creates an agent file at `.github/agents/testdriver.agent.md`. This file tells GitHub Copilot how to use TestDriver's MCP tools.
137
-
138
- The agent has access to tools like:
139
- - `session_start` — Launch a sandbox with Chrome or other apps
140
- - `find` / `click` / `type` — Interact with elements on screen
141
- - `assert` — Verify conditions using AI vision
142
- - `screenshot` — Capture the current screen state
143
-