testdriverai 7.3.11 → 7.3.13

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 (133) hide show
  1. package/.github/skills/testdriver:ai/SKILL.md +204 -0
  2. package/.github/skills/testdriver:assert/SKILL.md +284 -0
  3. package/.github/skills/testdriver:aws-setup/SKILL.md +515 -0
  4. package/.github/skills/testdriver:caching/SKILL.md +124 -0
  5. package/.github/skills/testdriver:captcha/SKILL.md +159 -0
  6. package/.github/skills/testdriver:ci-cd/SKILL.md +602 -0
  7. package/.github/skills/testdriver:click/SKILL.md +286 -0
  8. package/.github/skills/testdriver:client/SKILL.md +339 -0
  9. package/.github/skills/testdriver:cloud/SKILL.md +119 -0
  10. package/.github/skills/testdriver:customizing-devices/SKILL.md +153 -0
  11. package/.github/skills/testdriver:dashcam/SKILL.md +418 -0
  12. package/.github/skills/testdriver:debugging-with-screenshots/SKILL.md +271 -0
  13. package/.github/skills/testdriver:device-config/SKILL.md +317 -0
  14. package/.github/skills/testdriver:double-click/SKILL.md +102 -0
  15. package/.github/skills/testdriver:elements/SKILL.md +605 -0
  16. package/.github/skills/testdriver:enterprise/SKILL.md +114 -0
  17. package/.github/skills/testdriver:examples/SKILL.md +7 -0
  18. package/.github/skills/testdriver:exec/SKILL.md +345 -0
  19. package/.github/skills/testdriver:find/SKILL.md +721 -0
  20. package/.github/skills/testdriver:focus-application/SKILL.md +293 -0
  21. package/.github/skills/testdriver:generating-tests/SKILL.md +36 -0
  22. package/.github/skills/testdriver:hover/SKILL.md +278 -0
  23. package/.github/skills/testdriver:locating-elements/SKILL.md +71 -0
  24. package/.github/skills/testdriver:making-assertions/SKILL.md +32 -0
  25. package/.github/skills/testdriver:mcp-workflow/SKILL.md +410 -0
  26. package/.github/skills/testdriver:mouse-down/SKILL.md +161 -0
  27. package/.github/skills/testdriver:mouse-up/SKILL.md +164 -0
  28. package/.github/skills/testdriver:performing-actions/SKILL.md +51 -0
  29. package/.github/skills/testdriver:press-keys/SKILL.md +348 -0
  30. package/.github/skills/testdriver:quickstart/SKILL.md +161 -0
  31. package/.github/skills/testdriver:reusable-code/SKILL.md +240 -0
  32. package/.github/skills/testdriver:right-click/SKILL.md +123 -0
  33. package/.github/skills/testdriver:running-tests/SKILL.md +181 -0
  34. package/.github/skills/testdriver:screenshot/SKILL.md +167 -0
  35. package/.github/skills/testdriver:scroll/SKILL.md +299 -0
  36. package/.github/skills/testdriver:secrets/SKILL.md +115 -0
  37. package/.github/skills/testdriver:self-hosted/SKILL.md +65 -0
  38. package/.github/skills/testdriver:test-writer/SKILL.md +451 -0
  39. package/.github/skills/testdriver:testdriver/SKILL.md +523 -0
  40. package/.github/skills/testdriver:testdriver-mechanic/SKILL.md +165 -0
  41. package/.github/skills/testdriver:type/SKILL.md +357 -0
  42. package/.github/skills/testdriver:variables/SKILL.md +111 -0
  43. package/.github/skills/testdriver:waiting-for-elements/SKILL.md +66 -0
  44. package/.github/skills/testdriver:what-is-testdriver/SKILL.md +54 -0
  45. package/.github/workflows/acceptance-windows-scheduled.yaml +6 -1
  46. package/.github/workflows/acceptance.yaml +0 -36
  47. package/.github/workflows/update-examples.yaml +53 -0
  48. package/CHANGELOG.md +8 -0
  49. package/agent/events.js +1 -0
  50. package/agent/index.js +8 -0
  51. package/agent/lib/commands.js +48 -29
  52. package/agent/lib/redraw.js +3 -1
  53. package/agent/lib/sandbox.js +166 -14
  54. package/agent/lib/sdk.js +142 -3
  55. package/agent/lib/system.js +4 -6
  56. package/ai/skills/testdriver:ai/SKILL.md +204 -0
  57. package/ai/skills/testdriver:assert/SKILL.md +315 -0
  58. package/ai/skills/testdriver:aws-setup/SKILL.md +448 -0
  59. package/ai/skills/testdriver:caching/SKILL.md +124 -0
  60. package/ai/skills/testdriver:captcha/SKILL.md +159 -0
  61. package/ai/skills/testdriver:ci-cd/SKILL.md +602 -0
  62. package/ai/skills/testdriver:click/SKILL.md +286 -0
  63. package/ai/skills/testdriver:client/SKILL.md +372 -0
  64. package/ai/skills/testdriver:cloud/SKILL.md +119 -0
  65. package/ai/skills/testdriver:customizing-devices/SKILL.md +153 -0
  66. package/ai/skills/testdriver:dashcam/SKILL.md +418 -0
  67. package/ai/skills/testdriver:debugging-with-screenshots/SKILL.md +401 -0
  68. package/ai/skills/testdriver:device-config/SKILL.md +317 -0
  69. package/ai/skills/testdriver:double-click/SKILL.md +102 -0
  70. package/ai/skills/testdriver:elements/SKILL.md +605 -0
  71. package/ai/skills/testdriver:enterprise/SKILL.md +114 -0
  72. package/ai/skills/testdriver:examples/SKILL.md +7 -0
  73. package/ai/skills/testdriver:exec/SKILL.md +345 -0
  74. package/ai/skills/testdriver:find/SKILL.md +745 -0
  75. package/ai/skills/testdriver:focus-application/SKILL.md +293 -0
  76. package/ai/skills/testdriver:generating-tests/SKILL.md +36 -0
  77. package/ai/skills/testdriver:hover/SKILL.md +278 -0
  78. package/ai/skills/testdriver:locating-elements/SKILL.md +71 -0
  79. package/ai/skills/testdriver:making-assertions/SKILL.md +32 -0
  80. package/ai/skills/testdriver:mcp-workflow/SKILL.md +410 -0
  81. package/ai/skills/testdriver:mouse-down/SKILL.md +161 -0
  82. package/ai/skills/testdriver:mouse-up/SKILL.md +164 -0
  83. package/ai/skills/testdriver:ocr/SKILL.md +235 -0
  84. package/ai/skills/testdriver:performing-actions/SKILL.md +51 -0
  85. package/ai/skills/testdriver:press-keys/SKILL.md +348 -0
  86. package/ai/skills/testdriver:quickstart/SKILL.md +146 -0
  87. package/ai/skills/testdriver:reusable-code/SKILL.md +240 -0
  88. package/ai/skills/testdriver:right-click/SKILL.md +123 -0
  89. package/ai/skills/testdriver:running-tests/SKILL.md +185 -0
  90. package/ai/skills/testdriver:screenshot/SKILL.md +248 -0
  91. package/ai/skills/testdriver:scroll/SKILL.md +335 -0
  92. package/ai/skills/testdriver:secrets/SKILL.md +115 -0
  93. package/ai/skills/testdriver:self-hosted/SKILL.md +65 -0
  94. package/ai/skills/testdriver:test-writer/SKILL.md +451 -0
  95. package/ai/skills/testdriver:testdriver/SKILL.md +631 -0
  96. package/ai/skills/testdriver:testdriver-mechanic/SKILL.md +165 -0
  97. package/ai/skills/testdriver:type/SKILL.md +357 -0
  98. package/ai/skills/testdriver:variables/SKILL.md +111 -0
  99. package/ai/skills/testdriver:waiting-for-elements/SKILL.md +66 -0
  100. package/ai/skills/testdriver:what-is-testdriver/SKILL.md +54 -0
  101. package/debugger/index.html +12 -2
  102. package/docs/v7/examples/scroll-keyboard.mdx +1 -1
  103. package/docs/v7/find.mdx +1 -0
  104. package/examples/config.mjs +1 -1
  105. package/examples/findall-coffee-icons.test.mjs +42 -0
  106. package/examples/flake-diffthreshold-001.test.mjs +9 -0
  107. package/examples/flake-diffthreshold-01.test.mjs +9 -0
  108. package/examples/flake-diffthreshold-05.test.mjs +9 -0
  109. package/examples/{z_flake-noredraw-cache.test.mjs → flake-noredraw-cache.test.mjs} +2 -2
  110. package/examples/{z_flake-noredraw-nocache.test.mjs → flake-noredraw-nocache.test.mjs} +2 -2
  111. package/examples/{z_flake-redraw-cache.test.mjs → flake-redraw-cache.test.mjs} +2 -2
  112. package/examples/{z_flake-redraw-nocache.test.mjs → flake-redraw-nocache.test.mjs} +2 -2
  113. package/examples/flake-rocket-match.test.mjs +30 -0
  114. package/examples/{z_flake-shared.mjs → flake-shared.mjs} +2 -2
  115. package/examples/parse.test.mjs +19 -0
  116. package/examples/scroll-keyboard.test.mjs +1 -1
  117. package/interfaces/cli/lib/base.js +6 -0
  118. package/interfaces/logger.js +51 -13
  119. package/interfaces/vitest-plugin.mjs +137 -0
  120. package/lib/core/index.d.ts +22 -0
  121. package/lib/init-project.js +105 -6
  122. package/lib/vitest/hooks.mjs +2 -5
  123. package/lib/vitest/setup-disable-defender.mjs +52 -0
  124. package/package.json +2 -1
  125. package/sdk-log-formatter.js +90 -0
  126. package/sdk.d.ts +88 -51
  127. package/sdk.js +128 -21
  128. package/setup/aws/disable-defender.sh +42 -0
  129. package/vitest.config.mjs +1 -3
  130. package/examples/z_flake-diffthreshold-001.test.mjs +0 -9
  131. package/examples/z_flake-diffthreshold-01.test.mjs +0 -9
  132. package/examples/z_flake-diffthreshold-05.test.mjs +0 -9
  133. /package/{examples → manual}/captcha-api.test.mjs +0 -0
