@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
@@ -0,0 +1,659 @@
1
+ ---
2
+ name: testdriver:ci-cd
3
+ description: Run TestDriver tests in CI/CD with parallel execution and cross-platform support
4
+ ---
5
+ <!-- Generated from ci-cd.mdx. DO NOT EDIT. -->
6
+
7
+ TestDriver integrates seamlessly with popular CI providers, enabling automated end-to-end testing on every push and pull request.
8
+
9
+ ## Adding Your API Key
10
+
11
+ TestDriver requires an API key to authenticate with the TestDriver cloud. Store this securely as a secret in your CI provider.
12
+
13
+ <Steps>
14
+ <Step title="Get Your API Key">
15
+ Go to [console.testdriver.ai/team](https://console.testdriver.ai/team) and copy your team's API key
16
+ </Step>
17
+ <Step title="Add Secret to Your CI Provider">
18
+ Add `TD_API_KEY` as a secret environment variable in your CI provider's settings.
19
+ </Step>
20
+ </Steps>
21
+
22
+ <Note>
23
+ Never commit your API key directly in code. Always use your CI provider's secrets management.
24
+ </Note>
25
+
26
+ ## CI Provider Examples
27
+
28
+ <Tabs>
29
+ <Tab title="GitHub Actions">
30
+ ### Authenticate with OIDC (recommended)
31
+
32
+ If you've installed the [TestDriver GitHub App](https://console.testdriver.ai), your workflow can authenticate using GitHub's OIDC token — no long-lived `TD_API_KEY` secret to store or rotate. The workflow proves it's running inside your org, and TestDriver exchanges that proof for your team's API key at run time.
33
+
34
+ <Note>
35
+ This requires the TestDriver GitHub App to be authorized for your organization once (from the [console](https://console.testdriver.ai)). If your org authorized the App before OIDC support shipped, re-run the authorization once so the binding is created.
36
+ </Note>
37
+
38
+ Grant the job the `id-token: write` permission and exchange the OIDC token for your API key:
39
+
40
+ ```yaml .github/workflows/testdriver.yml
41
+ name: TestDriver Tests
42
+
43
+ on:
44
+ push:
45
+ branches: [main]
46
+ pull_request:
47
+ branches: [main]
48
+
49
+ jobs:
50
+ test:
51
+ runs-on: ubuntu-latest
52
+ permissions:
53
+ id-token: write # required to mint an OIDC token
54
+ contents: read
55
+
56
+ steps:
57
+ - uses: actions/checkout@v4
58
+
59
+ - uses: actions/setup-node@v4
60
+ with:
61
+ node-version: '20'
62
+ cache: 'npm'
63
+
64
+ - run: npm ci
65
+
66
+ - name: Authenticate to TestDriver via OIDC
67
+ run: |
68
+ OIDC_TOKEN=$(curl -sS \
69
+ -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
70
+ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=testdriver" | jq -r '.value')
71
+ API_KEY=$(curl -sS -X POST https://api.testdriver.ai/github/actions/auth \
72
+ -H "Content-Type: application/json" \
73
+ -d "{\"token\":\"$OIDC_TOKEN\"}" | jq -r '.apiKey')
74
+ echo "::add-mask::$API_KEY"
75
+ echo "TD_API_KEY=$API_KEY" >> "$GITHUB_ENV"
76
+
77
+ - name: Run TestDriver tests
78
+ env:
79
+ TD_API_KEY: ${{ env.TD_API_KEY }}
80
+ run: vitest --run
81
+ ```
82
+
83
+ `ACTIONS_ID_TOKEN_REQUEST_TOKEN` and `ACTIONS_ID_TOKEN_REQUEST_URL` are injected automatically once `permissions: id-token: write` is set. `::add-mask::` keeps the resolved key out of the logs.
84
+
85
+ ### Adding Secrets
86
+
87
+ Prefer OIDC above when possible. If you can't use the GitHub App (e.g. self-hosted runners without OIDC, or a non-GitHub registry), fall back to a stored API key:
88
+
89
+ 1. Navigate to your GitHub repository
90
+ 2. Go to **Settings** → **Secrets and variables** → **Actions**
91
+ 3. Click **New repository secret**
92
+ 4. Name: `TD_API_KEY`, Value: your API key
93
+ 5. Click **Add secret**
94
+
95
+ ### Basic Workflow
96
+
97
+ Create `.github/workflows/testdriver.yml`:
98
+
99
+ ```yaml .github/workflows/testdriver.yml
100
+ name: TestDriver Tests
101
+
102
+ on:
103
+ push:
104
+ branches: [main]
105
+ pull_request:
106
+ branches: [main]
107
+
108
+ jobs:
109
+ test:
110
+ runs-on: ubuntu-latest
111
+
112
+ steps:
113
+ - uses: actions/checkout@v4
114
+
115
+ - uses: actions/setup-node@v4
116
+ with:
117
+ node-version: '20'
118
+ cache: 'npm'
119
+
120
+ - run: npm ci
121
+
122
+ - name: Run TestDriver tests
123
+ env:
124
+ TD_API_KEY: ${{ secrets.TD_API_KEY }}
125
+ run: vitest --run
126
+ ```
127
+
128
+ ### Parallel Execution
129
+
130
+ Use matrix strategy to run tests in parallel:
131
+
132
+ ```yaml .github/workflows/testdriver-parallel.yml
133
+ name: TestDriver Tests (Parallel)
134
+
135
+ on: [push, pull_request]
136
+
137
+ jobs:
138
+ test:
139
+ runs-on: ubuntu-latest
140
+ strategy:
141
+ fail-fast: false
142
+ matrix:
143
+ shard: [1, 2, 3, 4]
144
+
145
+ steps:
146
+ - uses: actions/checkout@v4
147
+ - uses: actions/setup-node@v4
148
+ with:
149
+ node-version: '20'
150
+ cache: 'npm'
151
+ - run: npm ci
152
+ - name: Run tests (shard ${{ matrix.shard }}/4)
153
+ env:
154
+ TD_API_KEY: ${{ secrets.TD_API_KEY }}
155
+ run: vitest --run --shard=${{ matrix.shard }}/4
156
+ ```
157
+
158
+ ### Multi-Platform Testing
159
+
160
+ ```yaml .github/workflows/testdriver-multiplatform.yml
161
+ name: TestDriver Tests (Multi-Platform)
162
+
163
+ on: [push, pull_request]
164
+
165
+ jobs:
166
+ test:
167
+ runs-on: ubuntu-latest
168
+ strategy:
169
+ fail-fast: false
170
+ matrix:
171
+ td-os: [linux, windows]
172
+
173
+ steps:
174
+ - uses: actions/checkout@v4
175
+ - uses: actions/setup-node@v4
176
+ with:
177
+ node-version: '20'
178
+ cache: 'npm'
179
+ - run: npm ci
180
+ - name: Run tests on ${{ matrix.td-os }}
181
+ env:
182
+ TD_API_KEY: ${{ secrets.TD_API_KEY }}
183
+ TD_OS: ${{ matrix.td-os }}
184
+ run: vitest --run
185
+ ```
186
+ </Tab>
187
+
188
+ <Tab title="GitLab CI">
189
+ ### Adding Secrets
190
+
191
+ 1. Go to your GitLab project
192
+ 2. Navigate to **Settings** → **CI/CD** → **Variables**
193
+ 3. Click **Add variable**
194
+ 4. Key: `TD_API_KEY`, Value: your API key
195
+ 5. Check **Mask variable** and click **Add variable**
196
+
197
+ ### Basic Pipeline
198
+
199
+ Create `.gitlab-ci.yml`:
200
+
201
+ ```yaml .gitlab-ci.yml
202
+ stages:
203
+ - test
204
+
205
+ testdriver:
206
+ stage: test
207
+ image: node:20
208
+ cache:
209
+ paths:
210
+ - node_modules/
211
+ script:
212
+ - npm ci
213
+ - vitest --run
214
+ variables:
215
+ TD_API_KEY: $TD_API_KEY
216
+ ```
217
+
218
+ ### Parallel Execution
219
+
220
+ ```yaml .gitlab-ci.yml
221
+ stages:
222
+ - test
223
+
224
+ .testdriver-base:
225
+ stage: test
226
+ image: node:20
227
+ cache:
228
+ paths:
229
+ - node_modules/
230
+ before_script:
231
+ - npm ci
232
+ variables:
233
+ TD_API_KEY: $TD_API_KEY
234
+
235
+ testdriver-shard-1:
236
+ extends: .testdriver-base
237
+ script:
238
+ - vitest --run --shard=1/4
239
+
240
+ testdriver-shard-2:
241
+ extends: .testdriver-base
242
+ script:
243
+ - vitest --run --shard=2/4
244
+
245
+ testdriver-shard-3:
246
+ extends: .testdriver-base
247
+ script:
248
+ - vitest --run --shard=3/4
249
+
250
+ testdriver-shard-4:
251
+ extends: .testdriver-base
252
+ script:
253
+ - vitest --run --shard=4/4
254
+ ```
255
+
256
+ ### Multi-Platform Testing
257
+
258
+ ```yaml .gitlab-ci.yml
259
+ stages:
260
+ - test
261
+
262
+ .testdriver-base:
263
+ stage: test
264
+ image: node:20
265
+ cache:
266
+ paths:
267
+ - node_modules/
268
+ before_script:
269
+ - npm ci
270
+ variables:
271
+ TD_API_KEY: $TD_API_KEY
272
+
273
+ testdriver-linux:
274
+ extends: .testdriver-base
275
+ variables:
276
+ TD_OS: linux
277
+ script:
278
+ - vitest --run
279
+
280
+ testdriver-windows:
281
+ extends: .testdriver-base
282
+ variables:
283
+ TD_OS: windows
284
+ script:
285
+ - vitest --run
286
+ ```
287
+ </Tab>
288
+
289
+ <Tab title="CircleCI">
290
+ ### Adding Secrets
291
+
292
+ 1. Go to your CircleCI project
293
+ 2. Click **Project Settings** → **Environment Variables**
294
+ 3. Click **Add Environment Variable**
295
+ 4. Name: `TD_API_KEY`, Value: your API key
296
+
297
+ ### Basic Config
298
+
299
+ Create `.circleci/config.yml`:
300
+
301
+ ```yaml .circleci/config.yml
302
+ version: 2.1
303
+
304
+ jobs:
305
+ test:
306
+ docker:
307
+ - image: cimg/node:20.0
308
+ steps:
309
+ - checkout
310
+ - restore_cache:
311
+ keys:
312
+ - npm-deps-{{ checksum "package-lock.json" }}
313
+ - run: npm ci
314
+ - save_cache:
315
+ key: npm-deps-{{ checksum "package-lock.json" }}
316
+ paths:
317
+ - node_modules
318
+ - run:
319
+ name: Run TestDriver tests
320
+ command: vitest --run
321
+ environment:
322
+ TD_API_KEY: ${TD_API_KEY}
323
+
324
+ workflows:
325
+ test:
326
+ jobs:
327
+ - test
328
+ ```
329
+
330
+ ### Parallel Execution
331
+
332
+ ```yaml .circleci/config.yml
333
+ version: 2.1
334
+
335
+ jobs:
336
+ test:
337
+ docker:
338
+ - image: cimg/node:20.0
339
+ parallelism: 4
340
+ steps:
341
+ - checkout
342
+ - restore_cache:
343
+ keys:
344
+ - npm-deps-{{ checksum "package-lock.json" }}
345
+ - run: npm ci
346
+ - save_cache:
347
+ key: npm-deps-{{ checksum "package-lock.json" }}
348
+ paths:
349
+ - node_modules
350
+ - run:
351
+ name: Run TestDriver tests
352
+ command: |
353
+ vitest --run --shard=$((CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL
354
+ environment:
355
+ TD_API_KEY: ${TD_API_KEY}
356
+
357
+ workflows:
358
+ test:
359
+ jobs:
360
+ - test
361
+ ```
362
+
363
+ ### Multi-Platform Testing
364
+
365
+ ```yaml .circleci/config.yml
366
+ version: 2.1
367
+
368
+ jobs:
369
+ test:
370
+ docker:
371
+ - image: cimg/node:20.0
372
+ parameters:
373
+ td-os:
374
+ type: string
375
+ steps:
376
+ - checkout
377
+ - run: npm ci
378
+ - run:
379
+ name: Run TestDriver tests on << parameters.td-os >>
380
+ command: vitest --run
381
+ environment:
382
+ TD_API_KEY: ${TD_API_KEY}
383
+ TD_OS: << parameters.td-os >>
384
+
385
+ workflows:
386
+ test:
387
+ jobs:
388
+ - test:
389
+ td-os: linux
390
+ - test:
391
+ td-os: windows
392
+ ```
393
+ </Tab>
394
+
395
+ <Tab title="Azure Pipelines">
396
+ ### Adding Secrets
397
+
398
+ 1. Go to your Azure DevOps project
399
+ 2. Navigate to **Pipelines** → **Library** → **Variable groups**
400
+ 3. Create a new variable group or edit existing
401
+ 4. Add variable: `TD_API_KEY` with your API key
402
+ 5. Click the lock icon to make it secret
403
+
404
+ ### Basic Pipeline
405
+
406
+ Create `azure-pipelines.yml`:
407
+
408
+ ```yaml azure-pipelines.yml
409
+ trigger:
410
+ - main
411
+
412
+ pool:
413
+ vmImage: 'ubuntu-latest'
414
+
415
+ steps:
416
+ - task: NodeTool@0
417
+ inputs:
418
+ versionSpec: '20.x'
419
+ displayName: 'Setup Node.js'
420
+
421
+ - script: npm ci
422
+ displayName: 'Install dependencies'
423
+
424
+ - script: vitest --run
425
+ displayName: 'Run TestDriver tests'
426
+ env:
427
+ TD_API_KEY: $(TD_API_KEY)
428
+ ```
429
+
430
+ ### Parallel Execution
431
+
432
+ ```yaml azure-pipelines.yml
433
+ trigger:
434
+ - main
435
+
436
+ pool:
437
+ vmImage: 'ubuntu-latest'
438
+
439
+ strategy:
440
+ matrix:
441
+ shard1:
442
+ SHARD: '1/4'
443
+ shard2:
444
+ SHARD: '2/4'
445
+ shard3:
446
+ SHARD: '3/4'
447
+ shard4:
448
+ SHARD: '4/4'
449
+
450
+ steps:
451
+ - task: NodeTool@0
452
+ inputs:
453
+ versionSpec: '20.x'
454
+
455
+ - script: npm ci
456
+ displayName: 'Install dependencies'
457
+
458
+ - script: vitest --run --shard=$(SHARD)
459
+ displayName: 'Run TestDriver tests'
460
+ env:
461
+ TD_API_KEY: $(TD_API_KEY)
462
+ ```
463
+
464
+ ### Multi-Platform Testing
465
+
466
+ ```yaml azure-pipelines.yml
467
+ trigger:
468
+ - main
469
+
470
+ pool:
471
+ vmImage: 'ubuntu-latest'
472
+
473
+ strategy:
474
+ matrix:
475
+ linux:
476
+ TD_OS: 'linux'
477
+ windows:
478
+ TD_OS: 'windows'
479
+
480
+ steps:
481
+ - task: NodeTool@0
482
+ inputs:
483
+ versionSpec: '20.x'
484
+
485
+ - script: npm ci
486
+ displayName: 'Install dependencies'
487
+
488
+ - script: vitest --run
489
+ displayName: 'Run TestDriver tests on $(TD_OS)'
490
+ env:
491
+ TD_API_KEY: $(TD_API_KEY)
492
+ TD_OS: $(TD_OS)
493
+ ```
494
+ </Tab>
495
+
496
+ <Tab title="Jenkins">
497
+ ### Adding Secrets
498
+
499
+ 1. Go to **Manage Jenkins** → **Credentials**
500
+ 2. Select the appropriate domain
501
+ 3. Click **Add Credentials**
502
+ 4. Kind: **Secret text**
503
+ 5. ID: `td-api-key`, Secret: your API key
504
+
505
+ ### Basic Pipeline
506
+
507
+ Create `Jenkinsfile`:
508
+
509
+ ```groovy Jenkinsfile
510
+ pipeline {
511
+ agent {
512
+ docker {
513
+ image 'node:20'
514
+ }
515
+ }
516
+
517
+ environment {
518
+ TD_API_KEY = credentials('td-api-key')
519
+ }
520
+
521
+ stages {
522
+ stage('Install') {
523
+ steps {
524
+ sh 'npm ci'
525
+ }
526
+ }
527
+
528
+ stage('Test') {
529
+ steps {
530
+ sh 'vitest --run'
531
+ }
532
+ }
533
+ }
534
+ }
535
+ ```
536
+
537
+ ### Parallel Execution
538
+
539
+ ```groovy Jenkinsfile
540
+ pipeline {
541
+ agent none
542
+
543
+ environment {
544
+ TD_API_KEY = credentials('td-api-key')
545
+ }
546
+
547
+ stages {
548
+ stage('Test') {
549
+ parallel {
550
+ stage('Shard 1') {
551
+ agent { docker { image 'node:20' } }
552
+ steps {
553
+ sh 'npm ci'
554
+ sh 'vitest --run --shard=1/4'
555
+ }
556
+ }
557
+ stage('Shard 2') {
558
+ agent { docker { image 'node:20' } }
559
+ steps {
560
+ sh 'npm ci'
561
+ sh 'vitest --run --shard=2/4'
562
+ }
563
+ }
564
+ stage('Shard 3') {
565
+ agent { docker { image 'node:20' } }
566
+ steps {
567
+ sh 'npm ci'
568
+ sh 'vitest --run --shard=3/4'
569
+ }
570
+ }
571
+ stage('Shard 4') {
572
+ agent { docker { image 'node:20' } }
573
+ steps {
574
+ sh 'npm ci'
575
+ sh 'vitest --run --shard=4/4'
576
+ }
577
+ }
578
+ }
579
+ }
580
+ }
581
+ }
582
+ ```
583
+
584
+ ### Multi-Platform Testing
585
+
586
+ ```groovy Jenkinsfile
587
+ pipeline {
588
+ agent none
589
+
590
+ environment {
591
+ TD_API_KEY = credentials('td-api-key')
592
+ }
593
+
594
+ stages {
595
+ stage('Test') {
596
+ parallel {
597
+ stage('Linux') {
598
+ agent { docker { image 'node:20' } }
599
+ environment {
600
+ TD_OS = 'linux'
601
+ }
602
+ steps {
603
+ sh 'npm ci'
604
+ sh 'vitest --run'
605
+ }
606
+ }
607
+ stage('Windows') {
608
+ agent { docker { image 'node:20' } }
609
+ environment {
610
+ TD_OS = 'windows'
611
+ }
612
+ steps {
613
+ sh 'npm ci'
614
+ sh 'vitest --run'
615
+ }
616
+ }
617
+ }
618
+ }
619
+ }
620
+ }
621
+ ```
622
+ </Tab>
623
+ </Tabs>
624
+
625
+ ## Reading Platform in Tests
626
+
627
+ When using multi-platform testing, read the `TD_OS` environment variable in your test:
628
+
629
+ ```javascript tests/cross-platform.test.mjs
630
+ import { describe, expect, it } from "vitest";
631
+ import { TestDriver } from "testdriverai/vitest/hooks";
632
+
633
+ describe("Cross-platform tests", () => {
634
+ it("should work on both Linux and Windows", async (context) => {
635
+ const os = process.env.TD_OS || 'linux';
636
+
637
+ const testdriver = TestDriver(context, {
638
+ os: os // 'linux' or 'windows'
639
+ });
640
+
641
+ await testdriver.provision.chrome({
642
+ url: 'https://example.com',
643
+ });
644
+
645
+ const result = await testdriver.assert("the page loaded successfully");
646
+ expect(result).toBeTruthy();
647
+ });
648
+ });
649
+ ```
650
+
651
+ ## Viewing Results
652
+
653
+ All test runs are automatically recorded and visible in your TestDriver dashboard at [console.testdriver.ai](https://console.testdriver.ai):
654
+
655
+ - All test runs with pass/fail status
656
+ - Video replays of each test
657
+ - Error messages and screenshots on failure
658
+ - Git commit and branch information
659
+ - Duration trends over time