testdriverai 7.2.9 → 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 (124) hide show
  1. package/.github/workflows/testdriver.yml +127 -0
  2. package/.testdriver/last-sandbox +7 -0
  3. package/agent/events.js +1 -0
  4. package/agent/index.js +71 -54
  5. package/agent/lib/sandbox.js +11 -1
  6. package/agents.md +393 -0
  7. package/debug/01-table-initial.png +0 -0
  8. package/debug/02-after-ai-explore.png +0 -0
  9. package/debug/02-after-scroll.png +0 -0
  10. package/docs/docs.json +93 -125
  11. package/docs/v7/_drafts/caching.mdx +2 -2
  12. package/docs/v7/{getting-started → _drafts}/installation.mdx +0 -66
  13. package/docs/v7/{features/coverage.mdx → _drafts/powerful.mdx} +1 -90
  14. package/docs/v7/{features → _drafts}/scalable.mdx +126 -4
  15. package/docs/v7/_drafts/screenshot.mdx +155 -0
  16. package/docs/v7/_drafts/writing-tests.mdx +25 -0
  17. package/docs/v7/{api/act.mdx → ai.mdx} +27 -27
  18. package/docs/v7/{api/assert.mdx → assert.mdx} +3 -3
  19. package/docs/v7/aws-setup.mdx +338 -0
  20. package/docs/v7/caching.mdx +128 -0
  21. package/docs/v7/ci-cd.mdx +605 -0
  22. package/docs/v7/{api/click.mdx → click.mdx} +4 -4
  23. package/docs/v7/cloud.mdx +120 -0
  24. package/docs/v7/customizing-devices.mdx +129 -0
  25. package/docs/v7/{api/doubleClick.mdx → double-click.mdx} +5 -5
  26. package/docs/v7/enterprise.mdx +135 -0
  27. package/docs/v7/examples.mdx +5 -0
  28. package/docs/v7/{api/exec.mdx → exec.mdx} +3 -3
  29. package/docs/v7/{api/find.mdx → find.mdx} +17 -21
  30. package/docs/v7/{api/focusApplication.mdx → focus-application.mdx} +3 -3
  31. package/docs/v7/generating-tests.mdx +32 -0
  32. package/docs/v7/{api/hover.mdx → hover.mdx} +3 -3
  33. package/docs/v7/locating-elements.mdx +71 -0
  34. package/docs/v7/making-assertions.mdx +32 -0
  35. package/docs/v7/{api/mouseDown.mdx → mouse-down.mdx} +7 -7
  36. package/docs/v7/{api/mouseUp.mdx → mouse-up.mdx} +8 -8
  37. package/docs/v7/performing-actions.mdx +51 -0
  38. package/docs/v7/{api/pressKeys.mdx → press-keys.mdx} +3 -3
  39. package/docs/v7/quickstart.mdx +162 -0
  40. package/docs/v7/reusable-code.mdx +240 -0
  41. package/docs/v7/{api/rightClick.mdx → right-click.mdx} +5 -5
  42. package/docs/v7/running-tests.mdx +181 -0
  43. package/docs/v7/{api/scroll.mdx → scroll.mdx} +3 -3
  44. package/docs/v7/secrets.mdx +115 -0
  45. package/docs/v7/self-hosted.mdx +66 -0
  46. package/docs/v7/{api/type.mdx → type.mdx} +3 -3
  47. package/docs/v7/variables.mdx +111 -0
  48. package/docs/v7/waiting-for-elements.mdx +66 -0
  49. package/docs/v7/what-is-testdriver.mdx +54 -0
  50. package/lib/vitest/hooks.mjs +80 -68
  51. package/package.json +1 -1
  52. package/sdk.d.ts +22 -9
  53. package/sdk.js +177 -44
  54. package/test/manual/reconnect-provision.test.mjs +49 -0
  55. package/test/manual/reconnect-signin.test.mjs +41 -0
  56. package/test/testdriver/ai.test.mjs +30 -0
  57. package/test/testdriver/setup/testHelpers.mjs +0 -1
  58. package/test/testdriver/windows-installer.test.mjs +61 -0
  59. package/tests/table-sort-enrollments.test.mjs +72 -0
  60. package/tests/table-sort-experiment.test.mjs +42 -0
  61. package/tests/table-sort-setup.test.mjs +59 -0
  62. package/vitest.config.mjs +1 -0
  63. package/docs/v7/api/assertions.mdx +0 -403
  64. package/docs/v7/features/ai-native.mdx +0 -413
  65. package/docs/v7/features/application-logs.mdx +0 -353
  66. package/docs/v7/features/browser-logs.mdx +0 -414
  67. package/docs/v7/features/cache-management.mdx +0 -402
  68. package/docs/v7/features/continuous-testing.mdx +0 -346
  69. package/docs/v7/features/data-driven-testing.mdx +0 -441
  70. package/docs/v7/features/easy-to-write.mdx +0 -280
  71. package/docs/v7/features/enterprise.mdx +0 -656
  72. package/docs/v7/features/fast.mdx +0 -406
  73. package/docs/v7/features/managed-sandboxes.mdx +0 -384
  74. package/docs/v7/features/network-monitoring.mdx +0 -568
  75. package/docs/v7/features/parallel-execution.mdx +0 -381
  76. package/docs/v7/features/powerful.mdx +0 -531
  77. package/docs/v7/features/sandbox-customization.mdx +0 -229
  78. package/docs/v7/features/stable.mdx +0 -473
  79. package/docs/v7/features/system-performance.mdx +0 -616
  80. package/docs/v7/features/test-analytics.mdx +0 -373
  81. package/docs/v7/features/test-cases.mdx +0 -393
  82. package/docs/v7/features/test-replays.mdx +0 -408
  83. package/docs/v7/features/test-reports.mdx +0 -308
  84. package/docs/v7/getting-started/debugging-tests.mdx +0 -382
  85. package/docs/v7/getting-started/quickstart.mdx +0 -90
  86. package/docs/v7/getting-started/running-tests.mdx +0 -173
  87. package/docs/v7/getting-started/setting-up-in-ci.mdx +0 -612
  88. package/docs/v7/getting-started/writing-tests.mdx +0 -534
  89. package/docs/v7/overview/what-is-testdriver.mdx +0 -386
  90. package/docs/v7/presets/chrome-extension.mdx +0 -248
  91. package/docs/v7/presets/chrome.mdx +0 -300
  92. package/docs/v7/presets/electron.mdx +0 -460
  93. package/docs/v7/presets/vscode.mdx +0 -417
  94. package/docs/v7/presets/webapp.mdx +0 -393
  95. package/vitest.config.js +0 -18
  96. /package/docs/v7/{commands → _drafts/commands}/assert.mdx +0 -0
  97. /package/docs/v7/{commands → _drafts/commands}/exec.mdx +0 -0
  98. /package/docs/v7/{commands → _drafts/commands}/focus-application.mdx +0 -0
  99. /package/docs/v7/{commands → _drafts/commands}/hover-image.mdx +0 -0
  100. /package/docs/v7/{commands → _drafts/commands}/hover-text.mdx +0 -0
  101. /package/docs/v7/{commands → _drafts/commands}/if.mdx +0 -0
  102. /package/docs/v7/{commands → _drafts/commands}/match-image.mdx +0 -0
  103. /package/docs/v7/{commands → _drafts/commands}/press-keys.mdx +0 -0
  104. /package/docs/v7/{commands → _drafts/commands}/remember.mdx +0 -0
  105. /package/docs/v7/{commands → _drafts/commands}/run.mdx +0 -0
  106. /package/docs/v7/{commands → _drafts/commands}/scroll-until-image.mdx +0 -0
  107. /package/docs/v7/{commands → _drafts/commands}/scroll-until-text.mdx +0 -0
  108. /package/docs/v7/{commands → _drafts/commands}/scroll.mdx +0 -0
  109. /package/docs/v7/{commands → _drafts/commands}/type.mdx +0 -0
  110. /package/docs/v7/{commands → _drafts/commands}/wait-for-image.mdx +0 -0
  111. /package/docs/v7/{commands → _drafts/commands}/wait-for-text.mdx +0 -0
  112. /package/docs/v7/{commands → _drafts/commands}/wait.mdx +0 -0
  113. /package/docs/v7/{getting-started → _drafts}/configuration.mdx +0 -0
  114. /package/docs/v7/{features → _drafts}/observable.mdx +0 -0
  115. /package/docs/v7/{platforms → _drafts/platforms}/linux.mdx +0 -0
  116. /package/docs/v7/{platforms → _drafts/platforms}/macos.mdx +0 -0
  117. /package/docs/v7/{platforms → _drafts/platforms}/windows.mdx +0 -0
  118. /package/docs/v7/{playwright.mdx → _drafts/playwright.mdx} +0 -0
  119. /package/docs/v7/{overview → _drafts}/readme.mdx +0 -0
  120. /package/docs/v7/{features → _drafts}/reports.mdx +0 -0
  121. /package/docs/v7/{api/client.mdx → client.mdx} +0 -0
  122. /package/docs/v7/{api/dashcam.mdx → dashcam.mdx} +0 -0
  123. /package/docs/v7/{api/elements.mdx → elements.mdx} +0 -0
  124. /package/docs/v7/{api/sandbox.mdx → sandbox.mdx} +0 -0
