testdriverai 7.2.3 → 7.2.10

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