testdriverai 7.2.9 → 7.2.11
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 +87 -126
- 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/dashcam.mdx → dashcam.mdx} +0 -78
- package/docs/v7/{api/doubleClick.mdx → double-click.mdx} +5 -5
- package/docs/v7/{api/elements.mdx → elements.mdx} +1 -54
- package/docs/v7/enterprise.mdx +116 -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 +36 -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/api/sandbox.mdx +0 -404
- 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
|
@@ -1,531 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Multi-Target Testing"
|
|
3
|
-
description: "Test anything, anywhere - web, desktop, mobile, extensions"
|
|
4
|
-
icon: "wand-magic-sparkles"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
TestDriver is the only testing platform that lets you test web applications, desktop apps, browser extensions, and IDE extensions with the same simple API.
|
|
8
|
-
|
|
9
|
-
## Test Anything
|
|
10
|
-
|
|
11
|
-
One SDK, unlimited testing possibilities:
|
|
12
|
-
|
|
13
|
-
<CardGroup cols={2}>
|
|
14
|
-
<Card title="Web Applications" icon="globe">
|
|
15
|
-
Test any website or web application
|
|
16
|
-
</Card>
|
|
17
|
-
|
|
18
|
-
<Card title="Desktop Applications" icon="desktop">
|
|
19
|
-
Windows, macOS, and Linux native apps
|
|
20
|
-
</Card>
|
|
21
|
-
|
|
22
|
-
<Card title="Chrome Extensions" icon="puzzle-piece">
|
|
23
|
-
Browser extensions and add-ons
|
|
24
|
-
</Card>
|
|
25
|
-
|
|
26
|
-
<Card title="VS Code Extensions" icon="code">
|
|
27
|
-
IDE extensions and plugins
|
|
28
|
-
</Card>
|
|
29
|
-
|
|
30
|
-
<Card title="Electron Apps" icon="atom">
|
|
31
|
-
Cross-platform Electron applications
|
|
32
|
-
</Card>
|
|
33
|
-
|
|
34
|
-
<Card title="Mobile Apps" icon="mobile">
|
|
35
|
-
Android and iOS applications (beta)
|
|
36
|
-
</Card>
|
|
37
|
-
</CardGroup>
|
|
38
|
-
|
|
39
|
-
## Web Applications
|
|
40
|
-
|
|
41
|
-
Test any website with the Chrome preset:
|
|
42
|
-
|
|
43
|
-
```javascript
|
|
44
|
-
import { test } from 'vitest';
|
|
45
|
-
import { chrome } from 'testdriverai/presets';
|
|
46
|
-
|
|
47
|
-
test('web application test', async (context) => {
|
|
48
|
-
const { testdriver } = await chrome(context, {
|
|
49
|
-
url: 'https://myapp.com',
|
|
50
|
-
maximized: true,
|
|
51
|
-
guest: true, // Incognito mode
|
|
52
|
-
os: 'linux'
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
await testdriver.find('Login button').click();
|
|
56
|
-
await testdriver.find('email input').type('user@example.com');
|
|
57
|
-
await testdriver.find('password input').type('secret', { secret: true });
|
|
58
|
-
await testdriver.find('Submit').click();
|
|
59
|
-
|
|
60
|
-
await testdriver.assert('Dashboard is visible');
|
|
61
|
-
});
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
<Card title="Chrome Preset Documentation" icon="chrome" href="/v7/presets/chrome">
|
|
65
|
-
Complete guide to testing web applications
|
|
66
|
-
</Card>
|
|
67
|
-
|
|
68
|
-
## Desktop Applications
|
|
69
|
-
|
|
70
|
-
Test native desktop applications on any platform:
|
|
71
|
-
|
|
72
|
-
<Tabs>
|
|
73
|
-
<Tab title="Windows">
|
|
74
|
-
```javascript
|
|
75
|
-
import { desktop } from 'testdriverai/presets';
|
|
76
|
-
|
|
77
|
-
test('windows app', async (context) => {
|
|
78
|
-
const { testdriver } = await desktop(context, {
|
|
79
|
-
appPath: 'C:\\Program Files\\MyApp\\MyApp.exe',
|
|
80
|
-
os: 'windows'
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
await testdriver.find('File menu').click();
|
|
84
|
-
await testdriver.find('New Document').click();
|
|
85
|
-
await testdriver.assert('New document window is open');
|
|
86
|
-
});
|
|
87
|
-
```
|
|
88
|
-
</Tab>
|
|
89
|
-
|
|
90
|
-
<Tab title="macOS">
|
|
91
|
-
```javascript
|
|
92
|
-
import { desktop } from 'testdriverai/presets';
|
|
93
|
-
|
|
94
|
-
test('macos app', async (context) => {
|
|
95
|
-
const { testdriver } = await desktop(context, {
|
|
96
|
-
appPath: '/Applications/MyApp.app',
|
|
97
|
-
os: 'mac'
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
await testdriver.pressKeys(['cmd', 'n']); // New window
|
|
101
|
-
await testdriver.assert('Untitled document is displayed');
|
|
102
|
-
});
|
|
103
|
-
```
|
|
104
|
-
</Tab>
|
|
105
|
-
|
|
106
|
-
<Tab title="Linux">
|
|
107
|
-
```javascript
|
|
108
|
-
import { desktop } from 'testdriverai/presets';
|
|
109
|
-
|
|
110
|
-
test('linux app', async (context) => {
|
|
111
|
-
const { testdriver } = await desktop(context, {
|
|
112
|
-
appPath: '/usr/bin/myapp',
|
|
113
|
-
os: 'linux'
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
await testdriver.find('Settings button').click();
|
|
117
|
-
await testdriver.find('Theme dropdown').click();
|
|
118
|
-
await testdriver.find('Dark mode option').click();
|
|
119
|
-
});
|
|
120
|
-
```
|
|
121
|
-
</Tab>
|
|
122
|
-
</Tabs>
|
|
123
|
-
|
|
124
|
-
<CardGroup cols={3}>
|
|
125
|
-
<Card title="Windows" icon="windows" href="/v7/platforms/windows">
|
|
126
|
-
Windows testing guide
|
|
127
|
-
</Card>
|
|
128
|
-
|
|
129
|
-
<Card title="macOS" icon="apple" href="/v7/platforms/macos">
|
|
130
|
-
macOS testing guide
|
|
131
|
-
</Card>
|
|
132
|
-
|
|
133
|
-
<Card title="Linux" icon="linux" href="/v7/platforms/linux">
|
|
134
|
-
Linux testing guide
|
|
135
|
-
</Card>
|
|
136
|
-
</CardGroup>
|
|
137
|
-
|
|
138
|
-
## Chrome Extensions
|
|
139
|
-
|
|
140
|
-
Test browser extensions in their natural environment:
|
|
141
|
-
|
|
142
|
-
```javascript
|
|
143
|
-
import { test } from 'vitest';
|
|
144
|
-
import { chromeExtension } from 'testdriverai/presets';
|
|
145
|
-
|
|
146
|
-
test('chrome extension', async (context) => {
|
|
147
|
-
const { testdriver } = await chromeExtension(context, {
|
|
148
|
-
extensionPath: './my-extension',
|
|
149
|
-
url: 'https://example.com'
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
// Test extension popup
|
|
153
|
-
await testdriver.find('extension icon in toolbar').click();
|
|
154
|
-
await testdriver.find('Settings button in popup').click();
|
|
155
|
-
|
|
156
|
-
// Test extension functionality
|
|
157
|
-
await testdriver.find('Enable feature checkbox').click();
|
|
158
|
-
await testdriver.assert('Feature is enabled message appears');
|
|
159
|
-
|
|
160
|
-
// Test on web page
|
|
161
|
-
await testdriver.find('extension-injected content on page').click();
|
|
162
|
-
await testdriver.assert('Extension content is visible');
|
|
163
|
-
});
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
<Card title="Chrome Extension Guide" icon="puzzle-piece" href="/v7/presets/chrome-extension">
|
|
167
|
-
Complete extension testing documentation
|
|
168
|
-
</Card>
|
|
169
|
-
|
|
170
|
-
## VS Code Extensions
|
|
171
|
-
|
|
172
|
-
Test IDE extensions with the VS Code preset:
|
|
173
|
-
|
|
174
|
-
```javascript
|
|
175
|
-
import { test } from 'vitest';
|
|
176
|
-
import { vscode } from 'testdriverai/presets';
|
|
177
|
-
|
|
178
|
-
test('vscode extension', async (context) => {
|
|
179
|
-
const { testdriver } = await vscode(context, {
|
|
180
|
-
workspace: '/tmp/test-project',
|
|
181
|
-
extensions: ['ms-python.python', 'dbaeumer.vscode-eslint']
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// Open command palette
|
|
185
|
-
await testdriver.pressKeys(['cmd', 'shift', 'p']);
|
|
186
|
-
await testdriver.type('Python: Create New File');
|
|
187
|
-
await testdriver.pressKeys(['enter']);
|
|
188
|
-
|
|
189
|
-
// Verify extension behavior
|
|
190
|
-
await testdriver.assert('Untitled Python file is open');
|
|
191
|
-
await testdriver.assert('Python extension is active');
|
|
192
|
-
|
|
193
|
-
// Test extension commands
|
|
194
|
-
await testdriver.type('print("Hello World")');
|
|
195
|
-
await testdriver.pressKeys(['cmd', 's']); // Save
|
|
196
|
-
await testdriver.find('filename input').type('test.py');
|
|
197
|
-
await testdriver.pressKeys(['enter']);
|
|
198
|
-
|
|
199
|
-
await testdriver.assert('test.py is saved');
|
|
200
|
-
});
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
<Card title="VS Code Preset Guide" icon="code" href="/v7/presets/vscode">
|
|
204
|
-
Complete VS Code extension testing
|
|
205
|
-
</Card>
|
|
206
|
-
|
|
207
|
-
## Electron Applications
|
|
208
|
-
|
|
209
|
-
Test Electron apps with specialized support:
|
|
210
|
-
|
|
211
|
-
```javascript
|
|
212
|
-
import { test } from 'vitest';
|
|
213
|
-
import { electron } from 'testdriverai/presets';
|
|
214
|
-
|
|
215
|
-
test('electron app', async (context) => {
|
|
216
|
-
const { app } = await electron(context, {
|
|
217
|
-
appPath: './dist/my-electron-app',
|
|
218
|
-
args: ['--debug']
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
// Test native menu
|
|
222
|
-
await app.find('File menu').click();
|
|
223
|
-
await app.find('New Window').click();
|
|
224
|
-
|
|
225
|
-
// Test application UI
|
|
226
|
-
await app.find('sidebar toggle').click();
|
|
227
|
-
await app.assert('sidebar is collapsed');
|
|
228
|
-
|
|
229
|
-
// Test window interactions
|
|
230
|
-
await app.pressKeys(['cmd', 'w']); // Close window
|
|
231
|
-
await app.assert('window is closed');
|
|
232
|
-
});
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
<Card title="Electron Preset Guide" icon="atom" href="/v7/presets/electron">
|
|
236
|
-
Complete Electron testing documentation
|
|
237
|
-
</Card>
|
|
238
|
-
|
|
239
|
-
## Cross-Platform Testing
|
|
240
|
-
|
|
241
|
-
Run the same test across multiple platforms:
|
|
242
|
-
|
|
243
|
-
```javascript
|
|
244
|
-
import { test } from 'vitest';
|
|
245
|
-
import { desktop } from 'testdriverai/presets';
|
|
246
|
-
|
|
247
|
-
const platforms = ['linux', 'mac', 'windows'];
|
|
248
|
-
|
|
249
|
-
platforms.forEach((os) => {
|
|
250
|
-
test(`app works on ${os}`, async (context) => {
|
|
251
|
-
const { testdriver } = await desktop(context, {
|
|
252
|
-
appPath: getAppPathForOS(os),
|
|
253
|
-
os
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
await testdriver.find('File menu').click();
|
|
257
|
-
await testdriver.find('New Document').click();
|
|
258
|
-
await testdriver.assert('New document is created');
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
function getAppPathForOS(os) {
|
|
263
|
-
switch (os) {
|
|
264
|
-
case 'windows': return 'C:\\Program Files\\MyApp\\MyApp.exe';
|
|
265
|
-
case 'mac': return '/Applications/MyApp.app';
|
|
266
|
-
case 'linux': return '/usr/bin/myapp';
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
## Multiple Applications
|
|
272
|
-
|
|
273
|
-
Test interactions between multiple applications:
|
|
274
|
-
|
|
275
|
-
```javascript
|
|
276
|
-
test('cross-app workflow', async (context) => {
|
|
277
|
-
// Start VS Code
|
|
278
|
-
const { testdriver: vscode } = await vscode(context, {
|
|
279
|
-
workspace: '/tmp/project'
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
await vscode.type('// TODO: Implement feature');
|
|
283
|
-
await vscode.pressKeys(['cmd', 's']);
|
|
284
|
-
|
|
285
|
-
// Switch to browser
|
|
286
|
-
const { testdriver: chrome } = await chrome(context, {
|
|
287
|
-
url: 'https://jira.company.com'
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
await chrome.find('Create issue button').click();
|
|
291
|
-
await chrome.find('Summary input').type('Implement feature');
|
|
292
|
-
await chrome.find('Submit').click();
|
|
293
|
-
|
|
294
|
-
// Switch back to VS Code
|
|
295
|
-
await vscode.focusApplication('VS Code');
|
|
296
|
-
await vscode.assert('TODO comment is visible');
|
|
297
|
-
});
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
## Advanced Interactions
|
|
301
|
-
|
|
302
|
-
TestDriver handles complex interaction patterns:
|
|
303
|
-
|
|
304
|
-
<AccordionGroup>
|
|
305
|
-
<Accordion title="Drag and Drop">
|
|
306
|
-
```javascript
|
|
307
|
-
const element = await testdriver.find('draggable item');
|
|
308
|
-
await element.mouseDown();
|
|
309
|
-
|
|
310
|
-
await testdriver.hover(500, 300); // Drag to position
|
|
311
|
-
await testdriver.mouseUp(); // Drop
|
|
312
|
-
|
|
313
|
-
await testdriver.assert('Item is in new position');
|
|
314
|
-
```
|
|
315
|
-
</Accordion>
|
|
316
|
-
|
|
317
|
-
<Accordion title="Keyboard Shortcuts">
|
|
318
|
-
```javascript
|
|
319
|
-
// Multi-key combinations
|
|
320
|
-
await testdriver.pressKeys(['ctrl', 'shift', 'p']);
|
|
321
|
-
|
|
322
|
-
// Platform-specific shortcuts
|
|
323
|
-
const modKey = os === 'mac' ? 'cmd' : 'ctrl';
|
|
324
|
-
await testdriver.pressKeys([modKey, 'c']); // Copy
|
|
325
|
-
await testdriver.pressKeys([modKey, 'v']); // Paste
|
|
326
|
-
```
|
|
327
|
-
</Accordion>
|
|
328
|
-
|
|
329
|
-
<Accordion title="File Uploads">
|
|
330
|
-
```javascript
|
|
331
|
-
await testdriver.find('file upload button').click();
|
|
332
|
-
|
|
333
|
-
// Type file path in dialog
|
|
334
|
-
await testdriver.type('/path/to/file.pdf');
|
|
335
|
-
await testdriver.pressKeys(['enter']);
|
|
336
|
-
|
|
337
|
-
await testdriver.assert('File is uploaded');
|
|
338
|
-
```
|
|
339
|
-
</Accordion>
|
|
340
|
-
|
|
341
|
-
<Accordion title="Context Menus">
|
|
342
|
-
```javascript
|
|
343
|
-
await testdriver.find('file item').rightClick();
|
|
344
|
-
await testdriver.find('Delete option in context menu').click();
|
|
345
|
-
await testdriver.assert('Confirmation dialog appears');
|
|
346
|
-
```
|
|
347
|
-
</Accordion>
|
|
348
|
-
</AccordionGroup>
|
|
349
|
-
|
|
350
|
-
## Execute Custom Code
|
|
351
|
-
|
|
352
|
-
Run JavaScript or PowerShell for advanced scenarios:
|
|
353
|
-
|
|
354
|
-
<Tabs>
|
|
355
|
-
<Tab title="JavaScript (Browser)">
|
|
356
|
-
```javascript
|
|
357
|
-
// Execute code in browser context
|
|
358
|
-
const title = await testdriver.exec('js', 'document.title', 5000);
|
|
359
|
-
console.log('Page title:', title);
|
|
360
|
-
|
|
361
|
-
// Modify DOM
|
|
362
|
-
await testdriver.exec('js', `
|
|
363
|
-
document.querySelector('#username').value = 'testuser';
|
|
364
|
-
document.querySelector('#submit').click();
|
|
365
|
-
`, 5000);
|
|
366
|
-
|
|
367
|
-
// Extract data
|
|
368
|
-
const items = await testdriver.exec('js', `
|
|
369
|
-
Array.from(document.querySelectorAll('.item'))
|
|
370
|
-
.map(el => el.textContent)
|
|
371
|
-
`, 5000);
|
|
372
|
-
```
|
|
373
|
-
</Tab>
|
|
374
|
-
|
|
375
|
-
<Tab title="PowerShell (Windows)">
|
|
376
|
-
```javascript
|
|
377
|
-
// Execute PowerShell commands
|
|
378
|
-
await testdriver.exec('pwsh',
|
|
379
|
-
'Start-Process notepad.exe',
|
|
380
|
-
5000
|
|
381
|
-
);
|
|
382
|
-
|
|
383
|
-
// Install dependencies
|
|
384
|
-
await testdriver.exec('pwsh',
|
|
385
|
-
'npm install -g http-server',
|
|
386
|
-
30000
|
|
387
|
-
);
|
|
388
|
-
|
|
389
|
-
// Start local server
|
|
390
|
-
await testdriver.exec('pwsh',
|
|
391
|
-
'http-server ./dist -p 8080',
|
|
392
|
-
5000
|
|
393
|
-
);
|
|
394
|
-
```
|
|
395
|
-
</Tab>
|
|
396
|
-
|
|
397
|
-
<Tab title="Bash (Linux/Mac)">
|
|
398
|
-
```javascript
|
|
399
|
-
// Execute bash commands
|
|
400
|
-
await testdriver.exec('bash',
|
|
401
|
-
'open /Applications/MyApp.app',
|
|
402
|
-
5000
|
|
403
|
-
);
|
|
404
|
-
|
|
405
|
-
// Setup test environment
|
|
406
|
-
await testdriver.exec('bash', `
|
|
407
|
-
cd /tmp/project &&
|
|
408
|
-
npm install &&
|
|
409
|
-
npm run build
|
|
410
|
-
`, 60000);
|
|
411
|
-
```
|
|
412
|
-
</Tab>
|
|
413
|
-
</Tabs>
|
|
414
|
-
|
|
415
|
-
## Mobile Applications (Beta)
|
|
416
|
-
|
|
417
|
-
TestDriver supports mobile app testing:
|
|
418
|
-
|
|
419
|
-
```javascript
|
|
420
|
-
import { android } from 'testdriverai/presets';
|
|
421
|
-
|
|
422
|
-
test('android app', async (context) => {
|
|
423
|
-
const { testdriver } = await android(context, {
|
|
424
|
-
appPath: './app.apk',
|
|
425
|
-
device: 'Pixel 7'
|
|
426
|
-
});
|
|
427
|
-
|
|
428
|
-
await testdriver.find('Login button').click();
|
|
429
|
-
await testdriver.find('username field').type('user@example.com');
|
|
430
|
-
await testdriver.find('password field').type('secret', { secret: true });
|
|
431
|
-
await testdriver.find('Submit').click();
|
|
432
|
-
|
|
433
|
-
await testdriver.assert('Home screen is visible');
|
|
434
|
-
});
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
<Note>
|
|
438
|
-
Mobile testing is in beta. Contact sales for early access.
|
|
439
|
-
</Note>
|
|
440
|
-
|
|
441
|
-
## Real-World Example
|
|
442
|
-
|
|
443
|
-
Here's a complex cross-platform test:
|
|
444
|
-
|
|
445
|
-
```javascript
|
|
446
|
-
test('full application workflow', async (context) => {
|
|
447
|
-
// Test web application
|
|
448
|
-
const { testdriver: web } = await chrome(context, {
|
|
449
|
-
url: 'https://myapp.com'
|
|
450
|
-
});
|
|
451
|
-
|
|
452
|
-
await web.find('Export data button').click();
|
|
453
|
-
await web.find('Download as CSV').click();
|
|
454
|
-
await web.assert('Download started notification');
|
|
455
|
-
|
|
456
|
-
// Test desktop application
|
|
457
|
-
const { testdriver: desktop } = await desktop(context, {
|
|
458
|
-
appPath: '/Applications/MyApp.app',
|
|
459
|
-
os: 'mac'
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
await desktop.find('Import button').click();
|
|
463
|
-
await desktop.find('Select file button').click();
|
|
464
|
-
await desktop.type('~/Downloads/export.csv');
|
|
465
|
-
await desktop.pressKeys(['enter']);
|
|
466
|
-
await desktop.assert('Import successful message');
|
|
467
|
-
|
|
468
|
-
// Test VS Code extension
|
|
469
|
-
const { testdriver: vscode } = await vscode(context, {
|
|
470
|
-
workspace: '/tmp/project',
|
|
471
|
-
extensions: ['mycompany.myapp-extension']
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
await vscode.pressKeys(['cmd', 'shift', 'p']);
|
|
475
|
-
await vscode.type('MyApp: Sync Data');
|
|
476
|
-
await vscode.pressKeys(['enter']);
|
|
477
|
-
await vscode.assert('Data synced successfully');
|
|
478
|
-
});
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
## Learn More
|
|
482
|
-
|
|
483
|
-
<CardGroup cols={2}>
|
|
484
|
-
<Card
|
|
485
|
-
title="Chrome Preset"
|
|
486
|
-
icon="chrome"
|
|
487
|
-
href="/v7/presets/chrome"
|
|
488
|
-
>
|
|
489
|
-
Web application testing
|
|
490
|
-
</Card>
|
|
491
|
-
|
|
492
|
-
<Card
|
|
493
|
-
title="VS Code Preset"
|
|
494
|
-
icon="code"
|
|
495
|
-
href="/v7/presets/vscode"
|
|
496
|
-
>
|
|
497
|
-
IDE extension testing
|
|
498
|
-
</Card>
|
|
499
|
-
|
|
500
|
-
<Card
|
|
501
|
-
title="Electron Preset"
|
|
502
|
-
icon="atom"
|
|
503
|
-
href="/v7/presets/electron"
|
|
504
|
-
>
|
|
505
|
-
Electron app testing
|
|
506
|
-
</Card>
|
|
507
|
-
|
|
508
|
-
<Card
|
|
509
|
-
title="Chrome Extension"
|
|
510
|
-
icon="puzzle-piece"
|
|
511
|
-
href="/v7/presets/chrome-extension"
|
|
512
|
-
>
|
|
513
|
-
Browser extension testing
|
|
514
|
-
</Card>
|
|
515
|
-
|
|
516
|
-
<Card
|
|
517
|
-
title="Platform Support"
|
|
518
|
-
icon="server"
|
|
519
|
-
href="/v7/platforms/linux"
|
|
520
|
-
>
|
|
521
|
-
Cross-platform documentation
|
|
522
|
-
</Card>
|
|
523
|
-
|
|
524
|
-
<Card
|
|
525
|
-
title="API Reference"
|
|
526
|
-
icon="book"
|
|
527
|
-
href="/v7/api/client"
|
|
528
|
-
>
|
|
529
|
-
Complete API documentation
|
|
530
|
-
</Card>
|
|
531
|
-
</CardGroup>
|