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
@@ -1,612 +0,0 @@
1
- ---
2
- title: "Setting Up in CI"
3
- description: "Run TestDriver tests in CI/CD pipelines"
4
- icon: "arrows-spin"
5
- ---
6
-
7
- TestDriver integrates seamlessly with all major CI/CD platforms. This guide covers the essential setup for running tests in continuous integration.
8
-
9
- ## Quick Setup
10
-
11
- Running TestDriver in CI requires just three things:
12
-
13
- <Steps>
14
- <Step title="Install Dependencies">
15
- ```yaml
16
- - run: npm install
17
- ```
18
- </Step>
19
-
20
- <Step title="Set API Key">
21
- ```yaml
22
- env:
23
- TD_API_KEY: ${{ secrets.TD_API_KEY }}
24
- ```
25
- </Step>
26
-
27
- <Step title="Run Tests">
28
- ```yaml
29
- - run: npx vitest run
30
- ```
31
- </Step>
32
- </Steps>
33
-
34
- ## Platform-Specific Setup
35
-
36
- <Tabs>
37
- <Tab title="GitHub Actions">
38
- ```yaml .github/workflows/test.yml
39
- name: E2E Tests
40
-
41
- on:
42
- push:
43
- branches: [main]
44
- pull_request:
45
- branches: [main]
46
-
47
- jobs:
48
- test:
49
- runs-on: ubuntu-latest
50
-
51
- steps:
52
- - uses: actions/checkout@v3
53
-
54
- - name: Setup Node.js
55
- uses: actions/setup-node@v3
56
- with:
57
- node-version: '20'
58
-
59
- - name: Install dependencies
60
- run: npm install
61
-
62
- - name: Run tests
63
- run: npx vitest run
64
- env:
65
- TD_API_KEY: ${{ secrets.TD_API_KEY }}
66
-
67
- - name: Upload artifacts
68
- if: failure()
69
- uses: actions/upload-artifact@v3
70
- with:
71
- name: test-artifacts
72
- path: |
73
- .testdriver/debug-screenshots/
74
- .testdriver/dashcam-urls.txt
75
- ```
76
-
77
- [Complete GitHub Actions guide](/v7/guides/ci-cd/github-actions)
78
- </Tab>
79
-
80
- <Tab title="GitLab CI">
81
- ```yaml .gitlab-ci.yml
82
- test:
83
- image: node:20
84
- stage: test
85
- script:
86
- - npm install
87
- - npx vitest run
88
- variables:
89
- TD_API_KEY: $TD_API_KEY
90
- artifacts:
91
- when: on_failure
92
- paths:
93
- - .testdriver/debug-screenshots/
94
- - .testdriver/dashcam-urls.txt
95
- ```
96
-
97
- [Complete GitLab CI guide](/v7/guides/ci-cd/gitlab)
98
- </Tab>
99
-
100
- <Tab title="CircleCI">
101
- ```yaml .circleci/config.yml
102
- version: 2.1
103
-
104
- jobs:
105
- test:
106
- docker:
107
- - image: cimg/node:20.0
108
- steps:
109
- - checkout
110
- - run: npm install
111
- - run:
112
- name: Run tests
113
- command: npx vitest run
114
- environment:
115
- TD_API_KEY: << pipeline.parameters.td-api-key >>
116
- - store_artifacts:
117
- path: .testdriver/debug-screenshots/
118
- when: on_fail
119
- ```
120
-
121
- [Complete CircleCI guide](/v7/guides/ci-cd/circleci)
122
- </Tab>
123
-
124
- <Tab title="Jenkins">
125
- ```groovy Jenkinsfile
126
- pipeline {
127
- agent any
128
-
129
- environment {
130
- TD_API_KEY = credentials('testdriver-api-key')
131
- }
132
-
133
- stages {
134
- stage('Install') {
135
- steps {
136
- sh 'npm install'
137
- }
138
- }
139
-
140
- stage('Test') {
141
- steps {
142
- sh 'npx vitest run'
143
- }
144
- }
145
- }
146
-
147
- post {
148
- failure {
149
- archiveArtifacts artifacts: '.testdriver/**/*', allowEmptyArchive: true
150
- }
151
- }
152
- }
153
- ```
154
-
155
- [Complete Jenkins guide](/v7/guides/ci-cd/jenkins)
156
- </Tab>
157
- </Tabs>
158
-
159
- ## Storing API Keys
160
-
161
- Store your TestDriver API key securely in CI secrets:
162
-
163
- <CardGroup cols={2}>
164
- <Card title="GitHub Actions" icon="github">
165
- 1. Go to repository Settings → Secrets
166
- 2. Click "New repository secret"
167
- 3. Name: `TD_API_KEY`
168
- 4. Value: Your API key
169
- </Card>
170
-
171
- <Card title="GitLab CI" icon="gitlab">
172
- 1. Go to Settings → CI/CD → Variables
173
- 2. Click "Add variable"
174
- 3. Key: `TD_API_KEY`
175
- 4. Value: Your API key
176
- 5. Check "Mask variable"
177
- </Card>
178
-
179
- <Card title="CircleCI" icon="circle">
180
- 1. Project Settings → Environment Variables
181
- 2. Click "Add Environment Variable"
182
- 3. Name: `TD_API_KEY`
183
- 4. Value: Your API key
184
- </Card>
185
-
186
- <Card title="Jenkins" icon="jenkins">
187
- 1. Manage Jenkins → Credentials
188
- 2. Add Credentials → Secret text
189
- 3. ID: `testdriver-api-key`
190
- 4. Secret: Your API key
191
- </Card>
192
- </CardGroup>
193
-
194
- ## Parallel Execution
195
-
196
- Run tests in parallel for faster CI builds:
197
-
198
- <Tabs>
199
- <Tab title="GitHub Actions Matrix">
200
- ```yaml
201
- strategy:
202
- matrix:
203
- shard: [1, 2, 3, 4]
204
- steps:
205
- - run: npx vitest run --shard=${{ matrix.shard }}/4
206
- ```
207
-
208
- Runs 4 parallel jobs, each handling 1/4 of tests.
209
- </Tab>
210
-
211
- <Tab title="GitLab CI Parallel">
212
- ```yaml
213
- test:
214
- parallel: 4
215
- script:
216
- - npx vitest run --shard=$CI_NODE_INDEX/$CI_NODE_TOTAL
217
- ```
218
- </Tab>
219
-
220
- <Tab title="CircleCI Parallelism">
221
- ```yaml
222
- test:
223
- parallelism: 4
224
- steps:
225
- - run: |
226
- SHARD_INDEX=$CIRCLE_NODE_INDEX
227
- TOTAL_SHARDS=$CIRCLE_NODE_TOTAL
228
- npx vitest run --shard=$((SHARD_INDEX+1))/$TOTAL_SHARDS
229
- ```
230
- </Tab>
231
- </Tabs>
232
-
233
- ## Generating Reports
234
-
235
- Create test reports for CI dashboards:
236
-
237
- <Tabs>
238
- <Tab title="JUnit XML">
239
- ```bash
240
- npx vitest run --reporter=junit --outputFile=test-results.xml
241
- ```
242
-
243
- ```yaml
244
- - name: Publish Test Results
245
- uses: EnricoMi/publish-unit-test-result-action@v2
246
- if: always()
247
- with:
248
- files: test-results.xml
249
- ```
250
- </Tab>
251
-
252
- <Tab title="HTML Report">
253
- ```bash
254
- npx vitest run --reporter=html --outputFile=test-report.html
255
- ```
256
-
257
- ```yaml
258
- - name: Upload HTML Report
259
- uses: actions/upload-artifact@v3
260
- with:
261
- name: test-report
262
- path: test-report.html
263
- ```
264
- </Tab>
265
-
266
- <Tab title="JSON Report">
267
- ```bash
268
- npx vitest run --reporter=json --outputFile=test-results.json
269
- ```
270
-
271
- Parse JSON for custom reporting.
272
- </Tab>
273
- </Tabs>
274
-
275
- ## Handling Test Failures
276
-
277
- Capture debug information when tests fail:
278
-
279
- ```yaml .github/workflows/test.yml
280
- - name: Run tests
281
- id: tests
282
- run: npx vitest run
283
- continue-on-error: true
284
- env:
285
- TD_API_KEY: ${{ secrets.TD_API_KEY }}
286
-
287
- - name: Upload debug artifacts
288
- if: steps.tests.outcome == 'failure'
289
- uses: actions/upload-artifact@v3
290
- with:
291
- name: test-failures
292
- path: |
293
- .testdriver/debug-screenshots/
294
- .testdriver/dashcam-urls.txt
295
-
296
- - name: Comment on PR with failures
297
- if: steps.tests.outcome == 'failure' && github.event_name == 'pull_request'
298
- uses: actions/github-script@v6
299
- with:
300
- script: |
301
- const fs = require('fs');
302
- const dashcamUrls = fs.readFileSync('.testdriver/dashcam-urls.txt', 'utf8');
303
-
304
- await github.rest.issues.createComment({
305
- issue_number: context.issue.number,
306
- owner: context.repo.owner,
307
- repo: context.repo.repo,
308
- body: `## ❌ Tests Failed\n\nView Dashcam replays:\n${dashcamUrls}`
309
- });
310
-
311
- - name: Fail workflow if tests failed
312
- if: steps.tests.outcome == 'failure'
313
- run: exit 1
314
- ```
315
-
316
- ## Caching for Faster Builds
317
-
318
- Cache node_modules for faster CI runs:
319
-
320
- <Tabs>
321
- <Tab title="GitHub Actions">
322
- ```yaml
323
- - name: Cache node modules
324
- uses: actions/cache@v3
325
- with:
326
- path: ~/.npm
327
- key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
328
- restore-keys: |
329
- ${{ runner.os }}-node-
330
- ```
331
- </Tab>
332
-
333
- <Tab title="GitLab CI">
334
- ```yaml
335
- cache:
336
- paths:
337
- - node_modules/
338
- key:
339
- files:
340
- - package-lock.json
341
- ```
342
- </Tab>
343
-
344
- <Tab title="CircleCI">
345
- ```yaml
346
- - restore_cache:
347
- keys:
348
- - node-deps-{{ checksum "package-lock.json" }}
349
- - node-deps-
350
-
351
- - save_cache:
352
- key: node-deps-{{ checksum "package-lock.json" }}
353
- paths:
354
- - node_modules
355
- ```
356
- </Tab>
357
- </Tabs>
358
-
359
- <Tip>
360
- TestDriver's selector cache is stored server-side, so you automatically get faster test runs without any CI configuration!
361
- </Tip>
362
-
363
- ## Notifications
364
-
365
- Send notifications on test failures:
366
-
367
- <Tabs>
368
- <Tab title="Slack">
369
- ```yaml
370
- - name: Notify Slack
371
- if: failure()
372
- uses: slackapi/slack-github-action@v1
373
- with:
374
- payload: |
375
- {
376
- "text": "Tests failed on ${{ github.repository }}",
377
- "blocks": [
378
- {
379
- "type": "section",
380
- "text": {
381
- "type": "mrkdwn",
382
- "text": "❌ Tests failed\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View run>"
383
- }
384
- }
385
- ]
386
- }
387
- env:
388
- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
389
- ```
390
- </Tab>
391
-
392
- <Tab title="Email">
393
- ```yaml
394
- - name: Send email
395
- if: failure()
396
- uses: dawidd6/action-send-mail@v3
397
- with:
398
- server_address: smtp.gmail.com
399
- server_port: 465
400
- username: ${{ secrets.EMAIL_USERNAME }}
401
- password: ${{ secrets.EMAIL_PASSWORD }}
402
- subject: Tests failed in ${{ github.repository }}
403
- body: Tests failed. View results at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
404
- to: team@example.com
405
- from: CI/CD
406
- ```
407
- </Tab>
408
-
409
- <Tab title="Teams">
410
- ```yaml
411
- - name: Notify Teams
412
- if: failure()
413
- run: |
414
- curl -H 'Content-Type: application/json' \
415
- -d '{"text": "Tests failed in ${{ github.repository }}"}' \
416
- ${{ secrets.TEAMS_WEBHOOK_URL }}
417
- ```
418
- </Tab>
419
- </Tabs>
420
-
421
- ## Branch Protection
422
-
423
- Require tests to pass before merging:
424
-
425
- <Steps>
426
- <Step title="GitHub">
427
- 1. Go to Settings → Branches
428
- 2. Add rule for main branch
429
- 3. Check "Require status checks to pass"
430
- 4. Select "test" job
431
- </Step>
432
-
433
- <Step title="GitLab">
434
- 1. Settings → Repository → Protected branches
435
- 2. Select main branch
436
- 3. Set "Allowed to merge" to "Developers + Maintainers"
437
- 4. Enable "Pipelines must succeed"
438
- </Step>
439
- </Steps>
440
-
441
- ## Cost Optimization
442
-
443
- Reduce CI costs with TestDriver:
444
-
445
- <AccordionGroup>
446
- <Accordion title="1. Leverage Test Caching">
447
- First CI run: Slow (builds cache)
448
- Subsequent runs: 1.7x faster (uses cache)
449
-
450
- No configuration needed - automatic!
451
- </Accordion>
452
-
453
- <Accordion title="2. Run Only Changed Tests">
454
- ```yaml
455
- # GitHub Actions
456
- - run: npx vitest run --changed HEAD~1
457
-
458
- # Only runs tests affected by PR changes
459
- ```
460
- </Accordion>
461
-
462
- <Accordion title="3. Use Parallel Execution">
463
- ```yaml
464
- strategy:
465
- matrix:
466
- shard: [1, 2, 3, 4]
467
- ```
468
-
469
- 4x parallel = 4x faster, but same total cost.
470
- </Accordion>
471
-
472
- <Accordion title="4. Skip Tests on Documentation Changes">
473
- ```yaml
474
- on:
475
- push:
476
- paths-ignore:
477
- - '**.md'
478
- - 'docs/**'
479
- ```
480
- </Accordion>
481
- </AccordionGroup>
482
-
483
- ## Monitoring CI Performance
484
-
485
- Track test performance over time:
486
-
487
- ```yaml
488
- - name: Upload timing data
489
- if: always()
490
- run: |
491
- npx vitest run --reporter=json > test-results.json
492
-
493
- - name: Analyze performance
494
- run: |
495
- # Send to your analytics service
496
- curl -X POST https://analytics.company.com/test-metrics \
497
- -H "Content-Type: application/json" \
498
- -d @test-results.json
499
- ```
500
-
501
- View performance trends at [console.testdriver.ai](https://console.testdriver.ai).
502
-
503
- ## Troubleshooting CI
504
-
505
- <AccordionGroup>
506
- <Accordion title="Tests Pass Locally, Fail in CI">
507
- **Common causes:**
508
-
509
- 1. **Environment differences** - Check Node version matches
510
- 2. **Missing environment variables** - Verify `TD_API_KEY` is set
511
- 3. **Timeout too short** - Increase test timeout
512
- 4. **Network restrictions** - Check firewall allows TestDriver API
513
-
514
- **Debug:**
515
- ```yaml
516
- - run: node --version
517
- - run: npm --version
518
- - run: env | grep TD_
519
- - run: npx vitest run --reporter=verbose
520
- ```
521
- </Accordion>
522
-
523
- <Accordion title="Intermittent Failures">
524
- **Solutions:**
525
-
526
- 1. **Increase timeout:**
527
- ```javascript vitest.config.mjs
528
- export default defineConfig({
529
- test: {
530
- testTimeout: 180000, // 3 minutes in CI
531
- },
532
- });
533
- ```
534
-
535
- 2. **Add retries:**
536
- ```javascript vitest.config.mjs
537
- export default defineConfig({
538
- test: {
539
- retry: 2, // Retry failed tests twice
540
- },
541
- });
542
- ```
543
-
544
- 3. **Check Dashcam replays** for both passing and failing runs
545
- </Accordion>
546
-
547
- <Accordion title="Rate Limiting">
548
- If running many tests concurrently:
549
-
550
- ```javascript vitest.config.mjs
551
- export default defineConfig({
552
- test: {
553
- maxConcurrency: 5, // Limit concurrent tests
554
- },
555
- });
556
- ```
557
-
558
- Contact sales for higher rate limits.
559
- </Accordion>
560
- </AccordionGroup>
561
-
562
- ## Next Steps
563
-
564
- <CardGroup cols={2}>
565
- <Card
566
- title="GitHub Actions"
567
- icon="github"
568
- href="/v7/guides/ci-cd/github-actions"
569
- >
570
- Complete GitHub Actions setup
571
- </Card>
572
-
573
- <Card
574
- title="GitLab CI"
575
- icon="gitlab"
576
- href="/v7/guides/ci-cd/gitlab"
577
- >
578
- Complete GitLab CI setup
579
- </Card>
580
-
581
- <Card
582
- title="CircleCI"
583
- icon="circle"
584
- href="/v7/guides/ci-cd/circleci"
585
- >
586
- Complete CircleCI setup
587
- </Card>
588
-
589
- <Card
590
- title="Jenkins"
591
- icon="jenkins"
592
- href="/v7/guides/ci-cd/jenkins"
593
- >
594
- Complete Jenkins setup
595
- </Card>
596
-
597
- <Card
598
- title="All CI/CD Guides"
599
- icon="arrows-spin"
600
- href="/v7/guides/ci-cd/overview"
601
- >
602
- View all platform guides
603
- </Card>
604
-
605
- <Card
606
- title="Performance Optimization"
607
- icon="gauge-high"
608
- href="/v7/guides/performance"
609
- >
610
- Optimize test performance
611
- </Card>
612
- </CardGroup>