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,433 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "macOS"
|
|
3
|
-
description: "Run TestDriver tests on macOS sandboxes (Beta)"
|
|
4
|
-
icon: "apple"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
<Warning>
|
|
8
|
-
macOS sandboxes are currently in **Beta**. Availability is limited and features may change. [Join the waitlist](https://testdriver.ai/contact) for early access.
|
|
9
|
-
</Warning>
|
|
10
|
-
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
macOS sandboxes enable testing of Mac-specific applications, desktop software, and macOS-only workflows.
|
|
14
|
-
|
|
15
|
-
macOS sandboxes provide:
|
|
16
|
-
- macOS Ventura (13.x) or Sonoma (14.x)
|
|
17
|
-
- Full desktop environment
|
|
18
|
-
- Terminal and command-line tools
|
|
19
|
-
- Support for all TestDriver commands
|
|
20
|
-
- VNC access for debugging
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
Specify macOS as the operating system:
|
|
25
|
-
|
|
26
|
-
```javascript
|
|
27
|
-
import { TestDriver } from '@testdriverai/testdriver';
|
|
28
|
-
|
|
29
|
-
const testdriver = await TestDriver.create({
|
|
30
|
-
apiKey: process.env.TD_API_KEY,
|
|
31
|
-
os: 'macos' // Beta access required
|
|
32
|
-
});
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### With Lifecycle Helpers
|
|
36
|
-
|
|
37
|
-
```javascript
|
|
38
|
-
import { chrome } from './setup/lifecycleHelpers.mjs';
|
|
39
|
-
import { test } from 'vitest';
|
|
40
|
-
|
|
41
|
-
test('macos app test', async (context) => {
|
|
42
|
-
const { testdriver } = await chrome(context, {
|
|
43
|
-
url: 'https://example.com',
|
|
44
|
-
os: 'macos'
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
await testdriver.find('login button').then(el => el.click());
|
|
48
|
-
});
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## System Details
|
|
52
|
-
|
|
53
|
-
### Operating System
|
|
54
|
-
- **OS**: macOS Ventura 13.x or Sonoma 14.x
|
|
55
|
-
- **Architecture**: x86_64 (Intel) or arm64 (Apple Silicon)
|
|
56
|
-
- **Desktop**: Aqua (native macOS desktop)
|
|
57
|
-
|
|
58
|
-
### Pre-installed Software
|
|
59
|
-
- **Browsers**: Safari, Chrome, Firefox
|
|
60
|
-
- **Runtimes**: Node.js, Python 3, Ruby
|
|
61
|
-
- **Languages**: Swift, Objective-C (Xcode Command Line Tools)
|
|
62
|
-
- **Tools**: Homebrew, Git, vim
|
|
63
|
-
|
|
64
|
-
### Default Resolution
|
|
65
|
-
- **1920x1080** (configurable via `resolution` parameter)
|
|
66
|
-
|
|
67
|
-
## Configuration
|
|
68
|
-
|
|
69
|
-
### Custom Resolution
|
|
70
|
-
|
|
71
|
-
Set screen resolution:
|
|
72
|
-
|
|
73
|
-
```javascript
|
|
74
|
-
const testdriver = await TestDriver.create({
|
|
75
|
-
apiKey: process.env.TD_API_KEY,
|
|
76
|
-
os: 'macos',
|
|
77
|
-
resolution: '1440x900' // Common Mac resolution
|
|
78
|
-
});
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Common macOS resolutions:
|
|
82
|
-
- `2560x1440` - 27" iMac
|
|
83
|
-
- `1920x1080` - Full HD
|
|
84
|
-
- `1440x900` - MacBook Pro (scaled)
|
|
85
|
-
- `1280x800` - MacBook Air
|
|
86
|
-
|
|
87
|
-
### Environment Variables
|
|
88
|
-
|
|
89
|
-
```javascript
|
|
90
|
-
const testdriver = await TestDriver.create({
|
|
91
|
-
apiKey: process.env.TD_API_KEY,
|
|
92
|
-
os: 'macos',
|
|
93
|
-
env: {
|
|
94
|
-
NODE_ENV: 'test',
|
|
95
|
-
DEBUG: 'true'
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
## Common Use Cases
|
|
101
|
-
|
|
102
|
-
### macOS Desktop Applications
|
|
103
|
-
|
|
104
|
-
Test native Mac applications:
|
|
105
|
-
|
|
106
|
-
```javascript
|
|
107
|
-
import { test } from 'vitest';
|
|
108
|
-
|
|
109
|
-
test('macos desktop app', async (context) => {
|
|
110
|
-
const { testdriver } = await chrome(context, { os: 'macos' });
|
|
111
|
-
|
|
112
|
-
// Launch application
|
|
113
|
-
await testdriver.exec('sh', 'open -a "MyApp"', 5000);
|
|
114
|
-
|
|
115
|
-
// Wait for app to load
|
|
116
|
-
await new Promise(r => setTimeout(r, 3000));
|
|
117
|
-
|
|
118
|
-
// Interact with app
|
|
119
|
-
await testdriver.find('menu bar').then(el => el.click());
|
|
120
|
-
await testdriver.find('preferences').then(el => el.click());
|
|
121
|
-
});
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Safari Testing
|
|
125
|
-
|
|
126
|
-
Test web apps in Safari:
|
|
127
|
-
|
|
128
|
-
```javascript
|
|
129
|
-
test('safari compatibility', async (context) => {
|
|
130
|
-
const { testdriver } = await chrome(context, {
|
|
131
|
-
url: 'https://example.com',
|
|
132
|
-
os: 'macos',
|
|
133
|
-
browser: 'safari'
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
await testdriver.find('login form').then(el => el.click());
|
|
137
|
-
await testdriver.type('user@example.com');
|
|
138
|
-
});
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### Electron Apps
|
|
142
|
-
|
|
143
|
-
Test Electron applications on macOS:
|
|
144
|
-
|
|
145
|
-
```javascript
|
|
146
|
-
test('electron on macos', async (context) => {
|
|
147
|
-
const { testdriver } = await chrome(context, { os: 'macos' });
|
|
148
|
-
|
|
149
|
-
// Launch Electron app
|
|
150
|
-
await testdriver.exec('sh',
|
|
151
|
-
'/Applications/MyApp.app/Contents/MacOS/MyApp',
|
|
152
|
-
5000
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
await testdriver.find('window').then(el => el.click());
|
|
156
|
-
});
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### iOS Development Testing
|
|
160
|
-
|
|
161
|
-
Test iOS development tools and workflows:
|
|
162
|
-
|
|
163
|
-
```javascript
|
|
164
|
-
test('xcode tools', async (context) => {
|
|
165
|
-
const { testdriver } = await chrome(context, { os: 'macos' });
|
|
166
|
-
|
|
167
|
-
// Check Xcode installation
|
|
168
|
-
await testdriver.exec('sh', 'xcodebuild -version', 5000);
|
|
169
|
-
|
|
170
|
-
// Run Swift script
|
|
171
|
-
await testdriver.exec('sh', 'swift --version', 5000);
|
|
172
|
-
});
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
## Command Execution
|
|
176
|
-
|
|
177
|
-
### Shell Commands
|
|
178
|
-
|
|
179
|
-
Execute shell commands (zsh is default on modern macOS):
|
|
180
|
-
|
|
181
|
-
```javascript
|
|
182
|
-
// Run shell command
|
|
183
|
-
await testdriver.exec('sh', 'ls -la /Applications', 5000);
|
|
184
|
-
|
|
185
|
-
// Run zsh-specific command
|
|
186
|
-
await testdriver.exec('sh', 'echo $SHELL', 5000);
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### AppleScript
|
|
190
|
-
|
|
191
|
-
Execute AppleScript for Mac automation:
|
|
192
|
-
|
|
193
|
-
```javascript
|
|
194
|
-
// Run AppleScript
|
|
195
|
-
await testdriver.exec('sh',
|
|
196
|
-
'osascript -e \'tell application "Safari" to activate\'',
|
|
197
|
-
5000
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
// Run AppleScript file
|
|
201
|
-
await testdriver.exec('sh', 'osascript /path/to/script.scpt', 10000);
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Application Launching
|
|
205
|
-
|
|
206
|
-
Launch macOS applications:
|
|
207
|
-
|
|
208
|
-
```javascript
|
|
209
|
-
// Launch app
|
|
210
|
-
await testdriver.exec('sh', 'open -a "Calculator"', 5000);
|
|
211
|
-
|
|
212
|
-
// Launch app with arguments
|
|
213
|
-
await testdriver.exec('sh', 'open -a "Safari" https://example.com', 5000);
|
|
214
|
-
|
|
215
|
-
// Launch .app bundle
|
|
216
|
-
await testdriver.exec('sh', 'open /Applications/MyApp.app', 5000);
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
## Package Management
|
|
220
|
-
|
|
221
|
-
### Homebrew
|
|
222
|
-
|
|
223
|
-
Install packages with Homebrew:
|
|
224
|
-
|
|
225
|
-
```javascript
|
|
226
|
-
// Update Homebrew
|
|
227
|
-
await testdriver.exec('sh', 'brew update', 60000);
|
|
228
|
-
|
|
229
|
-
// Install package
|
|
230
|
-
await testdriver.exec('sh', 'brew install imagemagick', 120000);
|
|
231
|
-
|
|
232
|
-
// Use installed package
|
|
233
|
-
await testdriver.exec('sh',
|
|
234
|
-
'convert input.png -resize 50% output.png',
|
|
235
|
-
10000
|
|
236
|
-
);
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### NPM
|
|
240
|
-
|
|
241
|
-
Install Node.js packages:
|
|
242
|
-
|
|
243
|
-
```javascript
|
|
244
|
-
await testdriver.exec('sh', 'npm install -g typescript', 30000);
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Pip
|
|
248
|
-
|
|
249
|
-
Install Python packages:
|
|
250
|
-
|
|
251
|
-
```javascript
|
|
252
|
-
await testdriver.exec('sh', 'pip3 install requests', 30000);
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
## Supported Commands
|
|
256
|
-
|
|
257
|
-
All TestDriver commands are supported on macOS:
|
|
258
|
-
|
|
259
|
-
<CardGroup cols={2}>
|
|
260
|
-
<Card title="find()" icon="magnifying-glass">
|
|
261
|
-
Locate UI elements
|
|
262
|
-
</Card>
|
|
263
|
-
|
|
264
|
-
<Card title="click()" icon="hand-pointer">
|
|
265
|
-
Click elements
|
|
266
|
-
</Card>
|
|
267
|
-
|
|
268
|
-
<Card title="type()" icon="keyboard">
|
|
269
|
-
Type text
|
|
270
|
-
</Card>
|
|
271
|
-
|
|
272
|
-
<Card title="pressKeys()" icon="keyboard">
|
|
273
|
-
Press key combinations
|
|
274
|
-
</Card>
|
|
275
|
-
|
|
276
|
-
<Card title="exec()" icon="terminal">
|
|
277
|
-
Execute commands
|
|
278
|
-
</Card>
|
|
279
|
-
|
|
280
|
-
<Card title="assert()" icon="check">
|
|
281
|
-
Verify conditions
|
|
282
|
-
</Card>
|
|
283
|
-
</CardGroup>
|
|
284
|
-
|
|
285
|
-
### Keyboard Shortcuts
|
|
286
|
-
|
|
287
|
-
macOS keyboard shortcuts work as expected:
|
|
288
|
-
|
|
289
|
-
```javascript
|
|
290
|
-
// Command+C (copy)
|
|
291
|
-
await testdriver.pressKeys(['command', 'c']);
|
|
292
|
-
|
|
293
|
-
// Command+V (paste)
|
|
294
|
-
await testdriver.pressKeys(['command', 'v']);
|
|
295
|
-
|
|
296
|
-
// Command+Q (quit app)
|
|
297
|
-
await testdriver.pressKeys(['command', 'q']);
|
|
298
|
-
|
|
299
|
-
// Command+Tab (switch apps)
|
|
300
|
-
await testdriver.pressKeys(['command', 'tab']);
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
## Debugging
|
|
304
|
-
|
|
305
|
-
### VNC Access
|
|
306
|
-
|
|
307
|
-
Connect via VNC to watch tests:
|
|
308
|
-
|
|
309
|
-
```javascript
|
|
310
|
-
const instance = testdriver.getInstance();
|
|
311
|
-
console.log('VNC:', `vnc://${instance.ip}:${instance.vncPort}`);
|
|
312
|
-
|
|
313
|
-
// Use VNC client (Screen Sharing on Mac) to connect
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
### Screen Recording
|
|
317
|
-
|
|
318
|
-
Enable screen recording:
|
|
319
|
-
|
|
320
|
-
```javascript
|
|
321
|
-
// macOS screenshots
|
|
322
|
-
await testdriver.exec('sh',
|
|
323
|
-
'screencapture -x /tmp/screenshot.png',
|
|
324
|
-
5000
|
|
325
|
-
);
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
### Console Logs
|
|
329
|
-
|
|
330
|
-
Access macOS Console logs:
|
|
331
|
-
|
|
332
|
-
```javascript
|
|
333
|
-
const logs = await testdriver.exec('sh',
|
|
334
|
-
'log show --predicate "processImagePath contains \'MyApp\'" --last 5m',
|
|
335
|
-
10000
|
|
336
|
-
);
|
|
337
|
-
console.log('Console logs:', logs);
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
## Performance
|
|
341
|
-
|
|
342
|
-
### Startup Time
|
|
343
|
-
- **First test**: 90-180s (macOS boots slower than Linux)
|
|
344
|
-
- **Subsequent tests**: 0s (sandbox reuse)
|
|
345
|
-
|
|
346
|
-
### Optimization Tips
|
|
347
|
-
- Reuse sandboxes across tests (critical on macOS)
|
|
348
|
-
- Enable caching
|
|
349
|
-
- Minimize Homebrew installations during tests
|
|
350
|
-
- Use parallel test execution carefully (macOS instances are limited)
|
|
351
|
-
|
|
352
|
-
See [Performance Guide](/v7/guides/performance) for details.
|
|
353
|
-
|
|
354
|
-
## Beta Limitations
|
|
355
|
-
|
|
356
|
-
### Limited Availability
|
|
357
|
-
macOS sandboxes are in beta with limited concurrent instances.
|
|
358
|
-
|
|
359
|
-
### Longer Startup
|
|
360
|
-
macOS sandboxes take longer to boot than Linux (90-180s vs 20-60s).
|
|
361
|
-
|
|
362
|
-
### Architecture Constraints
|
|
363
|
-
Currently x86_64 only. Apple Silicon (arm64) support coming soon.
|
|
364
|
-
|
|
365
|
-
### Higher Cost
|
|
366
|
-
macOS sandboxes consume more test minutes due to licensing.
|
|
367
|
-
|
|
368
|
-
## Troubleshooting
|
|
369
|
-
|
|
370
|
-
### Application Permissions
|
|
371
|
-
|
|
372
|
-
macOS apps may require accessibility permissions:
|
|
373
|
-
|
|
374
|
-
```javascript
|
|
375
|
-
// Grant permissions via AppleScript (if configured)
|
|
376
|
-
await testdriver.exec('sh',
|
|
377
|
-
'osascript -e \'tell application "System Events" to keystroke "ok"\'',
|
|
378
|
-
5000
|
|
379
|
-
);
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
### App Won't Launch
|
|
383
|
-
|
|
384
|
-
```javascript
|
|
385
|
-
// Try using open command
|
|
386
|
-
await testdriver.exec('sh', 'open -a "App Name"', 5000);
|
|
387
|
-
|
|
388
|
-
// Or full path to executable
|
|
389
|
-
await testdriver.exec('sh',
|
|
390
|
-
'/Applications/MyApp.app/Contents/MacOS/MyApp',
|
|
391
|
-
5000
|
|
392
|
-
);
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
### Homebrew Installation Slow
|
|
396
|
-
|
|
397
|
-
Homebrew installations can be slow. Pre-install via custom AMI or cache:
|
|
398
|
-
|
|
399
|
-
```javascript
|
|
400
|
-
// Check if already installed
|
|
401
|
-
const result = await testdriver.exec('sh', 'which convert', 5000);
|
|
402
|
-
if (!result.includes('/usr/local/bin/convert')) {
|
|
403
|
-
await testdriver.exec('sh', 'brew install imagemagick', 120000);
|
|
404
|
-
}
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
## Beta Access
|
|
408
|
-
|
|
409
|
-
Interested in testing on macOS?
|
|
410
|
-
|
|
411
|
-
<Card title="Join Beta Waitlist" icon="clipboard" href="https://testdriver.ai/contact">
|
|
412
|
-
Request early access to macOS sandboxes
|
|
413
|
-
</Card>
|
|
414
|
-
|
|
415
|
-
## See Also
|
|
416
|
-
|
|
417
|
-
<CardGroup cols={2}>
|
|
418
|
-
<Card title="Linux" icon="linux" href="/v7/platforms/linux">
|
|
419
|
-
Linux sandboxes (default)
|
|
420
|
-
</Card>
|
|
421
|
-
|
|
422
|
-
<Card title="Windows" icon="windows" href="/v7/platforms/windows">
|
|
423
|
-
Windows sandboxes (Enterprise)
|
|
424
|
-
</Card>
|
|
425
|
-
|
|
426
|
-
<Card title="Configuration" icon="gear" href="/v7/getting-started/configuration">
|
|
427
|
-
Sandbox configuration
|
|
428
|
-
</Card>
|
|
429
|
-
|
|
430
|
-
<Card title="Performance" icon="gauge" href="/v7/guides/performance">
|
|
431
|
-
Optimize test speed
|
|
432
|
-
</Card>
|
|
433
|
-
</CardGroup>
|