testdriverai 7.1.3 → 7.2.0

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 (78) hide show
  1. package/.github/workflows/acceptance.yaml +81 -0
  2. package/.github/workflows/publish.yaml +44 -0
  3. package/.github/workflows/test-init.yml +145 -0
  4. package/agent/index.js +18 -19
  5. package/agent/lib/commander.js +2 -2
  6. package/agent/lib/commands.js +324 -124
  7. package/agent/lib/redraw.js +99 -39
  8. package/agent/lib/sandbox.js +98 -6
  9. package/agent/lib/sdk.js +25 -0
  10. package/agent/lib/system.js +2 -1
  11. package/agent/lib/validation.js +6 -6
  12. package/docs/docs.json +211 -101
  13. package/docs/snippets/tests/type-repeated-replay.mdx +1 -1
  14. package/docs/v7/_drafts/caching-selectors.mdx +24 -0
  15. package/docs/v7/_drafts/migration.mdx +3 -3
  16. package/docs/v7/api/act.mdx +2 -2
  17. package/docs/v7/api/assert.mdx +2 -2
  18. package/docs/v7/api/assertions.mdx +21 -21
  19. package/docs/v7/api/elements.mdx +78 -0
  20. package/docs/v7/api/find.mdx +38 -0
  21. package/docs/v7/api/focusApplication.mdx +2 -2
  22. package/docs/v7/api/hover.mdx +2 -2
  23. package/docs/v7/features/ai-native.mdx +57 -71
  24. package/docs/v7/features/application-logs.mdx +353 -0
  25. package/docs/v7/features/browser-logs.mdx +414 -0
  26. package/docs/v7/features/cache-management.mdx +402 -0
  27. package/docs/v7/features/continuous-testing.mdx +346 -0
  28. package/docs/v7/features/coverage.mdx +508 -0
  29. package/docs/v7/features/data-driven-testing.mdx +441 -0
  30. package/docs/v7/features/easy-to-write.mdx +2 -73
  31. package/docs/v7/features/enterprise.mdx +155 -39
  32. package/docs/v7/features/fast.mdx +63 -81
  33. package/docs/v7/features/managed-sandboxes.mdx +384 -0
  34. package/docs/v7/features/network-monitoring.mdx +568 -0
  35. package/docs/v7/features/observable.mdx +3 -22
  36. package/docs/v7/features/parallel-execution.mdx +381 -0
  37. package/docs/v7/features/powerful.mdx +1 -1
  38. package/docs/v7/features/reports.mdx +414 -0
  39. package/docs/v7/features/sandbox-customization.mdx +229 -0
  40. package/docs/v7/features/scalable.mdx +217 -2
  41. package/docs/v7/features/stable.mdx +106 -147
  42. package/docs/v7/features/system-performance.mdx +616 -0
  43. package/docs/v7/features/test-analytics.mdx +373 -0
  44. package/docs/v7/features/test-cases.mdx +393 -0
  45. package/docs/v7/features/test-replays.mdx +408 -0
  46. package/docs/v7/features/test-reports.mdx +308 -0
  47. package/docs/v7/getting-started/{running-and-debugging.mdx → debugging-tests.mdx} +12 -142
  48. package/docs/v7/getting-started/quickstart.mdx +22 -305
  49. package/docs/v7/getting-started/running-tests.mdx +173 -0
  50. package/docs/v7/overview/readme.mdx +1 -1
  51. package/docs/v7/overview/what-is-testdriver.mdx +2 -14
  52. package/docs/v7/presets/chrome-extension.mdx +147 -122
  53. package/interfaces/cli/commands/init.js +78 -20
  54. package/interfaces/cli/lib/base.js +3 -2
  55. package/interfaces/logger.js +0 -2
  56. package/interfaces/shared-test-state.mjs +0 -5
  57. package/interfaces/vitest-plugin.mjs +69 -42
  58. package/lib/core/Dashcam.js +65 -66
  59. package/lib/vitest/hooks.mjs +42 -50
  60. package/manual/test-init-command.js +223 -0
  61. package/package.json +2 -2
  62. package/schema.json +5 -5
  63. package/sdk-log-formatter.js +351 -176
  64. package/sdk.d.ts +8 -8
  65. package/sdk.js +436 -121
  66. package/setup/aws/cloudformation.yaml +2 -2
  67. package/setup/aws/self-hosted.yml +1 -1
  68. package/test/testdriver/chrome-extension.test.mjs +55 -72
  69. package/test/testdriver/element-not-found.test.mjs +2 -1
  70. package/test/testdriver/hover-image.test.mjs +1 -1
  71. package/test/testdriver/hover-text-with-description.test.mjs +0 -3
  72. package/test/testdriver/scroll-until-text.test.mjs +10 -6
  73. package/test/testdriver/setup/lifecycleHelpers.mjs +19 -24
  74. package/test/testdriver/setup/testHelpers.mjs +18 -23
  75. package/vitest.config.mjs +3 -3
  76. package/.github/workflows/linux-tests.yml +0 -28
  77. package/docs/v7/getting-started/generating-tests.mdx +0 -525
  78. package/test/testdriver/auto-cache-key-demo.test.mjs +0 -56