@@ -0,0 +1,602 @@
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
+ ### Adding Secrets
31
+
32
+ 1. Navigate to your GitHub repository
33
+ 2. Go to **Settings** → **Secrets and variables** → **Actions**
34
+ 3. Click **New repository secret**
35
+ 4. Name: `TD_API_KEY`, Value: your API key
36
+ 5. Click **Add secret**
37
+
38
+ ### Basic Workflow
39
+
40
+ Create `.github/workflows/testdriver.yml`:
41
+
42
+ ```yaml .github/workflows/testdriver.yml
43
+ name: TestDriver Tests
44
+
45
+ on:
46
+ push:
47
+ branches: [main]
48
+ pull_request:
49
+ branches: [main]
50
+
51
+ jobs:
52
+ test:
53
+ runs-on: ubuntu-latest
54
+
55
+ steps:
56
+ - uses: actions/checkout@v4
57
+
58
+ - uses: actions/setup-node@v4
59
+ with:
60
+ node-version: '20'
61
+ cache: 'npm'
62
+
63
+ - run: npm ci
64
+
65
+ - name: Run TestDriver tests
66
+ env:
67
+ TD_API_KEY: ${{ secrets.TD_API_KEY }}
68
+ run: vitest --run
69
+ ```
70
+
71
+ ### Parallel Execution
72
+
73
+ Use matrix strategy to run tests in parallel:
74
+
75
+ ```yaml .github/workflows/testdriver-parallel.yml
76
+ name: TestDriver Tests (Parallel)
77
+
78
+ on: [push, pull_request]
79
+
80
+ jobs:
81
+ test:
82
+ runs-on: ubuntu-latest
83
+ strategy:
84
+ fail-fast: false
85
+ matrix:
86
+ shard: [1, 2, 3, 4]
87
+
88
+ steps:
89
+ - uses: actions/checkout@v4
90
+ - uses: actions/setup-node@v4
91
+ with:
92
+ node-version: '20'
93
+ cache: 'npm'
94
+ - run: npm ci
95
+ - name: Run tests (shard ${{ matrix.shard }}/4)
96
+ env:
97
+ TD_API_KEY: ${{ secrets.TD_API_KEY }}
98
+ run: vitest --run --shard=${{ matrix.shard }}/4
99
+ ```
100
+
101
+ ### Multi-Platform Testing
102
+
103
+ ```yaml .github/workflows/testdriver-multiplatform.yml
104
+ name: TestDriver Tests (Multi-Platform)
105
+
106
+ on: [push, pull_request]
107
+
108
+ jobs:
109
+ test:
110
+ runs-on: ubuntu-latest
111
+ strategy:
112
+ fail-fast: false
113
+ matrix:
114
+ td-os: [linux, windows]
115
+
116
+ steps:
117
+ - uses: actions/checkout@v4
118
+ - uses: actions/setup-node@v4
119
+ with:
120
+ node-version: '20'
121
+ cache: 'npm'
122
+ - run: npm ci
123
+ - name: Run tests on ${{ matrix.td-os }}
124
+ env:
125
+ TD_API_KEY: ${{ secrets.TD_API_KEY }}
126
+ TD_OS: ${{ matrix.td-os }}
127
+ run: vitest --run
128
+ ```
129
+ </Tab>
130
+
131
+ <Tab title="GitLab CI">
132
+ ### Adding Secrets
133
+
134
+ 1. Go to your GitLab project
135
+ 2. Navigate to **Settings** → **CI/CD** → **Variables**
136
+ 3. Click **Add variable**
137
+ 4. Key: `TD_API_KEY`, Value: your API key
138
+ 5. Check **Mask variable** and click **Add variable**
139
+
140
+ ### Basic Pipeline
141
+
142
+ Create `.gitlab-ci.yml`:
143
+
144
+ ```yaml .gitlab-ci.yml
145
+ stages:
146
+ - test
147
+
148
+ testdriver:
149
+ stage: test
150
+ image: node:20
151
+ cache:
152
+ paths:
153
+ - node_modules/
154
+ script:
155
+ - npm ci
156
+ - vitest --run
157
+ variables:
158
+ TD_API_KEY: $TD_API_KEY
159
+ ```
160
+
161
+ ### Parallel Execution
162
+
163
+ ```yaml .gitlab-ci.yml
164
+ stages:
165
+ - test
166
+
167
+ .testdriver-base:
168
+ stage: test
169
+ image: node:20
170
+ cache:
171
+ paths:
172
+ - node_modules/
173
+ before_script:
174
+ - npm ci
175
+ variables:
176
+ TD_API_KEY: $TD_API_KEY
177
+
178
+ testdriver-shard-1:
179
+ extends: .testdriver-base
180
+ script:
181
+ - vitest --run --shard=1/4
182
+
183
+ testdriver-shard-2:
184
+ extends: .testdriver-base
185
+ script:
186
+ - vitest --run --shard=2/4
187
+
188
+ testdriver-shard-3:
189
+ extends: .testdriver-base
190
+ script:
191
+ - vitest --run --shard=3/4
192
+
193
+ testdriver-shard-4:
194
+ extends: .testdriver-base
195
+ script:
196
+ - vitest --run --shard=4/4
197
+ ```
198
+
199
+ ### Multi-Platform Testing
200
+
201
+ ```yaml .gitlab-ci.yml
202
+ stages:
203
+ - test
204
+
205
+ .testdriver-base:
206
+ stage: test
207
+ image: node:20
208
+ cache:
209
+ paths:
210
+ - node_modules/
211
+ before_script:
212
+ - npm ci
213
+ variables:
214
+ TD_API_KEY: $TD_API_KEY
215
+
216
+ testdriver-linux:
217
+ extends: .testdriver-base
218
+ variables:
219
+ TD_OS: linux
220
+ script:
221
+ - vitest --run
222
+
223
+ testdriver-windows:
224
+ extends: .testdriver-base
225
+ variables:
226
+ TD_OS: windows
227
+ script:
228
+ - vitest --run
229
+ ```
230
+ </Tab>
231
+
232
+ <Tab title="CircleCI">
233
+ ### Adding Secrets
234
+
235
+ 1. Go to your CircleCI project
236
+ 2. Click **Project Settings** → **Environment Variables**
237
+ 3. Click **Add Environment Variable**
238
+ 4. Name: `TD_API_KEY`, Value: your API key
239
+
240
+ ### Basic Config
241
+
242
+ Create `.circleci/config.yml`:
243
+
244
+ ```yaml .circleci/config.yml
245
+ version: 2.1
246
+
247
+ jobs:
248
+ test:
249
+ docker:
250
+ - image: cimg/node:20.0
251
+ steps:
252
+ - checkout
253
+ - restore_cache:
254
+ keys:
255
+ - npm-deps-{{ checksum "package-lock.json" }}
256
+ - run: npm ci
257
+ - save_cache:
258
+ key: npm-deps-{{ checksum "package-lock.json" }}
259
+ paths:
260
+ - node_modules
261
+ - run:
262
+ name: Run TestDriver tests
263
+ command: vitest --run
264
+ environment:
265
+ TD_API_KEY: ${TD_API_KEY}
266
+
267
+ workflows:
268
+ test:
269
+ jobs:
270
+ - test
271
+ ```
272
+
273
+ ### Parallel Execution
274
+
275
+ ```yaml .circleci/config.yml
276
+ version: 2.1
277
+
278
+ jobs:
279
+ test:
280
+ docker:
281
+ - image: cimg/node:20.0
282
+ parallelism: 4
283
+ steps:
284
+ - checkout
285
+ - restore_cache:
286
+ keys:
287
+ - npm-deps-{{ checksum "package-lock.json" }}
288
+ - run: npm ci
289
+ - save_cache:
290
+ key: npm-deps-{{ checksum "package-lock.json" }}
291
+ paths:
292
+ - node_modules
293
+ - run:
294
+ name: Run TestDriver tests
295
+ command: |
296
+ vitest --run --shard=$((CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL
297
+ environment:
298
+ TD_API_KEY: ${TD_API_KEY}
299
+
300
+ workflows:
301
+ test:
302
+ jobs:
303
+ - test
304
+ ```
305
+
306
+ ### Multi-Platform Testing
307
+
308
+ ```yaml .circleci/config.yml
309
+ version: 2.1
310
+
311
+ jobs:
312
+ test:
313
+ docker:
314
+ - image: cimg/node:20.0
315
+ parameters:
316
+ td-os:
317
+ type: string
318
+ steps:
319
+ - checkout
320
+ - run: npm ci
321
+ - run:
322
+ name: Run TestDriver tests on << parameters.td-os >>
323
+ command: vitest --run
324
+ environment:
325
+ TD_API_KEY: ${TD_API_KEY}
326
+ TD_OS: << parameters.td-os >>
327
+
328
+ workflows:
329
+ test:
330
+ jobs:
331
+ - test:
332
+ td-os: linux
333
+ - test:
334
+ td-os: windows
335
+ ```
336
+ </Tab>
337
+
338
+ <Tab title="Azure Pipelines">
339
+ ### Adding Secrets
340
+
341
+ 1. Go to your Azure DevOps project
342
+ 2. Navigate to **Pipelines** → **Library** → **Variable groups**
343
+ 3. Create a new variable group or edit existing
344
+ 4. Add variable: `TD_API_KEY` with your API key
345
+ 5. Click the lock icon to make it secret
346
+
347
+ ### Basic Pipeline
348
+
349
+ Create `azure-pipelines.yml`:
350
+
351
+ ```yaml azure-pipelines.yml
352
+ trigger:
353
+ - main
354
+
355
+ pool:
356
+ vmImage: 'ubuntu-latest'
357
+
358
+ steps:
359
+ - task: NodeTool@0
360
+ inputs:
361
+ versionSpec: '20.x'
362
+ displayName: 'Setup Node.js'
363
+
364
+ - script: npm ci
365
+ displayName: 'Install dependencies'
366
+
367
+ - script: vitest --run
368
+ displayName: 'Run TestDriver tests'
369
+ env:
370
+ TD_API_KEY: $(TD_API_KEY)
371
+ ```
372
+
373
+ ### Parallel Execution
374
+
375
+ ```yaml azure-pipelines.yml
376
+ trigger:
377
+ - main
378
+
379
+ pool:
380
+ vmImage: 'ubuntu-latest'
381
+
382
+ strategy:
383
+ matrix:
384
+ shard1:
385
+ SHARD: '1/4'
386
+ shard2:
387
+ SHARD: '2/4'
388
+ shard3:
389
+ SHARD: '3/4'
390
+ shard4:
391
+ SHARD: '4/4'
392
+
393
+ steps:
394
+ - task: NodeTool@0
395
+ inputs:
396
+ versionSpec: '20.x'
397
+
398
+ - script: npm ci
399
+ displayName: 'Install dependencies'
400
+
401
+ - script: vitest --run --shard=$(SHARD)
402
+ displayName: 'Run TestDriver tests'
403
+ env:
404
+ TD_API_KEY: $(TD_API_KEY)
405
+ ```
406
+
407
+ ### Multi-Platform Testing
408
+
409
+ ```yaml azure-pipelines.yml
410
+ trigger:
411
+ - main
412
+
413
+ pool:
414
+ vmImage: 'ubuntu-latest'
415
+
416
+ strategy:
417
+ matrix:
418
+ linux:
419
+ TD_OS: 'linux'
420
+ windows:
421
+ TD_OS: 'windows'
422
+
423
+ steps:
424
+ - task: NodeTool@0
425
+ inputs:
426
+ versionSpec: '20.x'
427
+
428
+ - script: npm ci
429
+ displayName: 'Install dependencies'
430
+
431
+ - script: vitest --run
432
+ displayName: 'Run TestDriver tests on $(TD_OS)'
433
+ env:
434
+ TD_API_KEY: $(TD_API_KEY)
435
+ TD_OS: $(TD_OS)
436
+ ```
437
+ </Tab>
438
+
439
+ <Tab title="Jenkins">
440
+ ### Adding Secrets
441
+
442
+ 1. Go to **Manage Jenkins** → **Credentials**
443
+ 2. Select the appropriate domain
444
+ 3. Click **Add Credentials**
445
+ 4. Kind: **Secret text**
446
+ 5. ID: `td-api-key`, Secret: your API key
447
+
448
+ ### Basic Pipeline
449
+
450
+ Create `Jenkinsfile`:
451
+
452
+ ```groovy Jenkinsfile
453
+ pipeline {
454
+ agent {
455
+ docker {
456
+ image 'node:20'
457
+ }
458
+ }
459
+
460
+ environment {
461
+ TD_API_KEY = credentials('td-api-key')
462
+ }
463
+
464
+ stages {
465
+ stage('Install') {
466
+ steps {
467
+ sh 'npm ci'
468
+ }
469
+ }
470
+
471
+ stage('Test') {
472
+ steps {
473
+ sh 'vitest --run'
474
+ }
475
+ }
476
+ }
477
+ }
478
+ ```
479
+
480
+ ### Parallel Execution
481
+
482
+ ```groovy Jenkinsfile
483
+ pipeline {
484
+ agent none
485
+
486
+ environment {
487
+ TD_API_KEY = credentials('td-api-key')
488
+ }
489
+
490
+ stages {
491
+ stage('Test') {
492
+ parallel {
493
+ stage('Shard 1') {
494
+ agent { docker { image 'node:20' } }
495
+ steps {
496
+ sh 'npm ci'
497
+ sh 'vitest --run --shard=1/4'
498
+ }
499
+ }
500
+ stage('Shard 2') {
501
+ agent { docker { image 'node:20' } }
502
+ steps {
503
+ sh 'npm ci'
504
+ sh 'vitest --run --shard=2/4'
505
+ }
506
+ }
507
+ stage('Shard 3') {
508
+ agent { docker { image 'node:20' } }
509
+ steps {
510
+ sh 'npm ci'
511
+ sh 'vitest --run --shard=3/4'
512
+ }
513
+ }
514
+ stage('Shard 4') {
515
+ agent { docker { image 'node:20' } }
516
+ steps {
517
+ sh 'npm ci'
518
+ sh 'vitest --run --shard=4/4'
519
+ }
520
+ }
521
+ }
522
+ }
523
+ }
524
+ }
525
+ ```
526
+
527
+ ### Multi-Platform Testing
528
+
529
+ ```groovy Jenkinsfile
530
+ pipeline {
531
+ agent none
532
+
533
+ environment {
534
+ TD_API_KEY = credentials('td-api-key')
535
+ }
536
+
537
+ stages {
538
+ stage('Test') {
539
+ parallel {
540
+ stage('Linux') {
541
+ agent { docker { image 'node:20' } }
542
+ environment {
543
+ TD_OS = 'linux'
544
+ }
545
+ steps {
546
+ sh 'npm ci'
547
+ sh 'vitest --run'
548
+ }
549
+ }
550
+ stage('Windows') {
551
+ agent { docker { image 'node:20' } }
552
+ environment {
553
+ TD_OS = 'windows'
554
+ }
555
+ steps {
556
+ sh 'npm ci'
557
+ sh 'vitest --run'
558
+ }
559
+ }
560
+ }
561
+ }
562
+ }
563
+ }
564
+ ```
565
+ </Tab>
566
+ </Tabs>
567
+
568
+ ## Reading Platform in Tests
569
+
570
+ When using multi-platform testing, read the `TD_OS` environment variable in your test:
571
+
572
+ ```javascript tests/cross-platform.test.mjs
573
+ import { describe, expect, it } from "vitest";
574
+ import { TestDriver } from "testdriverai/lib/vitest/hooks.mjs";
575
+
576
+ describe("Cross-platform tests", () => {
577
+ it("should work on both Linux and Windows", async (context) => {
578
+ const os = process.env.TD_OS || 'linux';
579
+
580
+ const testdriver = TestDriver(context, {
581
+ os: os // 'linux' or 'windows'
582
+ });
583
+
584
+ await testdriver.provision.chrome({
585
+ url: 'https://example.com',
586
+ });
587
+
588
+ const result = await testdriver.assert("the page loaded successfully");
589
+ expect(result).toBeTruthy();
590
+ });
591
+ });
592
+ ```
593
+
594
+ ## Viewing Results
595
+
596
+ All test runs are automatically recorded and visible in your TestDriver dashboard at [console.testdriver.ai](https://console.testdriver.ai):
597
+
598
+ - All test runs with pass/fail status
599
+ - Video replays of each test
600
+ - Error messages and screenshots on failure
601
+ - Git commit and branch information
602
+ - Duration trends over time