@@ -1,300 +0,0 @@
1
- ---
2
- title: "Web Apps"
3
- sidebarTitle: "Web Apps"
4
- description: "Automatically launch and test Chrome browser applications"
5
- icon: "chrome"
6
- ---
7
-
8
- ## Overview
9
-
10
- The `chrome()` preset automatically sets up a Chrome browser with TestDriver and Dashcam recording. It's the easiest way to test web applications.
11
-
12
- <Note>
13
- **Recommended Pattern (v7.1+):** Use `TestDriver()` hook + `provision.chrome()` for more flexibility:
14
-
15
- ```javascript
16
- import { TestDriver } from 'testdriverai/vitest/hooks';
17
-
18
- test('my test', async (context) => {
19
- const testdriver = TestDriver(context, { headless: true });
20
- await testdriver.provision.chrome({ url: 'https://example.com' });
21
- // ...
22
- });
23
- ```
24
-
25
- The `chrome()` preset is still supported but the direct API provides better control and clearer lifecycle management.
26
- </Note>
27
-
28
- ## Quick Start
29
-
30
- ```javascript
31
- import { test } from 'vitest';
32
- import { TestDriver } from 'testdriverai/vitest/hooks';
33
-
34
- test('login test', async (context) => {
35
- const testdriver = TestDriver(context, { headless: true });
36
-
37
- await testdriver.provision.chrome({ url: 'https://myapp.com/login' });
38
-
39
- await testdriver.find('email input').type('user@example.com');
40
- await testdriver.find('password input').type('password123');
41
- await testdriver.find('Login button').click();
42
-
43
- await testdriver.assert('Welcome message is visible');
44
- });
45
- ```
46
-
47
- ## Signature
48
-
49
- ```typescript
50
- chrome(context, options): Promise<ChromeResult>
51
- ```
52
-
53
- ### Parameters
54
-
55
- <ParamField path="context" type="object" required>
56
- Vitest test context - automatically passed to your test function
57
- </ParamField>
58
-
59
- <ParamField path="options" type="object">
60
- Configuration options for Chrome
61
-
62
- <Expandable title="properties">
63
- <ParamField path="url" type="string" default="http://testdriver-sandbox.vercel.app/">
64
- URL to navigate to when Chrome launches
65
- </ParamField>
66
-
67
- <ParamField path="maximized" type="boolean" default={true}>
68
- Start Chrome in maximized window mode
69
- </ParamField>
70
-
71
- <ParamField path="guest" type="boolean" default={true}>
72
- Use Chrome guest/incognito mode (no profile data)
73
- </ParamField>
74
-
75
- <ParamField path="dashcam" type="boolean" default={true}>
76
- Enable Dashcam test recording
77
- </ParamField>
78
-
79
- <ParamField path="os" type="'linux' | 'mac' | 'windows'" default="linux">
80
- Target operating system for the test
81
- </ParamField>
82
- </Expandable>
83
- </ParamField>
84
-
85
- ### Returns
86
-
87
- <ResponseField name="testdriver" type="TestDriver" required>
88
- TestDriver instance ready to use
89
- </ResponseField>
90
-
91
- <ResponseField name="dashcam" type="Dashcam">
92
- Dashcam instance for test recording (if enabled)
93
- </ResponseField>
94
-
95
- ## Examples
96
-
97
- ### Basic Web App Testing
98
-
99
- ```javascript
100
- import { test } from 'vitest';
101
- import { TestDriver } from 'testdriverai/vitest/hooks';
102
-
103
- test('search functionality', async (context) => {
104
- const testdriver = TestDriver(context, { headless: true });
105
-
106
- await testdriver.provision.chrome({ url: 'https://example.com' });
107
-
108
- await testdriver.find('search input').type('TestDriver');
109
- await testdriver.find('search button').click();
110
- await testdriver.assert('search results are displayed');
111
- });
112
- ```
113
-
114
- ### With Dashcam Recording
115
-
116
- ```javascript
117
- import { test, expect } from 'vitest';
118
- import { TestDriver } from 'testdriverai/vitest/hooks';
119
-
120
- test('checkout flow', async (context) => {
121
- const testdriver = TestDriver(context, { headless: true });
122
-
123
- await testdriver.provision.chrome({ url: 'https://shop.example.com' });
124
-
125
- // Add items to cart
126
- await testdriver.find('Add to Cart button').click();
127
- await testdriver.find('View Cart').click();
128
-
129
- // Proceed to checkout
130
- await testdriver.find('Checkout button').click();
131
-
132
- // Fill shipping info
133
- await testdriver.find('Name input').type('John Doe');
134
- await testdriver.find('Address input').type('123 Main St');
135
-
136
- // Submit order
137
- await testdriver.find('Place Order').click();
138
-
139
- // Verify confirmation
140
- const confirmed = await testdriver.assert('Order confirmed');
141
- expect(confirmed).toBeTruthy();
142
-
143
- // Dashcam automatically saves replay URL when test completes
144
- });
145
- ```
146
-
147
- ### Testing on Different Operating Systems
148
-
149
- ```javascript
150
- import { test } from 'vitest';
151
- import { TestDriver } from 'testdriverai/vitest/hooks';
152
-
153
- test('windows chrome test', async (context) => {
154
- const testdriver = TestDriver(context, { headless: true, os: 'windows' });
155
-
156
- await testdriver.provision.chrome({ url: 'https://myapp.com' });
157
-
158
- await testdriver.find('Start').click();
159
- });
160
-
161
- test('mac chrome test', async (context) => {
162
- const testdriver = TestDriver(context, { headless: true, os: 'mac' });
163
-
164
- await testdriver.provision.chrome({ url: 'https://myapp.com' });
165
-
166
- await testdriver.find('Start').click();
167
- });
168
- ```
169
-
170
- ### Without Dashcam
171
-
172
- ```javascript
173
- import { test } from 'vitest';
174
- import { TestDriver } from 'testdriverai/vitest/hooks';
175
-
176
- test('quick test without recording', async (context) => {
177
- const testdriver = TestDriver(context, { headless: true, dashcam: false });
178
-
179
- await testdriver.provision.chrome({ url: 'https://example.com' });
180
-
181
- await testdriver.find('button').click();
182
- });
183
- ```
184
-
185
- ### Testing Chrome Extensions
186
-
187
- ```javascript
188
- import { test } from 'vitest';
189
- import { TestDriver } from 'testdriverai/vitest/hooks';
190
-
191
- test('chrome extension', async (context) => {
192
- const testdriver = TestDriver(context, { headless: true });
193
-
194
- await testdriver.provision.chrome({
195
- url: 'chrome://extensions',
196
- guest: false // Need profile for extensions
197
- });
198
-
199
- await testdriver.find('Developer mode toggle').click();
200
- await testdriver.find('Load unpacked').click();
201
- });
202
- ```
203
-
204
- ## What It Does
205
-
206
- When you call `chrome()`, it automatically:
207
-
208
- 1. **Initializes TestDriver** - Creates and connects to sandbox
209
- 2. **Sets up Dashcam** - Authenticates and starts recording (if enabled)
210
- 3. **Launches Chrome** - Opens browser with your specified options
211
- 4. **Navigates to URL** - Loads your application
212
- 5. **Waits for Ready** - Ensures Chrome is focused and page is loaded
213
- 6. **Returns Instances** - Provides ready-to-use testdriver and dashcam
214
-
215
- At test end:
216
- - Dashcam automatically stops and saves replay URL
217
- - TestDriver automatically disconnects
218
- - All cleanup is handled for you
219
-
220
- ## Common Patterns
221
-
222
- ### Form Filling
223
-
224
- ```javascript
225
- test('user registration', async (context) => {
226
- const testdriver = TestDriver(context, { headless: true });
227
-
228
- await testdriver.provision.chrome({ url: 'https://myapp.com/register' });
229
-
230
- await testdriver.find('email field').type('user@example.com');
231
- await testdriver.find('password field').type('SecurePass123!');
232
- await testdriver.find('confirm password field').type('SecurePass123!');
233
- await testdriver.find('terms checkbox').click();
234
- await testdriver.find('Sign Up button').click();
235
-
236
- await testdriver.assert('Registration successful message appears');
237
- });
238
- ```
239
-
240
- ### Navigation Testing
241
-
242
- ```javascript
243
- test('multi-page navigation', async (context) => {
244
- const testdriver = TestDriver(context, { headless: true });
245
-
246
- await testdriver.provision.chrome({ url: 'https://myapp.com' });
247
-
248
- // Navigate through pages
249
- await testdriver.find('About link').click();
250
- await testdriver.assert('About page heading is visible');
251
-
252
- await testdriver.find('Services link').click();
253
- await testdriver.assert('Services page content is loaded');
254
-
255
- await testdriver.find('Contact link').click();
256
- await testdriver.assert('Contact form is displayed');
257
- });
258
- ```
259
-
260
- ### Error Handling
261
-
262
- ```javascript
263
- test('handles errors gracefully', async (context) => {
264
- try {
265
- const testdriver = TestDriver(context, { headless: true });
266
-
267
- await testdriver.provision.chrome({ url: 'https://myapp.com' });
268
-
269
- await testdriver.find('non-existent element').click();
270
- } catch (error) {
271
- // Cleanup still happens automatically via Vitest hooks
272
- console.error('Test failed:', error);
273
- throw error; // Re-throw to mark test as failed
274
- }
275
- });
276
- ```
277
-
278
- ## Using with provision()
279
-
280
- The `chrome()` preset can also be called via the unified `provision()` function:
281
-
282
- ```javascript
283
- import { provision } from 'testdriverai/presets';
284
-
285
- test('using provision', async (context) => {
286
- const { testdriver } = await provision('chrome', {
287
- url: 'https://example.com'
288
- }, context);
289
-
290
- // Same functionality as chrome() directly
291
- });
292
- ```
293
-
294
- ## See Also
295
-
296
- - [Provision API](/v7/progressive-apis/PROVISION) - Overview of all presets
297
- - [VS Code Preset](/v7/presets/vscode) - Testing VS Code extensions
298
- - [Electron Preset](/v7/presets/electron) - Testing Electron apps
299
- - [Vitest Integration](/v7/guides/vitest) - Complete Vitest setup guide
300
- - [Hooks API](/v7/progressive-apis/HOOKS) - Manual lifecycle control