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.
@@ -1,430 +0,0 @@
1
- ---
2
- title: "Windows"
3
- description: "Run TestDriver tests on Windows sandboxes (Enterprise)"
4
- icon: "windows"
5
- ---
6
-
7
- <Info>
8
- Windows sandboxes are available on **Enterprise plans only**. [Contact sales](https://testdriver.ai/contact) to enable Windows testing.
9
- </Info>
10
-
11
- ## Overview
12
-
13
- Windows sandboxes enable testing of Windows-specific applications, desktop software, and Windows-only workflows.
14
-
15
- Windows sandboxes provide:
16
- - Windows Server 2019/2022
17
- - Full desktop environment
18
- - PowerShell and Command Prompt
19
- - Support for all TestDriver commands
20
- - Custom AMI support for pre-installed software
21
- - RDP access for debugging
22
-
23
- ## Usage
24
-
25
- Specify Windows as the operating system:
26
-
27
- ```javascript
28
- import { TestDriver } from '@testdriverai/testdriver';
29
-
30
- const testdriver = await TestDriver.create({
31
- apiKey: process.env.TD_API_KEY,
32
- os: 'windows' // Requires Enterprise plan
33
- });
34
- ```
35
-
36
- ### With Lifecycle Helpers
37
-
38
- ```javascript
39
- import { chrome } from './setup/lifecycleHelpers.mjs';
40
- import { test } from 'vitest';
41
-
42
- test('windows app test', async (context) => {
43
- const { testdriver } = await chrome(context, {
44
- url: 'https://example.com',
45
- os: 'windows'
46
- });
47
-
48
- await testdriver.find('login button').then(el => el.click());
49
- });
50
- ```
51
-
52
- ## System Details
53
-
54
- ### Operating System
55
- - **OS**: Windows Server 2019 or 2022
56
- - **Architecture**: x86_64 (64-bit)
57
- - **Desktop**: Windows Desktop Experience
58
-
59
- ### Pre-installed Software
60
- - **Browsers**: Chrome, Edge, Firefox
61
- - **Runtimes**: .NET Framework, .NET Core
62
- - **Languages**: Node.js, Python (optional)
63
- - **Tools**: PowerShell 5.1+, Git, Visual Studio Build Tools (optional)
64
-
65
- ### Default Resolution
66
- - **1920x1080** (configurable via `resolution` parameter)
67
-
68
- ## Configuration
69
-
70
- ### Custom Resolution
71
-
72
- Set screen resolution:
73
-
74
- ```javascript
75
- const testdriver = await TestDriver.create({
76
- apiKey: process.env.TD_API_KEY,
77
- os: 'windows',
78
- resolution: '1280x720'
79
- });
80
- ```
81
-
82
- ### Environment Variables
83
-
84
- ```javascript
85
- const testdriver = await TestDriver.create({
86
- apiKey: process.env.TD_API_KEY,
87
- os: 'windows',
88
- env: {
89
- NODE_ENV: 'test',
90
- DEBUG: 'true'
91
- }
92
- });
93
- ```
94
-
95
- ## Custom AMI
96
-
97
- Enterprise plans support **custom Windows AMIs** with pre-installed software, reducing test setup time.
98
-
99
- ### Benefits
100
- - Pre-install proprietary software
101
- - Configure system settings
102
- - Install custom certificates
103
- - Set up development tools
104
-
105
- ### Setup
106
-
107
- 1. Contact TestDriver support to create custom AMI
108
- 2. Provide installation scripts and requirements
109
- 3. Reference AMI in tests:
110
-
111
- ```javascript
112
- const testdriver = await TestDriver.create({
113
- apiKey: process.env.TD_API_KEY,
114
- os: 'windows',
115
- ami: 'ami-custom-windows-123' // Your custom AMI ID
116
- });
117
- ```
118
-
119
- See [Self-Hosting Guide](/v7/guides/self-hosting) for details on managing custom AMIs.
120
-
121
- ## Common Use Cases
122
-
123
- ### Windows Desktop Applications
124
-
125
- Test native Windows applications:
126
-
127
- ```javascript
128
- import { test } from 'vitest';
129
-
130
- test('windows desktop app', async (context) => {
131
- const { testdriver } = await chrome(context, { os: 'windows' });
132
-
133
- // Launch application
134
- await testdriver.exec('pwsh',
135
- 'Start-Process "C:\\Program Files\\MyApp\\MyApp.exe"',
136
- 5000
137
- );
138
-
139
- // Wait for app to load
140
- await new Promise(r => setTimeout(r, 3000));
141
-
142
- // Interact with app
143
- await testdriver.find('main menu').then(el => el.click());
144
- await testdriver.find('file open').then(el => el.click());
145
- });
146
- ```
147
-
148
- ### .NET Applications
149
-
150
- Test .NET Framework or .NET Core apps:
151
-
152
- ```javascript
153
- test('dotnet app', async (context) => {
154
- const { testdriver } = await chrome(context, { os: 'windows' });
155
-
156
- // Run .NET application
157
- await testdriver.exec('pwsh',
158
- 'dotnet run --project C:\\app\\MyApp.csproj',
159
- 10000
160
- );
161
-
162
- await testdriver.find('window title').then(el => el.click());
163
- });
164
- ```
165
-
166
- ### Registry Operations
167
-
168
- Modify Windows Registry:
169
-
170
- ```javascript
171
- test('registry test', async (context) => {
172
- const { testdriver } = await chrome(context, { os: 'windows' });
173
-
174
- // Set registry value
175
- await testdriver.exec('pwsh',
176
- 'Set-ItemProperty -Path "HKCU:\\Software\\MyApp" -Name "Setting" -Value "Test"',
177
- 5000
178
- );
179
-
180
- // Read registry value
181
- const result = await testdriver.exec('pwsh',
182
- 'Get-ItemProperty -Path "HKCU:\\Software\\MyApp" -Name "Setting"',
183
- 5000
184
- );
185
- console.log('Registry value:', result);
186
- });
187
- ```
188
-
189
- ### File Operations
190
-
191
- Work with Windows file system:
192
-
193
- ```javascript
194
- test('file operations', async (context) => {
195
- const { testdriver } = await chrome(context, { os: 'windows' });
196
-
197
- // Create directory
198
- await testdriver.exec('pwsh', 'New-Item -Path "C:\\Test" -ItemType Directory', 5000);
199
-
200
- // Download file
201
- await testdriver.exec('pwsh',
202
- 'Invoke-WebRequest -Uri "https://example.com/file.zip" -OutFile "C:\\Test\\file.zip"',
203
- 30000
204
- );
205
-
206
- // Extract archive
207
- await testdriver.exec('pwsh',
208
- 'Expand-Archive -Path "C:\\Test\\file.zip" -DestinationPath "C:\\Test"',
209
- 10000
210
- );
211
- });
212
- ```
213
-
214
- ## Command Execution
215
-
216
- ### PowerShell
217
-
218
- Execute PowerShell commands:
219
-
220
- ```javascript
221
- // PowerShell Core (pwsh)
222
- await testdriver.exec('pwsh', 'Get-Process', 5000);
223
-
224
- // PowerShell 5.1 (powershell)
225
- await testdriver.exec('powershell', 'Get-Service', 5000);
226
- ```
227
-
228
- ### Command Prompt
229
-
230
- Execute CMD commands:
231
-
232
- ```javascript
233
- await testdriver.exec('cmd', 'dir C:\\', 5000);
234
- ```
235
-
236
- ### Batch Scripts
237
-
238
- Run batch files:
239
-
240
- ```javascript
241
- // Create batch file
242
- await testdriver.exec('cmd',
243
- 'echo @echo off > C:\\test.bat && echo echo Hello >> C:\\test.bat',
244
- 5000
245
- );
246
-
247
- // Execute batch file
248
- await testdriver.exec('cmd', 'C:\\test.bat', 5000);
249
- ```
250
-
251
- ## Package Management
252
-
253
- ### Chocolatey
254
-
255
- Install packages with Chocolatey (if pre-installed on AMI):
256
-
257
- ```javascript
258
- // Install package
259
- await testdriver.exec('pwsh',
260
- 'choco install -y git',
261
- 60000
262
- );
263
-
264
- // Use installed software
265
- await testdriver.exec('pwsh', 'git --version', 5000);
266
- ```
267
-
268
- ### NPM
269
-
270
- Install Node.js packages:
271
-
272
- ```javascript
273
- await testdriver.exec('pwsh', 'npm install -g typescript', 30000);
274
- ```
275
-
276
- ### NuGet
277
-
278
- Install .NET packages:
279
-
280
- ```javascript
281
- await testdriver.exec('pwsh',
282
- 'Install-Package Newtonsoft.Json -Force',
283
- 30000
284
- );
285
- ```
286
-
287
- ## Debugging
288
-
289
- ### RDP Access
290
-
291
- Connect via Remote Desktop Protocol:
292
-
293
- ```javascript
294
- const instance = testdriver.getInstance();
295
- console.log('RDP:', `${instance.ip}:${instance.rdpPort || 3389}`);
296
-
297
- // Use RDP client to connect and watch tests
298
- ```
299
-
300
- ### Screenshots
301
-
302
- Capture screenshots:
303
-
304
- ```javascript
305
- // Windows screenshot via PowerShell
306
- await testdriver.exec('pwsh',
307
- 'Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait("{PRTSC}"); Start-Sleep -Seconds 1',
308
- 5000
309
- );
310
- ```
311
-
312
- ### Event Logs
313
-
314
- Access Windows Event Logs:
315
-
316
- ```javascript
317
- const logs = await testdriver.exec('pwsh',
318
- 'Get-EventLog -LogName Application -Newest 10',
319
- 5000
320
- );
321
- console.log('Event logs:', logs);
322
- ```
323
-
324
- ## Performance
325
-
326
- ### Startup Time
327
- - **First test**: 60-120s (Windows boots slower than Linux)
328
- - **Subsequent tests**: 0s (sandbox reuse)
329
- - **Custom AMI**: Faster (pre-installed software)
330
-
331
- ### Optimization Tips
332
- - Use custom AMI with pre-installed software
333
- - Reuse sandboxes across tests
334
- - Enable caching
335
- - Minimize software installation during tests
336
-
337
- See [Performance Guide](/v7/guides/performance) for details.
338
-
339
- ## Limitations
340
-
341
- ### Slower Startup
342
- Windows sandboxes take longer to boot than Linux (60-120s vs 20-60s).
343
-
344
- ### Higher Cost
345
- Windows sandboxes consume more test minutes due to licensing.
346
-
347
- ### Limited Free Tier
348
- Windows sandboxes not available on free tier.
349
-
350
- ## Troubleshooting
351
-
352
- ### Application Won't Launch
353
-
354
- ```javascript
355
- // Try launching with full path
356
- await testdriver.exec('pwsh',
357
- 'Start-Process -FilePath "C:\\Program Files\\App\\app.exe"',
358
- 5000
359
- );
360
-
361
- // Or use cmd
362
- await testdriver.exec('cmd',
363
- 'start "" "C:\\Program Files\\App\\app.exe"',
364
- 5000
365
- );
366
- ```
367
-
368
- ### Permission Denied
369
-
370
- ```javascript
371
- // Run as administrator (if AMI configured)
372
- await testdriver.exec('pwsh',
373
- 'Start-Process -FilePath "app.exe" -Verb RunAs',
374
- 5000
375
- );
376
- ```
377
-
378
- ### Timeout Issues
379
-
380
- Increase timeout for slower Windows operations:
381
-
382
- ```javascript
383
- await testdriver.exec('pwsh', 'command', 120000); // 2 minutes
384
- ```
385
-
386
- ## Enterprise Features
387
-
388
- ### Custom AMI Management
389
- - Pre-install proprietary software
390
- - Configure system settings
391
- - Install certificates and licenses
392
- - Set up development environments
393
-
394
- ### Dedicated Sandboxes
395
- - Reserved Windows instances
396
- - Faster startup (always-on)
397
- - Guaranteed availability
398
-
399
- ### Support
400
- - Priority support for Windows issues
401
- - Custom AMI creation assistance
402
- - Windows-specific troubleshooting
403
-
404
- ## Contact Sales
405
-
406
- Ready to enable Windows testing?
407
-
408
- <Card title="Contact Sales" icon="envelope" href="https://testdriver.ai/contact">
409
- Get Enterprise access to Windows sandboxes
410
- </Card>
411
-
412
- ## See Also
413
-
414
- <CardGroup cols={2}>
415
- <Card title="Linux" icon="linux" href="/v7/platforms/linux">
416
- Linux sandboxes (default)
417
- </Card>
418
-
419
- <Card title="macOS" icon="apple" href="/v7/platforms/macos">
420
- macOS sandboxes (Beta)
421
- </Card>
422
-
423
- <Card title="Self-Hosting" icon="server" href="/v7/guides/self-hosting">
424
- Custom AMI management
425
- </Card>
426
-
427
- <Card title="Configuration" icon="gear" href="/v7/getting-started/configuration">
428
- Sandbox configuration
429
- </Card>
430
- </CardGroup>
@@ -1,222 +0,0 @@
1
- # TestDriver SDK - Formatted Logging for Dashcam
2
-
3
- The TestDriver SDK now includes clean, structured logging that makes logs easy to read when replayed in Dashcam.
4
-
5
- ## Features
6
-
7
- ✨ **Clean, structured formatting** with clear labels and timestamps
8
- ā±ļø **Timestamp tracking** showing elapsed time from test start
9
- šŸŽÆ **Action-specific formatting** for find, click, type, hover, scroll, assert
10
- ⚔ **Cache indicators** showing when elements are found from cache
11
- šŸ“Š **Test context integration** with Vitest test information
12
- šŸŽ„ **Dashcam-optimized** - no emojis or ANSI codes, pure text format
13
-
14
- ## How It Works
15
-
16
- All logs sent through the `log:log` event are automatically formatted before being sent to Dashcam. This means when you replay your test in Dashcam, you'll see beautiful, easy-to-read logs with:
17
-
18
- - **Clear prefixes** like `[FIND]`, `[CLICK]`, `[ASSERT]` for different action types
19
- - **Highlighted information** for element descriptions and coordinates
20
- - **Elapsed timestamps** from test start like `[30.59s]`
21
- - **Cache hit indicators** showing performance optimizations with `(cached)`
22
- - **Duration information** for operations
23
-
24
- ## Usage
25
-
26
- ### Basic Setup
27
-
28
- The formatter is automatically integrated into the SDK. Just use the SDK normally:
29
-
30
- ```javascript
31
- import { afterAll, beforeAll, describe, it } from "vitest";
32
- import {
33
- createTestClient,
34
- setupTest,
35
- teardownTest,
36
- } from "./setup/testHelpers.mjs";
37
-
38
- describe("My Test", () => {
39
- let testdriver;
40
-
41
- beforeAll(async () => {
42
- testdriver = createTestClient();
43
- await setupTest(testdriver);
44
- });
45
-
46
- afterAll(async () => {
47
- await teardownTest(testdriver);
48
- });
49
-
50
- it("should have nice logs", async () => {
51
- // Logs are automatically formatted!
52
- const button = await testdriver.find("Submit button");
53
- await button.click();
54
- });
55
- });
56
- ```
57
-
58
- ### Enhanced Logging with Test Context
59
-
60
- For even better logging with timestamps, set the test context:
61
-
62
- ```javascript
63
- beforeAll(async () => {
64
- testdriver = createTestClient();
65
-
66
- // Set test context for enhanced logging
67
- testdriver.setTestContext({
68
- file: "my-test.spec.mjs",
69
- test: "My Test Suite",
70
- startTime: Date.now(),
71
- });
72
-
73
- await setupTest(testdriver);
74
- });
75
- ```
76
-
77
- This enables elapsed time display like `[30.59s]` in your logs.
78
-
79
- ## Log Format Examples
80
-
81
- ### Element Found
82
-
83
- ```
84
- [30.59s] [FIND] Found "Submit button" at (682, 478) 1597ms (cached)
85
- ```
86
-
87
- ### Click Action
88
-
89
- ```
90
- [35.43s] [CLICK] Click "Submit button"
91
- ```
92
-
93
- ### Hover Action
94
-
95
- ```
96
- [12.15s] [HOVER] Hover "Menu item"
97
- ```
98
-
99
- ### Type Action
100
-
101
- ```
102
- [8.32s] [TYPE] Type "user@example.com"
103
- ```
104
-
105
- ### Assertion
106
-
107
- ```
108
- [42.10s] [ASSERT] "form submission successful" PASSED
109
- ```
110
-
111
- ### Error
112
-
113
- ```
114
- [15.23s] [FAIL] Failed to save debug image - Error: ENOENT: no such file or directory
115
- ```
116
-
117
- ## Formatter API
118
-
119
- The formatter is available through the `sdk-log-formatter.js` module:
120
-
121
- ```javascript
122
- const { formatter } = require("./sdk-log-formatter");
123
-
124
- // Format different types of messages
125
- formatter.formatElementFound("Button", {
126
- x: 100,
127
- y: 200,
128
- duration: "1500ms",
129
- cacheHit: true,
130
- });
131
- formatter.formatAction("click", "Submit button");
132
- formatter.formatAssertion("form is visible", true);
133
- formatter.formatError("Connection failed", error);
134
- ```
135
-
136
- ### Available Methods
137
-
138
- - `formatElementFound(description, meta)` - Format element discovery
139
- - `formatAction(action, description, meta)` - Format user actions
140
- - `formatAssertion(assertion, passed, meta)` - Format test assertions
141
- - `formatError(message, error)` - Format error messages
142
- - `formatHeader(title)` - Create section headers
143
- - `formatSummary(stats)` - Format test summaries
144
- - `setTestContext(context)` - Update test context for timing
145
-
146
- ## Dashcam Compatibility
147
-
148
- The formatter is designed specifically for Dashcam replay compatibility:
149
-
150
- - **No emojis** - Uses text labels like `[FIND]`, `[CLICK]` instead of icons
151
- - **No ANSI colors** - Plain text formatting that displays correctly in all environments
152
- - **No special characters** - Simple ASCII characters only
153
- - **Clean structure** - Easy to read in logs without terminal formatting
154
-
155
- ## Integration with Dashcam
156
-
157
- When you run tests with Dashcam recording:
158
-
159
- 1. The SDK sends formatted logs to the `log:log` event
160
- 2. These logs are forwarded to the sandbox via `_forwardLogToSandbox()`
161
- 3. Dashcam captures and stores these logs with precise timestamps
162
- 4. When you replay in Dashcam, you see beautifully formatted logs synchronized with the video
163
-
164
- ### Example Workflow
165
-
166
- ```bash
167
- # Run tests with Dashcam
168
- npx vitest run testdriver/acceptance-sdk/formatted-logging.test.mjs
169
-
170
- # View the replay with formatted logs
171
- # Open the Dashcam URL from the test output
172
- ```
173
-
174
- ## Customization
175
-
176
- ### Custom Action Types
177
-
178
- Add custom action types to the formatter:
179
-
180
- ```javascript
181
- // In sdk-log-formatter.js, add to getPrefix():
182
- const prefixes = {
183
- // ...existing prefixes
184
- myAction: "[CUSTOM]",
185
- };
186
- ```
187
-
188
- ### Custom Message Formatting
189
-
190
- Override the `formatMessage` method for custom text highlighting:
191
-
192
- ```javascript
193
- formatMessage(type, message) {
194
- // Add custom highlighting
195
- message = message.replace(/\[custom\]/g, chalk.green('[custom]'));
196
- return super.formatMessage(type, message);
197
- }
198
- ```
199
-
200
- ## Examples
201
-
202
- See `testdriver/acceptance-sdk/formatted-logging.test.mjs` for a complete example.
203
-
204
- ## Benefits for Dashcam Replay
205
-
206
- - **Better debugging**: Quickly identify what happened at each step
207
- - **Professional appearance**: Share polished test recordings with stakeholders
208
- - **Faster analysis**: Labeled actions make it easy to scan logs
209
- - **Context awareness**: Timestamps help correlate logs with video timeline
210
- - **Performance insights**: Cache indicators show optimization opportunities
211
- - **Universal compatibility**: Works in any environment without terminal support
212
-
213
- ## Technical Details
214
-
215
- The formatter uses:
216
-
217
- - **Plain text formatting** for universal compatibility
218
- - **Event emitters** to intercept log events
219
- - **Base64 encoding** for safe transmission to sandbox
220
- - **Test context** from Vitest for timing information
221
-
222
- Logs are sent through the existing `log:log` event system, ensuring compatibility with all existing TestDriver infrastructure.
@@ -1,11 +0,0 @@
1
- /**
2
- * Vitest Global Teardown
3
- * Saves test results and dashcam URLs after all tests complete
4
- */
5
-
6
- import { saveTestResults } from "./testHelpers.mjs";
7
-
8
- export default async function globalTeardown() {
9
- console.log("\nšŸŽ¬ Saving test results and dashcam URLs...");
10
- saveTestResults();
11
- }