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
package/docs/docs.json CHANGED
@@ -187,132 +187,100 @@
187
187
  }
188
188
  ]
189
189
  },
190
- {
191
- "version": "v7",
192
- "groups": [
193
- {
194
- "group": "Getting Started",
195
- "pages": [
196
- "/v7/getting-started/quickstart",
197
- "/v7/getting-started/writing-tests",
198
- "/v7/getting-started/running-tests",
199
- "/v7/getting-started/debugging-tests",
200
- "/v7/getting-started/setting-up-in-ci"
201
- ]
202
- },
203
- {
204
- "group": "Examples",
205
- "pages": [
206
- "/v7/presets/chrome",
207
- "/v7/presets/chrome-extension",
208
- "/v7/presets/vscode",
209
- "/v7/presets/electron"
210
- ]
211
- },
212
- {
213
- "group": "Guides",
214
- "pages": [
215
- {
216
- "group": "Selectorless Testing",
217
- "icon": "sparkles",
218
- "pages": [
219
- "/v7/features/easy-to-write",
220
- "/v7/features/coverage",
221
- "/v7/features/powerful",
222
- "/v7/features/ai-native"
223
- ]
224
- },
225
- {
226
- "group": "Sandbox Environments",
227
- "icon": "cube",
228
- "pages": [
229
- "/v7/features/managed-sandboxes",
230
- "/v7/features/sandbox-customization",
231
- "/v7/features/enterprise"
232
- ]
233
- },
234
- {
235
- "group": "Test Observability",
236
- "icon": "microscope",
237
- "pages": [
238
- "/v7/features/application-logs",
239
- "/v7/features/browser-logs",
240
- "/v7/features/network-monitoring",
241
- "/v7/features/system-performance"
242
- ]
243
- },
244
- {
245
- "group": "Performance & Reliability",
246
- "icon": "gauge-high",
247
- "pages": [
248
- "/v7/features/fast",
249
- "/v7/features/stable",
250
- "/v7/features/parallel-execution",
251
- "/v7/features/cache-management"
252
- ]
253
- },
254
- {
255
- "group": "Testing at Scale",
256
- "icon": "arrow-up-right-dots",
257
- "pages": [
258
- "/v7/features/data-driven-testing",
259
- "/v7/features/continuous-testing"
260
- ]
261
- },
262
- {
263
- "group": "Reports & Analytics",
264
- "icon": "chart-line",
265
- "pages": [
266
- "/v7/features/test-reports",
267
- "/v7/features/test-analytics",
268
- "/v7/features/test-cases",
269
- "/v7/features/test-replays"
270
- ]
271
- }
272
- ]
273
- },
274
- {
275
- "group": "Reference",
276
- "icon": "book",
277
- "pages": [
278
- {
279
- "group": "Actions",
280
- "icon": "bolt",
281
- "pages": [
282
- "/v7/api/act",
283
- "/v7/api/assert",
284
- "/v7/api/assertions",
285
- "/v7/api/click",
286
- "/v7/api/doubleClick",
287
- "/v7/api/exec",
288
- "/v7/api/find",
289
- "/v7/api/focusApplication",
290
- "/v7/api/hover",
291
- "/v7/api/mouseDown",
292
- "/v7/api/mouseUp",
293
- "/v7/api/pressKeys",
294
- "/v7/api/rightClick",
295
- "/v7/api/type",
296
- "/v7/api/scroll"
297
- ]
298
- },
299
- {
300
- "group": "Client SDK",
301
- "icon": "code",
302
- "pages": [
303
- "/v7/api/client",
304
- "/v7/api/elements",
305
- "/v7/api/sandbox",
306
- "/v7/api/dashcam"
307
- ]
308
- }
309
- ]
310
- }
311
- ]
312
- }
313
-
190
+ {
191
+ "version": "v7",
192
+ "groups": [
193
+ {
194
+ "group": "Overview",
195
+ "pages": [
196
+ "/v7/what-is-testdriver",
197
+ "/v7/quickstart",
198
+ "/v7/examples",
199
+ {
200
+ "group": "Plans & Pricing",
201
+ "icon": "server",
202
+ "pages": [
203
+ "/v7/cloud",
204
+ {
205
+ "group": "Self-Hosted",
206
+ "icon": "server",
207
+ "pages": [
208
+ "/v7/self-hosted",
209
+ "/v7/aws-setup"
210
+ ]
211
+ },
212
+ "/v7/enterprise"
213
+ ]
214
+ }
215
+ ]
216
+ },
217
+ {
218
+ "group": "Creating Tests",
219
+ "pages": [
220
+ "/v7/generating-tests",
221
+ "/v7/locating-elements",
222
+ "/v7/waiting-for-elements",
223
+ "/v7/performing-actions",
224
+ "/v7/making-assertions"
225
+ ]
226
+ },
227
+ {
228
+ "group": "Running Tests",
229
+ "pages": [
230
+ "/v7/running-tests",
231
+ "/v7/caching",
232
+ "/v7/ci-cd"
233
+ ]
234
+ },
235
+ {
236
+ "group": "Scaling",
237
+ "pages": [
238
+ "/v7/variables",
239
+ "/v7/secrets",
240
+ "/v7/reusable-code",
241
+ "/v7/customizing-devices"
242
+ ]
243
+ },
244
+ {
245
+ "group": "Reference",
246
+ "icon": "book",
247
+ "pages": [
248
+ {
249
+ "group": "Actions",
250
+ "icon": "bolt",
251
+ "pages": [
252
+ "/v7/ai",
253
+ "/v7/assert",
254
+ "/v7/click",
255
+ "/v7/double-click",
256
+ "/v7/exec",
257
+ "/v7/find",
258
+ "/v7/focus-application",
259
+ "/v7/hover",
260
+ "/v7/mouse-down",
261
+ "/v7/mouse-up",
262
+ "/v7/press-keys",
263
+ "/v7/right-click",
264
+ "/v7/type",
265
+ "/v7/scroll"
266
+ ]
267
+ },
268
+ {
269
+ "group": "Client SDK",
270
+ "icon": "code",
271
+ "pages": [
272
+ "/v7/client",
273
+ "/v7/elements",
274
+ "/v7/sandbox",
275
+ "/v7/dashcam"
276
+ ]
277
+ }
278
+ ]
279
+ }
280
+ ]
281
+ }
314
282
  ]
