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.
- package/.github/workflows/testdriver.yml +127 -0
- package/.testdriver/last-sandbox +7 -0
- package/agent/events.js +1 -0
- package/agent/index.js +71 -54
- package/agent/lib/sandbox.js +11 -1
- package/agents.md +393 -0
- package/debug/01-table-initial.png +0 -0
- package/debug/02-after-ai-explore.png +0 -0
- package/debug/02-after-scroll.png +0 -0
- package/docs/docs.json +93 -125
- package/docs/v7/_drafts/caching.mdx +2 -2
- package/docs/v7/{getting-started → _drafts}/installation.mdx +0 -66
- package/docs/v7/{features/coverage.mdx → _drafts/powerful.mdx} +1 -90
- package/docs/v7/{features → _drafts}/scalable.mdx +126 -4
- package/docs/v7/_drafts/screenshot.mdx +155 -0
- package/docs/v7/_drafts/writing-tests.mdx +25 -0
- package/docs/v7/{api/act.mdx → ai.mdx} +27 -27
- package/docs/v7/{api/assert.mdx → assert.mdx} +3 -3
- package/docs/v7/aws-setup.mdx +338 -0
- package/docs/v7/caching.mdx +128 -0
- package/docs/v7/ci-cd.mdx +605 -0
- package/docs/v7/{api/click.mdx → click.mdx} +4 -4
- package/docs/v7/cloud.mdx +120 -0
- package/docs/v7/customizing-devices.mdx +129 -0
- package/docs/v7/{api/doubleClick.mdx → double-click.mdx} +5 -5
- package/docs/v7/enterprise.mdx +135 -0
- package/docs/v7/examples.mdx +5 -0
- package/docs/v7/{api/exec.mdx → exec.mdx} +3 -3
- package/docs/v7/{api/find.mdx → find.mdx} +17 -21
- package/docs/v7/{api/focusApplication.mdx → focus-application.mdx} +3 -3
- package/docs/v7/generating-tests.mdx +32 -0
- package/docs/v7/{api/hover.mdx → hover.mdx} +3 -3
- package/docs/v7/locating-elements.mdx +71 -0
- package/docs/v7/making-assertions.mdx +32 -0
- package/docs/v7/{api/mouseDown.mdx → mouse-down.mdx} +7 -7
- package/docs/v7/{api/mouseUp.mdx → mouse-up.mdx} +8 -8
- package/docs/v7/performing-actions.mdx +51 -0
- package/docs/v7/{api/pressKeys.mdx → press-keys.mdx} +3 -3
- package/docs/v7/quickstart.mdx +162 -0
- package/docs/v7/reusable-code.mdx +240 -0
- package/docs/v7/{api/rightClick.mdx → right-click.mdx} +5 -5
- package/docs/v7/running-tests.mdx +181 -0
- package/docs/v7/{api/scroll.mdx → scroll.mdx} +3 -3
- package/docs/v7/secrets.mdx +115 -0
- package/docs/v7/self-hosted.mdx +66 -0
- package/docs/v7/{api/type.mdx → type.mdx} +3 -3
- package/docs/v7/variables.mdx +111 -0
- package/docs/v7/waiting-for-elements.mdx +66 -0
- package/docs/v7/what-is-testdriver.mdx +54 -0
- package/lib/vitest/hooks.mjs +80 -68
- package/package.json +1 -1
- package/sdk.d.ts +22 -9
- package/sdk.js +177 -44
- package/test/manual/reconnect-provision.test.mjs +49 -0
- package/test/manual/reconnect-signin.test.mjs +41 -0
- package/test/testdriver/ai.test.mjs +30 -0
- package/test/testdriver/setup/testHelpers.mjs +0 -1
- package/test/testdriver/windows-installer.test.mjs +61 -0
- package/tests/table-sort-enrollments.test.mjs +72 -0
- package/tests/table-sort-experiment.test.mjs +42 -0
- package/tests/table-sort-setup.test.mjs +59 -0
- package/vitest.config.mjs +1 -0
- package/docs/v7/api/assertions.mdx +0 -403
- package/docs/v7/features/ai-native.mdx +0 -413
- package/docs/v7/features/application-logs.mdx +0 -353
- package/docs/v7/features/browser-logs.mdx +0 -414
- package/docs/v7/features/cache-management.mdx +0 -402
- package/docs/v7/features/continuous-testing.mdx +0 -346
- package/docs/v7/features/data-driven-testing.mdx +0 -441
- package/docs/v7/features/easy-to-write.mdx +0 -280
- package/docs/v7/features/enterprise.mdx +0 -656
- package/docs/v7/features/fast.mdx +0 -406
- package/docs/v7/features/managed-sandboxes.mdx +0 -384
- package/docs/v7/features/network-monitoring.mdx +0 -568
- package/docs/v7/features/parallel-execution.mdx +0 -381
- package/docs/v7/features/powerful.mdx +0 -531
- package/docs/v7/features/sandbox-customization.mdx +0 -229
- package/docs/v7/features/stable.mdx +0 -473
- package/docs/v7/features/system-performance.mdx +0 -616
- package/docs/v7/features/test-analytics.mdx +0 -373
- package/docs/v7/features/test-cases.mdx +0 -393
- package/docs/v7/features/test-replays.mdx +0 -408
- package/docs/v7/features/test-reports.mdx +0 -308
- package/docs/v7/getting-started/debugging-tests.mdx +0 -382
- package/docs/v7/getting-started/quickstart.mdx +0 -90
- package/docs/v7/getting-started/running-tests.mdx +0 -173
- package/docs/v7/getting-started/setting-up-in-ci.mdx +0 -612
- package/docs/v7/getting-started/writing-tests.mdx +0 -534
- package/docs/v7/overview/what-is-testdriver.mdx +0 -386
- package/docs/v7/presets/chrome-extension.mdx +0 -248
- package/docs/v7/presets/chrome.mdx +0 -300
- package/docs/v7/presets/electron.mdx +0 -460
- package/docs/v7/presets/vscode.mdx +0 -417
- package/docs/v7/presets/webapp.mdx +0 -393
- package/vitest.config.js +0 -18
- /package/docs/v7/{commands → _drafts/commands}/assert.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/exec.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/focus-application.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/hover-image.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/hover-text.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/if.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/match-image.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/press-keys.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/remember.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/run.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/scroll-until-image.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/scroll-until-text.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/scroll.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/type.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/wait-for-image.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/wait-for-text.mdx +0 -0
- /package/docs/v7/{commands → _drafts/commands}/wait.mdx +0 -0
- /package/docs/v7/{getting-started → _drafts}/configuration.mdx +0 -0
- /package/docs/v7/{features → _drafts}/observable.mdx +0 -0
- /package/docs/v7/{platforms → _drafts/platforms}/linux.mdx +0 -0
- /package/docs/v7/{platforms → _drafts/platforms}/macos.mdx +0 -0
- /package/docs/v7/{platforms → _drafts/platforms}/windows.mdx +0 -0
- /package/docs/v7/{playwright.mdx → _drafts/playwright.mdx} +0 -0
- /package/docs/v7/{overview → _drafts}/readme.mdx +0 -0
- /package/docs/v7/{features → _drafts}/reports.mdx +0 -0
- /package/docs/v7/{api/client.mdx → client.mdx} +0 -0
- /package/docs/v7/{api/dashcam.mdx → dashcam.mdx} +0 -0
- /package/docs/v7/{api/elements.mdx → elements.mdx} +0 -0
- /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
|