@@ -0,0 +1,508 @@
1
+ ---
2
+ title: "Selectorless Coverage"
3
+ description: "Test everything from desktop apps to chatbots to video content"
4
+ icon: "radar"
5
+ ---
6
+
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
+
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
+
99
+ ### AI Chatbots
100
+
101
+ Test conversational AI interfaces with multi-turn interactions:
102
+
103
+ ```javascript
104
+ import { test } from 'vitest';
105
+ import { chrome } from 'testdriverai/presets';
106
+
107
+ test('ai chatbot conversation', async (context) => {
108
+ const { testdriver } = await chrome(context, {
109
+ url: 'https://chatbot.example.com'
110
+ });
111
+
112
+ // Start conversation
113
+ await testdriver.find('message input').type('What is your return policy?');
114
+ await testdriver.find('send button').click();
115
+
116
+ // Verify AI response
117
+ await testdriver.assert('response mentions 30-day return window');
118
+
119
+ // Follow-up question
120
+ await testdriver.find('message input').type('Do I need the original packaging?');
121
+ await testdriver.find('send button').click();
122
+ await testdriver.assert('response mentions packaging requirements');
123
+
124
+ // Verify conversation history
125
+ await testdriver.assert('both questions and answers are visible in chat history');
126
+ });
127
+ ```
128
+
129
+ ### PDF Generation
130
+
131
+ Test PDF generation and content verification:
132
+
133
+ ```javascript
134
+ import { test } from 'vitest';
135
+ import { chrome } from 'testdriverai/presets';
136
+
137
+ test('pdf generation and content', async (context) => {
138
+ const { testdriver } = await chrome(context, {
139
+ url: 'https://myapp.com/reports'
140
+ });
141
+
142
+ await testdriver.find('Generate Report button').click();
143
+ await testdriver.find('PDF format option').click();
144
+ await testdriver.find('Download button').click();
145
+
146
+ // Wait for PDF to generate
147
+ await testdriver.assert('Download complete notification appears');
148
+
149
+ // Open PDF
150
+ await testdriver.find('downloaded file').click();
151
+
152
+ // Verify PDF content
153
+ await testdriver.assert('Report title is visible');
154
+ await testdriver.assert('Table with data is present');
155
+ await testdriver.assert('Page numbers are displayed');
156
+ });
157
+ ```
158
+
159
+ ### Spelling & Grammar
160
+
161
+ Test spell-check and grammar checking functionality:
162
+
163
+ ```javascript
164
+ import { test } from 'vitest';
165
+ import { chrome } from 'testdriverai/presets';
166
+
167
+ test('spelling and grammar checker', async (context) => {
168
+ const { testdriver } = await chrome(context, {
169
+ url: 'https://editor.example.com'
170
+ });
171
+
172
+ // Type text with intentional errors
173
+ await testdriver.find('editor').type('This is a tset with grammer errors.');
174
+
175
+ // Verify spell-check highlighting
176
+ await testdriver.assert('the word "tset" is underlined in red');
177
+ await testdriver.assert('the word "grammer" is underlined');
178
+
179
+ // Test correction
180
+ await testdriver.find('underlined word "tset"').rightClick();
181
+ await testdriver.find('suggestion "test"').click();
182
+ await testdriver.assert('word is corrected to "test"');
183
+ });
184
+ ```
185
+
186
+ ### OAuth Signup & Login
187
+
188
+ Test OAuth flows with third-party authentication providers:
189
+
190
+ ```javascript
191
+ import { test } from 'vitest';
192
+ import { chrome } from 'testdriverai/presets';
193
+
194
+ test('oauth login flow', async (context) => {
195
+ const { testdriver } = await chrome(context, {
196
+ url: 'https://myapp.com/login'
197
+ });
198
+
199
+ // Start OAuth flow
200
+ await testdriver.find('Sign in with Google button').click();
201
+
202
+ // Handle OAuth popup/redirect
203
+ await testdriver.find('Google email input').type('test@example.com');
204
+ await testdriver.find('Next button').click();
205
+ await testdriver.find('password input').type(process.env.TEST_PASSWORD, { secret: true });
206
+ await testdriver.find('Sign in button').click();
207
+
208
+ // Verify consent screen
209
+ await testdriver.assert('permission request screen is displayed');
210
+ await testdriver.find('Allow button').click();
211
+
212
+ // Verify redirect back to app
213
+ await testdriver.assert('user is logged in');
214
+ await testdriver.assert('user profile picture is visible');
215
+ });
216
+ ```
217
+
218
+ ### File System & Uploads
219
+
220
+ Test file upload functionality and file system interactions:
221
+
222
+ ```javascript
223
+ import { test } from 'vitest';
224
+ import { chrome } from 'testdriverai/presets';
225
+
226
+ test('file upload and processing', async (context) => {
227
+ const { testdriver } = await chrome(context, {
228
+ url: 'https://myapp.com/upload'
229
+ });
230
+
231
+ // Click upload button
232
+ await testdriver.find('Upload file button').click();
233
+
234
+ // Navigate file picker
235
+ await testdriver.find('Documents folder').doubleClick();
236
+ await testdriver.find('test-image.png').click();
237
+ await testdriver.find('Open button').click();
238
+
239
+ // Verify upload
240
+ await testdriver.assert('test-image.png is listed');
241
+ await testdriver.assert('Upload progress bar reaches 100%');
242
+ await testdriver.assert('Upload successful message appears');
243
+
244
+ // Verify file preview
245
+ await testdriver.assert('Image preview is displayed');
246
+ });
247
+ ```
248
+
249
+ ## Content Types
250
+
251
+ ### Image Content
252
+
253
+ Test applications that work with images, including editing, filtering, and recognition:
254
+
255
+ ```javascript
256
+ import { test } from 'vitest';
257
+ import { chrome } from 'testdriverai/presets';
258
+
259
+ test('image editor functionality', async (context) => {
260
+ const { testdriver } = await chrome(context, {
261
+ url: 'https://editor.example.com'
262
+ });
263
+
264
+ await testdriver.find('Upload image button').click();
265
+ await testdriver.find('sample-photo.jpg').click();
266
+ await testdriver.find('Open').click();
267
+
268
+ // Test image editing
269
+ await testdriver.find('Filters tab').click();
270
+ await testdriver.find('Black and white filter').click();
271
+ await testdriver.assert('Image is displayed in black and white');
272
+
273
+ // Test cropping
274
+ await testdriver.find('Crop tool').click();
275
+ await testdriver.find('Square aspect ratio').click();
276
+ await testdriver.find('Apply crop button').click();
277
+ await testdriver.assert('Image is cropped to square');
278
+ });
279
+ ```
280
+
281
+ ### Video Content
282
+
283
+ Test video players, editing, and streaming functionality:
284
+
285
+ ```javascript
286
+ import { test } from 'vitest';
287
+ import { chrome } from 'testdriverai/presets';
288
+
289
+ test('video player controls', async (context) => {
290
+ const { testdriver } = await chrome(context, {
291
+ url: 'https://video.example.com/watch?v=abc123'
292
+ });
293
+
294
+ // Test playback
295
+ await testdriver.find('play button').click();
296
+ await testdriver.assert('video is playing');
297
+
298
+ // Test controls
299
+ await testdriver.find('pause button').click();
300
+ await testdriver.assert('video is paused');
301
+
302
+ await testdriver.find('volume control').click();
303
+ await testdriver.find('mute button').click();
304
+ await testdriver.assert('video is muted');
305
+
306
+ // Test fullscreen
307
+ await testdriver.find('fullscreen button').click();
308
+ await testdriver.assert('video is in fullscreen mode');
309
+
310
+ // Test quality settings
311
+ await testdriver.find('settings button').click();
312
+ await testdriver.find('quality option').click();
313
+ await testdriver.find('1080p').click();
314
+ await testdriver.assert('video quality is set to 1080p');
315
+ });
316
+ ```
317
+
318
+ ## Accessibility & UI Features
319
+
320
+ ### OS Accessibility Features
321
+
322
+ Test applications with screen readers, keyboard navigation, and other accessibility features:
323
+
324
+ ```javascript
325
+ import { test } from 'vitest';
326
+ import { desktop } from 'testdriverai/presets';
327
+
328
+ test('accessibility features', async (context) => {
329
+ const { testdriver } = await desktop(context, {
330
+ appPath: '/Applications/MyApp.app',
331
+ os: 'mac'
332
+ });
333
+
334
+ // Test keyboard navigation
335
+ await testdriver.pressKeys(['tab']);
336
+ await testdriver.assert('first interactive element is focused');
337
+
338
+ await testdriver.pressKeys(['tab']);
339
+ await testdriver.pressKeys(['tab']);
340
+ await testdriver.pressKeys(['enter']);
341
+
342
+ // Test ARIA labels
343
+ await testdriver.assert('close button has accessible name "Close dialog"');
344
+
345
+ // Test high contrast mode
346
+ await testdriver.find('Settings menu').click();
347
+ await testdriver.find('Accessibility').click();
348
+ await testdriver.find('High contrast mode toggle').click();
349
+ await testdriver.assert('UI is displayed in high contrast');
350
+ });
351
+ ```
352
+
353
+ ### Light / Dark Mode
354
+
355
+ Test theme switching and appearance preferences:
356
+
357
+ ```javascript
358
+ import { test } from 'vitest';
359
+ import { chrome } from 'testdriverai/presets';
360
+
361
+ test('theme switching', async (context) => {
362
+ const { testdriver } = await chrome(context, {
363
+ url: 'https://myapp.com'
364
+ });
365
+
366
+ // Check default theme
367
+ await testdriver.assert('app is in light mode');
368
+
369
+ // Switch to dark mode
370
+ await testdriver.find('theme toggle').click();
371
+ await testdriver.assert('app is in dark mode');
372
+ await testdriver.assert('background is dark');
373
+ await testdriver.assert('text is light colored');
374
+
375
+ // Verify persistence
376
+ await testdriver.find('refresh button').click();
377
+ await testdriver.assert('app is still in dark mode after refresh');
378
+
379
+ // Test auto theme
380
+ await testdriver.find('settings menu').click();
381
+ await testdriver.find('Appearance').click();
382
+ await testdriver.find('Auto theme option').click();
383
+ await testdriver.assert('theme follows system preference');
384
+ });
385
+ ```
386
+
387
+ ## Web Technologies
388
+
389
+ ### `<iframe>` Content
390
+
391
+ Test embedded content and cross-frame interactions:
392
+
393
+ ```javascript
394
+ import { test } from 'vitest';
395
+ import { chrome } from 'testdriverai/presets';
396
+
397
+ test('iframe interactions', async (context) => {
398
+ const { testdriver } = await chrome(context, {
399
+ url: 'https://myapp.com/embedded'
400
+ });
401
+
402
+ // Interact with iframe content
403
+ await testdriver.find('submit button in the payment iframe').click();
404
+ await testdriver.find('card number input in iframe').type('4242424242424242');
405
+ await testdriver.find('expiry input in iframe').type('12/25');
406
+ await testdriver.find('cvc input in iframe').type('123', { secret: true });
407
+ await testdriver.find('pay button in iframe').click();
408
+
409
+ // Verify iframe response
410
+ await testdriver.assert('success message appears in iframe');
411
+
412
+ // Verify main page updated
413
+ await testdriver.assert('order confirmation is displayed on main page');
414
+ });
415
+ ```
416
+
417
+ ### `<canvas>` Elements
418
+
419
+ Test canvas-based applications like drawing tools, charts, and games:
420
+
421
+ ```javascript
422
+ import { test } from 'vitest';
423
+ import { chrome } from 'testdriverai/presets';
424
+
425
+ test('canvas drawing application', async (context) => {
426
+ const { testdriver } = await chrome(context, {
427
+ url: 'https://drawing.example.com'
428
+ });
429
+
430
+ // Select drawing tool
431
+ await testdriver.find('brush tool').click();
432
+ await testdriver.find('red color').click();
433
+
434
+ // Draw on canvas
435
+ await testdriver.find('canvas in center').click();
436
+
437
+ // Verify canvas state
438
+ await testdriver.assert('red brush stroke is visible on canvas');
439
+
440
+ // Test undo
441
+ await testdriver.pressKeys(['cmd', 'z']);
442
+ await testdriver.assert('canvas is blank');
443
+
444
+ // Test save
445
+ await testdriver.find('Save button').click();
446
+ await testdriver.assert('Download dialog appears');
447
+ });
448
+ ```
449
+
450
+ ### `<video>` Elements
451
+
452
+ Test HTML5 video elements and custom video players:
453
+
454
+ ```javascript
455
+ import { test } from 'vitest';
456
+ import { chrome } from 'testdriverai/presets';
457
+
458
+ test('html5 video element', async (context) => {
459
+ const { testdriver } = await chrome(context, {
460
+ url: 'https://myapp.com/tutorial'
461
+ });
462
+
463
+ // Test video element directly
464
+ await testdriver.find('tutorial video').click();
465
+ await testdriver.assert('video is playing');
466
+
467
+ // Test custom controls
468
+ await testdriver.find('playback speed button').click();
469
+ await testdriver.find('1.5x speed option').click();
470
+ await testdriver.assert('video is playing at 1.5x speed');
471
+
472
+ // Test chapters
473
+ await testdriver.find('chapters menu').click();
474
+ await testdriver.find('Chapter 3: Advanced Features').click();
475
+ await testdriver.assert('video jumped to chapter 3');
476
+
477
+ // Test captions
478
+ await testdriver.find('captions button').click();
479
+ await testdriver.assert('captions are displayed');
480
+ });
481
+ ```
482
+
483
+ ## Why TestDriver Covers Everything
484
+
485
+ TestDriver's AI-powered visual understanding and natural language interface means you can test any UI element, regardless of:
486
+
487
+ - **Technology stack**: React, Angular, Vue, Svelte, vanilla JS, native desktop frameworks
488
+ - **Rendering method**: DOM, Shadow DOM, Canvas, WebGL, native UI
489
+ - **Complexity**: Simple forms, complex dashboards, games, multimedia applications
490
+ - **Platform**: Web, desktop, mobile, extensions, embedded systems
491
+
492
+ <CardGroup cols={2}>
493
+ <Card title="Powerful & Versatile" icon="wand-magic-sparkles" href="/v7/features/powerful">
494
+ Learn about platform support
495
+ </Card>
496
+
497
+ <Card title="AI-Native" icon="robot" href="/v7/features/ai-native">
498
+ See how AI powers our testing
499
+ </Card>
500
+
501
+ <Card title="All Presets" icon="layer-group" href="/v7/presets/chrome">
502
+ Explore all testing presets
503
+ </Card>
504
+
505
+ <Card title="Getting Started" icon="rocket" href="/v7/getting-started/quickstart">
506
+ Start testing in 5 minutes
507
+ </Card>
508
+ </CardGroup>