315
- },
283
+ },
316
284
  "logo": {
317
285
  "light": "/images/template/light.png",
318
286
  "dark": "/images/template/dark.png",
@@ -44,7 +44,6 @@ This system provides comprehensive test execution tracking, linking test runs wi
44
44
  │ │ │ │
45
45
  │ │ • TdTestRun │ │
46
46
  │ │ • TdTestCase │ │
47
- │ │ • TdSandbox │ │
48
47
  │ │ • Replay │ │
49
48
  │ └────────────────┘ │
50
49
  │ │
@@ -95,7 +94,6 @@ Represents a complete test suite execution (e.g., `npx vitest run`).
95
94
 
96
95
  **Relationships:**
97
96
  - `team`: Owner team
98
- - `sandbox`: TdSandbox where tests ran
99
97
  - `testCases`: Collection of TdTestCase
100
98
  - `replays`: Associated Replay records
101
99
 
@@ -114,36 +112,13 @@ Represents an individual test within a test run.
114
112
 
115
113
  **Relationships:**
116
114
  - `testRun`: Parent TdTestRun
117
- - `replay`: Associated Replay record
118
-
119
- ### TdSandbox
120
- Represents a spawned VM/sandbox instance.
121
-
122
- **Key Fields:**
123
- - `sandboxId`: Unique identifier
124
- - `platform`: windows | mac | linux
125
- - `status`: provisioning | ready | running | stopped | terminated
126
- - `instanceId`, `instanceType`: AWS EC2 details
127
- - `ipAddress`, `vncUrl`, `wsUrl`: Connection details
128
- - `spawnTime`, `readyTime`, `terminateTime`: Lifecycle timestamps
129
- - `dashcamAuth`: Whether dashcam was authenticated
130
- - `dashcamProjectId`: Dashcam project for replays
131
-
132
- **Relationships:**
133
- - `team`: Owner team
134
- - `user`: User who spawned it
135
- - `testRuns`: Tests that ran on this sandbox
136
- - `replays`: Dashcam recordings from this sandbox
137
-
138
- **Note:** Sandbox creation/updates happen via WebSocket (not REST API) as part of the sandbox provisioning flow.
139
-
115
+ - `replay`: Associated Replay recor
140
116
  ### Replay (Extended)
141
117
  Existing model extended with test run associations.
142
118
 
143
119
  **New Fields:**
144
120
  - `tdTestRun`: Associated test run
145
121
  - `tdTestCase`: Associated test case
146
- - `tdSandbox`: Sandbox where recorded
147
122
 
148
123
  ## API Endpoints
149
124
 
@@ -1,6 +1,6 @@
1
1
  ---
2
- title: "Caching"
3
- sidebarTitle: "Caching"
2
+ title: "Caching Prompts"
3
+ sidebarTitle: "Caching Prompts"
4
4
  description: "How TestDriver caches AI responses and element locations for faster tests"
5
5
  icon: "bolt"
6
6
  ---
@@ -418,69 +418,3 @@ npx vitest run verify.test.js
418
418
  For on-premise deployment, see [self-hosting guide](/v7/guides/self-hosting).
419
419
  </Accordion>
420
420
  </AccordionGroup>
421
-
422
- ## Next Steps
423
-
424
- Now that you have TestDriver installed:
425
-
426
- <CardGroup cols={2}>
427
- <Card
428
- title="Write Your First Test"
429
- icon="pencil"
430
- href="/v7/getting-started/writing-tests"
431
- >
432
- Learn how to write effective TestDriver tests
433
- </Card>
434
-
435
- <Card
436
- title="Generate Tests with AI"
437
- icon="wand-magic-sparkles"
438
- href="/v7/getting-started/generating-tests"
439
- >
440
- Use Claude to generate tests automatically
441
- </Card>
442
-
443
- <Card
444
- title="View Examples"
445
- icon="code"
446
- href="/v7/presets/chrome"
447
- >
448
- See TestDriver in action with examples
449
- </Card>
450
-
451
- <Card
452
- title="API Reference"
453
- icon="book"
454
- href="/v7/api/client"
455
- >
456
- Explore all available methods
457
- </Card>
458
- </CardGroup>
459
-
460
- ## Getting Help
461
-
462
- <CardGroup cols={3}>
463
- <Card
464
- title="Discord"
465
- icon="discord"
466
- href="https://discord.com/invite/cWDFW8DzPm"
467
- >
468
- Join our community
469
- </Card>
470
-
471
- <Card
472
- title="GitHub"
473
- icon="github"
474
- href="https://github.com/testdriverai"
475
- >
476
- Report issues
477
- </Card>
478
-
479
- <Card
480
- title="Documentation"
481
- icon="book"
482
- href="/v7/guides/troubleshooting"
483
- >
484
- Troubleshooting guide
485
- </Card>
486
- </CardGroup>
@@ -1,100 +1,11 @@
1
1
  ---
2
- title: "Selectorless Coverage"
2
+ title: "Common Patterns"
3
3
  description: "Test everything from desktop apps to chatbots to video content"
4
4
  icon: "radar"
5
5
  ---
6
6
 
7
7
  TestDriver provides unmatched testing coverage across platforms, applications, and content types. From desktop applications to AI chatbots, from PDFs to videos, TestDriver can test it all.
8
8
 
9
- ## Application Types
10
-
11
- ### Desktop Applications
12
-
13
- Test native desktop applications on Windows, macOS, and Linux with the same simple API:
14
-
15
- ```javascript
16
- import { test } from 'vitest';
17
- import { desktop } from 'testdriverai/presets';
18
-
19
- test('desktop app with file operations', async (context) => {
20
- const { testdriver } = await desktop(context, {
21
- appPath: '/Applications/MyApp.app',
22
- os: 'mac'
23
- });
24
-
25
- await testdriver.find('File menu').click();
26
- await testdriver.find('Open').click();
27
- await testdriver.find('Documents folder').doubleClick();
28
- await testdriver.find('test.txt').click();
29
- await testdriver.find('Open button').click();
30
- await testdriver.assert('test.txt is displayed in the editor');
31
- });
32
- ```
33
-
34
- <Card title="Desktop Preset" icon="desktop" href="/v7/presets/desktop">
35
- Complete guide to testing desktop applications
36
- </Card>
37
-
38
- ### VS Code Extensions
39
-
40
- Test IDE extensions with full access to the VS Code environment:
41
-
42
- ```javascript
43
- import { test } from 'vitest';
44
- import { vscode } from 'testdriverai/presets';
45
-
46
- test('vscode extension with settings', async (context) => {
47
- const { testdriver } = await vscode(context, {
48
- workspace: '/tmp/test-project',
49
- extensions: ['your-extension-id']
50
- });
51
-
52
- // Open settings
53
- await testdriver.pressKeys(['cmd', ',']);
54
- await testdriver.find('search settings input').type('your.extension.setting');
55
- await testdriver.find('Enable feature checkbox').click();
56
-
57
- // Verify extension behavior
58
- await testdriver.pressKeys(['cmd', 'shift', 'p']);
59
- await testdriver.type('Your Extension Command');
60
- await testdriver.pressKeys(['enter']);
61
- await testdriver.assert('Extension panel is visible');
62
- });
63
- ```
64
-
65
- <Card title="VS Code Preset" icon="code" href="/v7/presets/vscode">
66
- Complete guide to testing VS Code extensions
67
- </Card>
68
-
69
- ### Chrome Extensions
70
-
71
- Test browser extensions in their natural environment with access to popups, content scripts, and background pages:
72
-
73
- ```javascript
74
- import { test } from 'vitest';
75
- import { chromeExtension } from 'testdriverai/presets';
76
-
77
- test('chrome extension functionality', async (context) => {
78
- const { testdriver } = await chromeExtension(context, {
79
- extensionPath: './my-extension',
80
- url: 'https://example.com'
81
- });
82
-
83
- // Test extension popup
84
- await testdriver.find('extension icon').click();
85
- await testdriver.find('Enable feature toggle').click();
86
- await testdriver.assert('Feature enabled message appears');
87
-
88
- // Test content script injection
89
- await testdriver.assert('Extension content is visible on page');
90
- });
91
- ```
92
-
93
- <Card title="Chrome Extension Preset" icon="puzzle-piece" href="/v7/presets/chrome-extension">
94
- Complete guide to testing Chrome extensions
95
- </Card>
96
-
97
- ## Advanced Use Cases
98
9
 
99
10
  ### AI Chatbots
100
11
 
@@ -185,7 +185,6 @@ await client.completeTestRun({
185
185
  **API (Backend)**
186
186
  - `api/models/TdTestRun.js` - Test run model
187
187
  - `api/models/TdTestCase.js` - Test case model
188
- - `api/models/TdSandbox.js` - Sandbox tracking model
189
188
  - `api/controllers/testdriver/testdriver-test-run-create.js` - Create test run endpoint
190
189
  - `api/controllers/testdriver/testdriver-test-run-complete.js` - Complete test run endpoint
191
190
  - `api/controllers/testdriver/testdriver-test-case-create.js` - Record test case endpoint
@@ -344,13 +344,35 @@ TestDriver integrates seamlessly with all major CI/CD platforms:
344
344
 
345
345
  ## JUnit Reports
346
346
 
347
- Generate JUnit XML reports for test result aggregation:
347
+ Generate JUnit XML reports for test result aggregation and CI/CD integration.
348
+
349
+ ### Basic Setup
350
+
351
+ Configure Vitest to output JUnit reports by adding a reporter to your config:
352
+
353
+ ```javascript vitest.config.mjs
354
+ import { defineConfig } from 'vitest/config';
355
+
356
+ export default defineConfig({
357
+ test: {
358
+ testTimeout: 120000,
359
+ hookTimeout: 120000,
360
+ reporters: ['default', 'junit'],
361
+ outputFile: {
362
+ junit: 'test-report.junit.xml'
363
+ }
364
+ },
365
+ });
366
+ ```
367
+
368
+ Or run from the command line:
348
369
 
349
370
  ```bash
350
- # Generate JUnit report
351
371
  npx vitest run --reporter=junit --outputFile=test-results.xml
352
372
  ```
353
373
 
374
+ This generates a standard JUnit XML report:
375
+
354
376
  ```xml test-results.xml
355
377
  <?xml version="1.0" encoding="UTF-8"?>
356
378
  <testsuites name="vitest tests" tests="12" failures="0" errors="0" time="125.3">
@@ -359,12 +381,112 @@ npx vitest run --reporter=junit --outputFile=test-results.xml
359
381
  <testcase name="invalid credentials show error" time="9.8" />
360
382
  <testcase name="password reset works" time="9.0" />
361
383
  </testsuite>
362
- <!-- More test suites -->
363
384
  </testsuites>
364
385
  ```
365
386
 
387
+ ### GitHub Actions PR Comments
388
+
389
+ Use JUnit reports to automatically post test results as comments on pull requests. This provides immediate visibility into test failures without leaving GitHub.
390
+
391
+ ```yaml .github/workflows/test.yml
392
+ name: E2E Tests
393
+
394
+ on:
395
+ pull_request:
396
+ branches: [main]
397
+
398
+ permissions:
399
+ contents: read
400
+ pull-requests: write
401
+ checks: write
402
+
403
+ jobs:
404
+ test:
405
+ runs-on: ubuntu-latest
406
+
407
+ steps:
408
+ - uses: actions/checkout@v4
409
+
410
+ - name: Setup Node.js
411
+ uses: actions/setup-node@v4
412
+ with:
413
+ node-version: '20'
414
+ cache: 'npm'
415
+
416
+ - name: Install dependencies
417
+ run: npm ci
418
+
419
+ - name: Run tests
420
+ run: npx vitest run
421
+ env:
422
+ TD_API_KEY: ${{ secrets.TD_API_KEY }}
423
+
424
+ - name: Publish Test Results
425
+ uses: EnricoMi/publish-unit-test-result-action@v2
426
+ if: always()
427
+ with:
428
+ files: test-report.junit.xml
429
+ comment_mode: always
430
+ check_name: Test Results
431
+ ```
432
+
433
+ <Note>
434
+ The `if: always()` ensures test results are published even when tests fail, so you always see what went wrong.
435
+ </Note>
436
+
437
+ The [publish-unit-test-result-action](https://github.com/EnricoMi/publish-unit-test-result-action) creates:
438
+
439
+ - **PR comments** with a summary table of passed/failed tests
440
+ - **Check runs** visible in the GitHub PR checks tab
441
+ - **Annotations** highlighting failed tests in the diff view
442
+
443
+ ### Multi-Platform Testing with JUnit
444
+
445
+ When testing across multiple platforms, use separate check names to distinguish results:
446
+
447
+ ```yaml .github/workflows/test.yml
448
+ jobs:
449
+ test-linux:
450
+ runs-on: ubuntu-latest
451
+ steps:
452
+ # ... setup steps ...
453
+
454
+ - name: Run Linux tests
455
+ run: npx vitest run
456
+ env:
457
+ TD_API_KEY: ${{ secrets.TD_API_KEY }}
458
+ TD_OS: linux
459
+
460
+ - name: Publish Test Results
461
+ uses: EnricoMi/publish-unit-test-result-action@v2
462
+ if: always()
463
+ with:
464
+ files: test-report.junit.xml
465
+ comment_mode: always
466
+ check_name: Test Results (Linux)
467
+
468
+ test-windows:
469
+ runs-on: ubuntu-latest
470
+ steps:
471
+ # ... setup steps ...
472
+
473
+ - name: Run Windows tests
474
+ run: npx vitest run
475
+ env:
476
+ TD_API_KEY: ${{ secrets.TD_API_KEY }}
477
+ TD_OS: windows
478
+
479
+ - name: Publish Test Results
480
+ uses: EnricoMi/publish-unit-test-result-action@v2
481
+ if: always()
482
+ with:
483
+ files: test-report.junit.xml
484
+ comment_mode: always
485
+ check_name: Test Results (Windows)
486
+ ```
487
+
366
488
  <Check>
367
- JUnit reports integrate with Jenkins, Azure DevOps, TeamCity, and other CI platforms for test result visualization.
489
+ JUnit reports integrate with Jenkins, Azure DevOps, TeamCity, GitLab, and other CI platforms for test result visualization.
368
490
  </Check>
369
491
 
370
492
  ## Familiar Test Syntax