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,280 +0,0 @@
1
- ---
2
- title: "Natural Language Syntax"
3
- description: "Natural language testing that feels like describing what you want, not programming"
4
- icon: "feather"
5
- ---
6
-
7
- Writing tests with TestDriver is intuitive and straightforward. No more brittle CSS selectors or complex XPath expressions - just describe what you want in plain English.
8
-
9
- ## Natural Language Selectors
10
-
11
- Find elements the way humans think about them:
12
-
13
- <CodeGroup>
14
- ```javascript TestDriver - Natural Language
15
- // ✅ Readable and maintainable
16
- await testdriver.find('submit button').click();
17
- await testdriver.find('email input in the login form').type('user@example.com');
18
- await testdriver.find('delete button in the top right corner').click();
19
- ```
20
-
21
- ```javascript Traditional - CSS Selectors
22
- // ❌ Fragile and cryptic
23
- await page.locator('#root > div > form > div:nth-child(2) > button').click();
24
- await page.locator('input[name="email"][data-testid="login-form-email"]').type('user@example.com');
25
- await page.locator('.header-actions > .btn-danger:last-child').click();
26
- ```
27
- </CodeGroup>
28
-
29
- <Tip>
30
- Natural language selectors are resilient to UI changes. If a button moves or the DOM structure changes, the same description often still works.
31
- </Tip>
32
-
33
- ## Chainable API
34
-
35
- Write cleaner, more readable test code with method chaining:
36
-
37
- ```javascript
38
- // Find and interact in one fluid motion
39
- await testdriver.find('Login button').click();
40
- await testdriver.find('username field').type('admin');
41
- await testdriver.find('password field').type('secret', { secret: true });
42
- await testdriver.find('submit').click();
43
-
44
- // Also works with hover interactions
45
- await testdriver.find('Products menu').hover();
46
- await testdriver.find('Laptops submenu').click();
47
-
48
- // And other actions
49
- await testdriver.find('checkbox item').doubleClick();
50
- await testdriver.find('context menu item').rightClick();
51
- ```
52
-
53
- All element methods are chainable:
54
- - `.click()` - Click the element
55
- - `.hover()` - Hover over the element
56
- - `.doubleClick()` - Double-click the element
57
- - `.rightClick()` - Right-click the element
58
- - `.mouseDown()` - Press mouse button down
59
- - `.mouseUp()` - Release mouse button
60
- - `.type(text)` - Type text into the element
61
-
62
- ## Familiar Syntax
63
-
64
- TestDriver uses `vitest` to run tests with a familiar syntax you already know and love:
65
-
66
- <Tabs>
67
- <Tab title="Vitest">
68
- ```javascript
69
- import { test } from 'vitest';
70
- import { chrome } from 'testdriverai/presets';
71
-
72
- test('my test', async (context) => {
73
- const { testdriver } = await chrome(context, {
74
- url: 'https://example.com'
75
- });
76
-
77
- await testdriver.find('button').click();
78
- });
79
- ```
80
- </Tab>
81
- </Tabs>
82
-
83
- No need to learn a new DSL or configuration format. TestDriver works with your existing test infrastructure.
84
-
85
- ## Full TypeScript Support
86
-
87
- First-class TypeScript support with complete IntelliSense and type safety:
88
-
89
- ```typescript
90
- import { test } from 'vitest';
91
- import { chrome } from 'testdriverai/presets';
92
-
93
- test('typed test', async (context) => {
94
- const { testdriver } = await chrome(context, {
95
- url: 'https://example.com'
96
- });
97
-
98
- const element = await testdriver.find('button');
99
-
100
- // ✅ Autocomplete works perfectly
101
- element.coordinates.x;
102
- element.coordinates.y;
103
- element.text;
104
- element.confidence;
105
-
106
- // ❌ TypeScript catches errors at compile time
107
- element.invalidProperty; // Error: Property 'invalidProperty' does not exist
108
- });
109
- ```
110
-
111
- <Card title="Type Definitions" icon="code">
112
- TestDriver includes comprehensive TypeScript definitions for all APIs, methods, and return types. Your IDE will provide intelligent autocomplete and inline documentation.
113
- </Card>
114
-
115
- ## AI-Powered Assertions
116
-
117
- Verify application state using natural language:
118
-
119
- ```javascript
120
- // Verify UI state
121
- await testdriver.assert('the login page is displayed');
122
- await testdriver.assert('submit button is visible and enabled');
123
-
124
- // Verify content
125
- await testdriver.assert('the page title is "Welcome"');
126
- await testdriver.assert('success message says "Account created successfully"');
127
-
128
- // Verify interactions
129
- await testdriver.assert('the checkbox is checked');
130
- await testdriver.assert('the dropdown shows "United States"');
131
-
132
- // Verify visual state
133
- await testdriver.assert('the button is blue');
134
- await testdriver.assert('the loading spinner is not visible');
135
- ```
136
-
137
- No need to write complex selectors and assertions. Just describe what should be true.
138
-
139
- ## Clean Test Code
140
-
141
- Compare the readability of TestDriver vs traditional approaches:
142
-
143
- <CodeGroup>
144
- ```javascript TestDriver - Clean & Readable
145
- test('user can login', async (context) => {
146
- const { testdriver } = await chrome(context, {
147
- url: 'https://myapp.com/login'
148
- });
149
-
150
- await testdriver.find('email input').type('user@example.com');
151
- await testdriver.find('password input').type('secret', { secret: true });
152
- await testdriver.find('Login button').click();
153
-
154
- await testdriver.assert('Dashboard is visible');
155
- });
156
- ```
157
-
158
- ```javascript Traditional - Verbose & Complex
159
- test('user can login', async () => {
160
- await page.goto('https://myapp.com/login');
161
-
162
- const emailInput = await page.waitForSelector(
163
- 'input[type="email"][name="email"]',
164
- { state: 'visible', timeout: 30000 }
165
- );
166
- await emailInput.type('user@example.com');
167
-
168
- const passwordInput = await page.waitForSelector(
169
- 'input[type="password"][name="password"]',
170
- { state: 'visible', timeout: 30000 }
171
- );
172
- await passwordInput.type('secret');
173
-
174
- const loginButton = await page.waitForSelector(
175
- 'button[type="submit"]',
176
- { state: 'visible', timeout: 30000 }
177
- );
178
- await loginButton.click();
179
-
180
- await page.waitForSelector('.dashboard', {
181
- state: 'visible',
182
- timeout: 30000
183
- });
184
- const dashboard = await page.$('.dashboard');
185
- expect(dashboard).toBeTruthy();
186
- });
187
- ```
188
- </CodeGroup>
189
-
190
- ## Zero Boilerplate
191
-
192
- Presets handle all the setup and teardown automatically:
193
-
194
- ```javascript
195
- test('minimal test', async (context) => {
196
- // One line to set up everything:
197
- // - Authentication
198
- // - Sandbox provisioning
199
- // - Browser launch
200
- // - Navigation
201
- // - Dashcam recording
202
- // - Automatic cleanup
203
- const { testdriver } = await chrome(context, {
204
- url: 'https://example.com'
205
- });
206
-
207
- // Write your test
208
- await testdriver.find('button').click();
209
-
210
- // No cleanup needed - automatic!
211
- });
212
- ```
213
-
214
- <Check>
215
- The preset automatically disconnects and cleans up resources when your test completes, even if it fails.
216
- </Check>
217
-
218
- ## Real-World Example
219
-
220
- Here's a complete, real-world test that showcases TestDriver's simplicity:
221
-
222
- ```javascript
223
- import { test, expect } from 'vitest';
224
- import { chrome } from 'testdriverai/presets';
225
-
226
- test('user can checkout', async (context) => {
227
- const { testdriver } = await chrome(context, {
228
- url: 'https://shop.example.com'
229
- });
230
-
231
- // Add items to cart
232
- await testdriver.find('Add to Cart button on the first product').click();
233
- await testdriver.assert('Cart badge shows 1 item');
234
-
235
- // Go to checkout
236
- await testdriver.find('Cart icon').click();
237
- await testdriver.find('Checkout button').click();
238
-
239
- // Fill shipping form
240
- await testdriver.find('Full name input').type('John Doe');
241
- await testdriver.find('Address input').type('123 Main St');
242
- await testdriver.find('City input').type('Springfield');
243
- await testdriver.find('State dropdown').click();
244
- await testdriver.find('California option').click();
245
-
246
- // Submit order
247
- await testdriver.find('Place Order button').click();
248
-
249
- // Verify success
250
- await testdriver.assert('Order confirmation page is displayed');
251
- await testdriver.assert('Thank you message is visible');
252
- });
253
- ```
254
-
255
- Notice:
256
- - No CSS selectors or IDs
257
- - No explicit waits
258
- - No manual setup/teardown
259
- - Reads like a test plan
260
- - Self-documenting code
261
-
262
- ## Get Started
263
-
264
- <CardGroup cols={2}>
265
- <Card
266
- title="Quick Start"
267
- icon="rocket"
268
- href="/v7/getting-started/quickstart"
269
- >
270
- Get up and running in 2 minutes
271
- </Card>
272
-
273
- <Card
274
- title="API Reference"
275
- icon="book"
276
- href="/v7/api/client"
277
- >
278
- Complete API documentation
279
- </Card>
280
- </CardGroup>