testdriverai 7.2.21 → 7.2.23
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/docs/v7/_drafts/plugin-migration.mdx +3 -5
- package/lib/vitest/hooks.mjs +26 -14
- package/package.json +1 -1
- package/test/testdriver/hover-image.test.mjs +19 -1
- package/test/testdriver/hover-text-with-description.test.mjs +19 -1
- package/test/testdriver/match-image.test.mjs +19 -1
- package/test/testdriver/scroll-until-text.test.mjs +19 -1
- package/docs/v7/_drafts/implementation-plan.mdx +0 -994
- package/docs/v7/_drafts/optimal-sdk-design.mdx +0 -1348
- package/docs/v7/_drafts/performance.mdx +0 -517
- package/docs/v7/_drafts/platforms/linux.mdx +0 -308
- package/docs/v7/_drafts/platforms/macos.mdx +0 -433
- package/docs/v7/_drafts/platforms/windows.mdx +0 -430
- package/docs/v7/_drafts/sdk-logging.mdx +0 -222
- package/test/testdriver/setup/globalTeardown.mjs +0 -11
- package/test/testdriver/setup/lifecycleHelpers.mjs +0 -357
- package/test/testdriver/setup/testHelpers.mjs +0 -541
- package/test/testdriver/setup/vitestSetup.mjs +0 -40
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Linux"
|
|
3
|
-
description: "Run TestDriver tests on Linux sandboxes (default platform)"
|
|
4
|
-
icon: "linux"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
Linux is the **default platform** for TestDriver sandboxes. All tests run on Ubuntu 22.04 unless otherwise specified.
|
|
10
|
-
|
|
11
|
-
Linux sandboxes provide:
|
|
12
|
-
- Fast startup times (20-60s)
|
|
13
|
-
- Full desktop environment (XFCE)
|
|
14
|
-
- Chrome, Firefox, and other browsers pre-installed
|
|
15
|
-
- Support for all TestDriver commands
|
|
16
|
-
- VNC access for debugging
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
|
|
20
|
-
Linux is used automatically when you create a TestDriver instance:
|
|
21
|
-
|
|
22
|
-
```javascript
|
|
23
|
-
import { TestDriver } from '@testdriverai/testdriver';
|
|
24
|
-
|
|
25
|
-
// Linux is the default - no os parameter needed
|
|
26
|
-
const testdriver = await TestDriver.create({
|
|
27
|
-
apiKey: process.env.TD_API_KEY
|
|
28
|
-
});
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Or explicitly specify Linux:
|
|
32
|
-
|
|
33
|
-
```javascript
|
|
34
|
-
const testdriver = await TestDriver.create({
|
|
35
|
-
apiKey: process.env.TD_API_KEY,
|
|
36
|
-
os: 'linux' // Optional - this is the default
|
|
37
|
-
});
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## System Details
|
|
41
|
-
|
|
42
|
-
### Operating System
|
|
43
|
-
- **Distribution**: Ubuntu 22.04 LTS
|
|
44
|
-
- **Desktop Environment**: XFCE
|
|
45
|
-
- **Architecture**: x86_64 (amd64)
|
|
46
|
-
|
|
47
|
-
### Pre-installed Software
|
|
48
|
-
- **Browsers**: Chrome, Firefox ESR, Chrome for Testing
|
|
49
|
-
- **Languages**: Node.js 20, Python 3, build-essential (C/C++)
|
|
50
|
-
- **Development**: VS Code, Git, vim, nano
|
|
51
|
-
- **Office**: LibreOffice, Gnumeric
|
|
52
|
-
- **Graphics**: ImageMagick, xpaint, scrot, gnome-screenshot
|
|
53
|
-
- **Utilities**: xterm, xdotool, gedit, xpdf, pcmanfm (file manager), galculator
|
|
54
|
-
- **Desktop**: XFCE4 desktop environment, tint2 panel
|
|
55
|
-
- **Tools**: curl, wget, unzip, net-tools, netcat, jumpapp
|
|
56
|
-
- **Multimedia**: FFmpeg
|
|
57
|
-
- **TestDriver**: Dashcam (v1.4.11-beta.0), dashcam-chrome
|
|
58
|
-
|
|
59
|
-
### Default Resolution
|
|
60
|
-
- **1366x768** (configurable via `resolution` parameter)
|
|
61
|
-
|
|
62
|
-
## Configuration
|
|
63
|
-
|
|
64
|
-
### Custom Resolution
|
|
65
|
-
|
|
66
|
-
Set a custom screen resolution:
|
|
67
|
-
|
|
68
|
-
```javascript
|
|
69
|
-
const testdriver = await TestDriver.create({
|
|
70
|
-
apiKey: process.env.TD_API_KEY,
|
|
71
|
-
os: 'linux',
|
|
72
|
-
resolution: '1280x720' // HD
|
|
73
|
-
});
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Common resolutions:
|
|
77
|
-
- `1366x768` - Default
|
|
78
|
-
- `1920x1080` - Full HD
|
|
79
|
-
- `1280x720` - HD
|
|
80
|
-
- `2560x1440` - 2K
|
|
81
|
-
- `3840x2160` - 4K
|
|
82
|
-
|
|
83
|
-
### Environment Variables
|
|
84
|
-
|
|
85
|
-
Set environment variables in the sandbox:
|
|
86
|
-
|
|
87
|
-
```javascript
|
|
88
|
-
const testdriver = await TestDriver.create({
|
|
89
|
-
apiKey: process.env.TD_API_KEY,
|
|
90
|
-
os: 'linux',
|
|
91
|
-
env: {
|
|
92
|
-
NODE_ENV: 'test',
|
|
93
|
-
DEBUG: 'true'
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## Common Use Cases
|
|
99
|
-
|
|
100
|
-
### Web Application Testing
|
|
101
|
-
|
|
102
|
-
Test web apps in Chrome or Firefox:
|
|
103
|
-
|
|
104
|
-
```javascript
|
|
105
|
-
import { chrome } from './setup/lifecycleHelpers.mjs';
|
|
106
|
-
import { test } from 'vitest';
|
|
107
|
-
|
|
108
|
-
test('login flow', async (context) => {
|
|
109
|
-
const { testdriver } = await chrome(context, {
|
|
110
|
-
url: 'https://example.com',
|
|
111
|
-
os: 'linux' // Optional
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
await testdriver.find('email field').then(el => el.click());
|
|
115
|
-
await testdriver.type('user@example.com');
|
|
116
|
-
|
|
117
|
-
await testdriver.find('password field').then(el => el.click());
|
|
118
|
-
await testdriver.type('password123');
|
|
119
|
-
|
|
120
|
-
await testdriver.find('login button').then(el => el.click());
|
|
121
|
-
await testdriver.assert('dashboard loaded');
|
|
122
|
-
});
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Desktop Application Testing
|
|
126
|
-
|
|
127
|
-
Test Electron or other desktop apps:
|
|
128
|
-
|
|
129
|
-
```javascript
|
|
130
|
-
import { electron } from './setup/lifecycleHelpers.mjs';
|
|
131
|
-
import { test } from 'vitest';
|
|
132
|
-
|
|
133
|
-
test('electron app', async (context) => {
|
|
134
|
-
const { testdriver } = await electron(context, {
|
|
135
|
-
appPath: '/path/to/app',
|
|
136
|
-
os: 'linux'
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
await testdriver.find('menu button').then(el => el.click());
|
|
140
|
-
await testdriver.find('settings').then(el => el.click());
|
|
141
|
-
});
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### Command-Line Tools
|
|
145
|
-
|
|
146
|
-
Run shell commands in the sandbox:
|
|
147
|
-
|
|
148
|
-
```javascript
|
|
149
|
-
test('install and test CLI tool', async (context) => {
|
|
150
|
-
const { testdriver } = await chrome(context, { os: 'linux' });
|
|
151
|
-
|
|
152
|
-
// Install tool
|
|
153
|
-
await testdriver.exec('sh', 'npm install -g my-cli-tool', 30000);
|
|
154
|
-
|
|
155
|
-
// Run tool
|
|
156
|
-
const result = await testdriver.exec('sh', 'my-cli-tool --version', 5000);
|
|
157
|
-
console.log('Tool version:', result);
|
|
158
|
-
});
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
## Package Management
|
|
162
|
-
|
|
163
|
-
### APT (Debian/Ubuntu)
|
|
164
|
-
|
|
165
|
-
Install system packages:
|
|
166
|
-
|
|
167
|
-
```javascript
|
|
168
|
-
// Install dependencies
|
|
169
|
-
await testdriver.exec('sh',
|
|
170
|
-
'sudo apt-get update && sudo apt-get install -y imagemagick',
|
|
171
|
-
60000
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
// Use installed package
|
|
175
|
-
await testdriver.exec('sh',
|
|
176
|
-
'convert input.png -resize 50% output.png',
|
|
177
|
-
10000
|
|
178
|
-
);
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### NPM/Node.js
|
|
182
|
-
|
|
183
|
-
Install Node.js packages:
|
|
184
|
-
|
|
185
|
-
```javascript
|
|
186
|
-
// Install package globally
|
|
187
|
-
await testdriver.exec('sh', 'npm install -g typescript', 30000);
|
|
188
|
-
|
|
189
|
-
// Or in project directory
|
|
190
|
-
await testdriver.exec('sh', 'cd /tmp/project && npm install', 60000);
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### Python/Pip
|
|
194
|
-
|
|
195
|
-
Install Python packages:
|
|
196
|
-
|
|
197
|
-
```javascript
|
|
198
|
-
await testdriver.exec('sh', 'pip3 install requests', 30000);
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
## Debugging
|
|
202
|
-
|
|
203
|
-
### VNC Access
|
|
204
|
-
|
|
205
|
-
Connect to sandbox desktop via VNC:
|
|
206
|
-
|
|
207
|
-
```javascript
|
|
208
|
-
const instance = testdriver.getInstance();
|
|
209
|
-
console.log('VNC:', `vnc://${instance.ip}:${instance.vncPort}`);
|
|
210
|
-
|
|
211
|
-
// Use VNC client to connect and watch tests run
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
### Screenshots
|
|
215
|
-
|
|
216
|
-
Take screenshots for debugging:
|
|
217
|
-
|
|
218
|
-
```javascript
|
|
219
|
-
const element = await testdriver.find('error message');
|
|
220
|
-
if (element.found()) {
|
|
221
|
-
console.log('Screenshot:', element.screenshot); // base64
|
|
222
|
-
}
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
### Logs
|
|
226
|
-
|
|
227
|
-
Access sandbox logs:
|
|
228
|
-
|
|
229
|
-
```javascript
|
|
230
|
-
// Run command and capture output
|
|
231
|
-
const logs = await testdriver.exec('sh', 'tail -f /var/log/syslog', 5000);
|
|
232
|
-
console.log('System logs:', logs);
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
## Performance
|
|
236
|
-
|
|
237
|
-
### Startup Time
|
|
238
|
-
- **First test**: 20-60s (sandbox creation)
|
|
239
|
-
- **Subsequent tests**: 0s (sandbox reuse)
|
|
240
|
-
|
|
241
|
-
### Optimization Tips
|
|
242
|
-
- Reuse sandboxes across tests (use context)
|
|
243
|
-
- Enable caching for faster element finding
|
|
244
|
-
- Use parallel test execution
|
|
245
|
-
- Minimize package installations
|
|
246
|
-
|
|
247
|
-
See [Performance Guide](/v7/guides/performance) for details.
|
|
248
|
-
|
|
249
|
-
## Limitations
|
|
250
|
-
|
|
251
|
-
### No Root Access
|
|
252
|
-
Sandboxes run with limited privileges. Some operations requiring root may fail.
|
|
253
|
-
|
|
254
|
-
**Workaround**: Use `sudo` for commands that need elevation (already configured).
|
|
255
|
-
|
|
256
|
-
### Temporary Storage
|
|
257
|
-
Files are not persisted between sandbox sessions unless explicitly saved.
|
|
258
|
-
|
|
259
|
-
**Workaround**: Upload files at test start or use external storage.
|
|
260
|
-
|
|
261
|
-
### Network Restrictions
|
|
262
|
-
Some outbound ports may be blocked for security.
|
|
263
|
-
|
|
264
|
-
**Workaround**: Use standard HTTP/HTTPS (80/443) ports.
|
|
265
|
-
|
|
266
|
-
## Troubleshooting
|
|
267
|
-
|
|
268
|
-
### Package Installation Fails
|
|
269
|
-
|
|
270
|
-
```javascript
|
|
271
|
-
// Update package lists first
|
|
272
|
-
await testdriver.exec('sh', 'sudo apt-get update', 30000);
|
|
273
|
-
await testdriver.exec('sh', 'sudo apt-get install -y package-name', 60000);
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### Display Issues
|
|
277
|
-
|
|
278
|
-
```javascript
|
|
279
|
-
// Set DISPLAY variable
|
|
280
|
-
await testdriver.exec('sh', 'export DISPLAY=:0', 1000);
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
### Permission Denied
|
|
284
|
-
|
|
285
|
-
```javascript
|
|
286
|
-
// Use sudo for system operations
|
|
287
|
-
await testdriver.exec('sh', 'sudo chmod +x /path/to/file', 5000);
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
## See Also
|
|
291
|
-
|
|
292
|
-
<CardGroup cols={2}>
|
|
293
|
-
<Card title="Windows" icon="windows" href="/v7/platforms/windows">
|
|
294
|
-
Windows sandboxes (Enterprise)
|
|
295
|
-
</Card>
|
|
296
|
-
|
|
297
|
-
<Card title="macOS" icon="apple" href="/v7/platforms/macos">
|
|
298
|
-
macOS sandboxes (Beta)
|
|
299
|
-
</Card>
|
|
300
|
-
|
|
301
|
-
<Card title="Configuration" icon="gear" href="/v7/getting-started/configuration">
|
|
302
|
-
Sandbox configuration
|
|
303
|
-
</Card>
|
|
304
|
-
|
|
305
|
-
<Card title="Self-Hosting" icon="server" href="/v7/guides/self-hosting">
|
|
306
|
-
Run your own sandboxes
|
|
307
|
-
</Card>
|
|
308
|
-
</CardGroup>
|