testdriverai 7.5.26 → 7.6.0-test.0
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/CHANGELOG.md +17 -19
- package/README.md +1 -0
- package/agent/lib/config.js +3 -1
- package/agent/lib/sandbox.js +6 -4
- package/ai/agents/testdriver.md +0 -3
- package/ai/skills/testdriver-exec/SKILL.md +23 -40
- package/ai/skills/testdriver-test-writer/SKILL.md +0 -3
- package/ai/skills/testdriver-testdriver/SKILL.md +0 -3
- package/channel.json +9 -0
- package/docs/v6/commands/exec.mdx +15 -21
- package/docs/v7/_drafts/agents.mdx +4 -13
- package/docs/v7/_drafts/commands/exec.mdx +15 -21
- package/docs/v7/exec.mdx +36 -64
- package/docs/v7/quickstart.mdx +1 -1
- package/interfaces/cli/commands/init.js +2 -1
- package/interfaces/vitest-plugin.mjs +23 -2
- package/lib/core/Dashcam.js +23 -2
- package/lib/init-project.js +67 -27
- package/lib/vitest/hooks.mjs +2 -1
- package/mcp-server/README.md +12 -2
- package/mcp-server/dist/codegen.js +1 -1
- package/mcp-server/dist/server.mjs +50 -2
- package/mcp-server/src/codegen.ts +1 -1
- package/mcp-server/src/server.ts +44 -2
- package/package.json +6 -2
- package/sdk.d.ts +2 -2
- package/sdk.js +47 -2
- package/vitest.config.mjs +56 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
## 7.
|
|
1
|
+
## 7.6.0-test.0 (2026-03-12)
|
|
2
2
|
|
|
3
3
|
## ✨ Features
|
|
4
4
|
|
|
5
|
-
- Add stable
|
|
6
|
-
- Add version API endpoint
|
|
7
|
-
-
|
|
8
|
-
- Add
|
|
9
|
-
- Add
|
|
10
|
-
- Add
|
|
11
|
-
- Improve test
|
|
12
|
-
- Improve test case management interface with better filtering and search [Web] (50347881)
|
|
13
|
-
- Improve test run detail view with more comprehensive information [Web] (50347881)
|
|
14
|
-
- Add PostHog analytics integration for better user tracking (50347881)
|
|
5
|
+
- Add stable/canary deployment channels with separate environments for production and development branches [API] (64542a8d)
|
|
6
|
+
- Add /version API endpoint returning deployment channel information [API] (64542a8d)
|
|
7
|
+
- Implement user limits and team member invitation controls [API] (6381290a)
|
|
8
|
+
- Add comprehensive GitHub Copilot skills and agent documentation for AI-assisted test development [SDK] (5ff15796)
|
|
9
|
+
- Add testimonials section with customer logos and quotes to marketing site [Web] (6381290a)
|
|
10
|
+
- Add contact and demo pages to marketing site [Web] (6381290a)
|
|
11
|
+
- Improve test environment management with better configuration and deployment workflows [Runner] (5c96e056)
|
|
15
12
|
|
|
16
13
|
## 🐛 Bug Fixes
|
|
17
14
|
|
|
18
|
-
- Fix
|
|
19
|
-
-
|
|
15
|
+
- Fix environment configuration and Tailscale connectivity issues [Runner] (5c96e056)
|
|
16
|
+
- Resolve Redis URL configuration problems across environments [API] (eca334be)
|
|
17
|
+
- Fix Vite API endpoint configuration for proper environment targeting [Web] (bf7fdf54)
|
|
20
18
|
|
|
21
19
|
## 🔧 Maintenance
|
|
22
20
|
|
|
23
|
-
- Update pricing configuration
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
21
|
+
- Update pricing configuration and plans structure [API] (6381290a)
|
|
22
|
+
- Improve deployment workflows with promotion pipelines between test, canary, and stable branches [CI/CD] (1994d769)
|
|
23
|
+
- Add toast notification system for better user feedback [Web] (multiple commits)
|
|
24
|
+
- Rename TestAnalytics to TestMetrics for clarity [Web] (multiple commits)
|
|
25
|
+
- Remove outdated marketing articles and legal pages [Web] (6381290a)
|
|
26
|
+
- Update terms of service with new date [Web] (6381290a)
|
|
29
27
|
|
|
30
28
|
## 7.5.25 (2026-03-09)
|
|
31
29
|
|
package/README.md
CHANGED
package/agent/lib/config.js
CHANGED
|
@@ -16,12 +16,14 @@ function parseValue(value) {
|
|
|
16
16
|
return value;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
const channelConfig = require("../../channel.json");
|
|
20
|
+
|
|
19
21
|
// Factory function that creates a config instance
|
|
20
22
|
const createConfig = (environment = {}) => {
|
|
21
23
|
// Start with defaults
|
|
22
24
|
const config = {
|
|
23
25
|
TD_ANALYTICS: true,
|
|
24
|
-
TD_API_ROOT:
|
|
26
|
+
TD_API_ROOT: channelConfig.channels[channelConfig.active],
|
|
25
27
|
TD_API_KEY: null,
|
|
26
28
|
TD_PROFILE: false,
|
|
27
29
|
TD_RESOLUTION: [1366, 768],
|
package/agent/lib/sandbox.js
CHANGED
|
@@ -915,10 +915,12 @@ const createSandbox = function (emitter, analytics, sessionInstance) {
|
|
|
915
915
|
}
|
|
916
916
|
|
|
917
917
|
try {
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
918
|
+
await Promise.allSettled([
|
|
919
|
+
this._cmdChannel?.detach(),
|
|
920
|
+
this._respChannel?.detach(),
|
|
921
|
+
this._ctrlChannel?.detach(),
|
|
922
|
+
this._filesChannel?.detach(),
|
|
923
|
+
].filter(Boolean));
|
|
922
924
|
} catch (e) {
|
|
923
925
|
/* ignore */
|
|
924
926
|
}
|
package/ai/agents/testdriver.md
CHANGED
|
@@ -578,9 +578,6 @@ await testdriver.pressKeys(["pagedown"]);
|
|
|
578
578
|
### Executing Code in Sandbox
|
|
579
579
|
|
|
580
580
|
```javascript
|
|
581
|
-
// JavaScript
|
|
582
|
-
const result = await testdriver.exec("js", "return document.title", 5000);
|
|
583
|
-
|
|
584
581
|
// Shell (Linux)
|
|
585
582
|
const output = await testdriver.exec("sh", "ls -la", 5000);
|
|
586
583
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: testdriver:exec
|
|
3
|
-
description: Execute
|
|
3
|
+
description: Execute shell or PowerShell commands in the sandbox
|
|
4
4
|
---
|
|
5
5
|
<!-- Generated from exec.mdx. DO NOT EDIT. -->
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
9
|
-
Execute
|
|
9
|
+
Execute shell commands (Linux) or PowerShell commands (Windows) in the sandbox environment.
|
|
10
10
|
|
|
11
11
|
## Syntax
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ await testdriver.exec(language, code, timeout, silent)
|
|
|
17
17
|
## Parameters
|
|
18
18
|
|
|
19
19
|
<ParamField path="language" type="string" required>
|
|
20
|
-
Language to execute: `'
|
|
20
|
+
Language to execute: `'sh'` (Shell/Linux) or `'pwsh'` (PowerShell/Windows)
|
|
21
21
|
</ParamField>
|
|
22
22
|
|
|
23
23
|
<ParamField path="code" type="string" required>
|
|
@@ -36,57 +36,40 @@ await testdriver.exec(language, code, timeout, silent)
|
|
|
36
36
|
|
|
37
37
|
`Promise<string>` - Command output
|
|
38
38
|
|
|
39
|
-
##
|
|
39
|
+
## Shell Execution (Linux)
|
|
40
40
|
|
|
41
|
-
Execute
|
|
41
|
+
Execute shell commands in the Linux sandbox.
|
|
42
42
|
|
|
43
|
-
###
|
|
43
|
+
### Basic Commands
|
|
44
44
|
|
|
45
45
|
```javascript
|
|
46
|
-
//
|
|
47
|
-
await testdriver.exec('
|
|
48
|
-
document.querySelector('#submit-button').click();
|
|
49
|
-
`, 5000);
|
|
46
|
+
// List files
|
|
47
|
+
const files = await testdriver.exec('sh', 'ls -la', 5000);
|
|
50
48
|
|
|
51
|
-
//
|
|
52
|
-
await testdriver.exec('
|
|
53
|
-
document.querySelector('#username').value = 'testuser';
|
|
54
|
-
document.querySelector('#password').value = 'password123';
|
|
55
|
-
document.querySelector('#login-form').submit();
|
|
56
|
-
`, 5000);
|
|
49
|
+
// Check current directory
|
|
50
|
+
const pwd = await testdriver.exec('sh', 'pwd', 5000);
|
|
57
51
|
|
|
58
|
-
//
|
|
59
|
-
await testdriver.exec('
|
|
60
|
-
document.querySelector('#footer').scrollIntoView();
|
|
61
|
-
`, 5000);
|
|
52
|
+
// Run a script
|
|
53
|
+
await testdriver.exec('sh', './setup.sh', 60000);
|
|
62
54
|
```
|
|
63
55
|
|
|
64
|
-
###
|
|
56
|
+
### File Operations
|
|
65
57
|
|
|
66
58
|
```javascript
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
console.log('Page title:', title);
|
|
70
|
-
|
|
71
|
-
// Get all links
|
|
72
|
-
const links = await testdriver.exec('js', `
|
|
73
|
-
Array.from(document.querySelectorAll('a'))
|
|
74
|
-
.map(a => a.href)
|
|
75
|
-
.join('\\n')
|
|
76
|
-
`, 5000);
|
|
59
|
+
// Create a file
|
|
60
|
+
await testdriver.exec('sh', 'echo "Hello World" > test.txt', 5000);
|
|
77
61
|
|
|
78
|
-
//
|
|
79
|
-
const
|
|
80
|
-
document.querySelector('.error-message') !== null
|
|
81
|
-
`, 5000);
|
|
62
|
+
// Read a file
|
|
63
|
+
const content = await testdriver.exec('sh', 'cat test.txt', 5000);
|
|
82
64
|
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
65
|
+
// Copy files
|
|
66
|
+
await testdriver.exec('sh', 'cp source.txt dest.txt', 5000);
|
|
67
|
+
|
|
68
|
+
// Delete files
|
|
69
|
+
await testdriver.exec('sh', 'rm test.txt', 5000);
|
|
87
70
|
```
|
|
88
71
|
|
|
89
|
-
## PowerShell Execution
|
|
72
|
+
## PowerShell Execution (Windows)
|
|
90
73
|
|
|
91
74
|
Execute PowerShell commands in the Windows sandbox.
|
|
92
75
|
|
|
@@ -399,9 +399,6 @@ await testdriver.scrollUntilImage("Product image at bottom");
|
|
|
399
399
|
### Executing Code in Sandbox
|
|
400
400
|
|
|
401
401
|
```javascript
|
|
402
|
-
// JavaScript
|
|
403
|
-
const result = await testdriver.exec("js", "return document.title", 5000);
|
|
404
|
-
|
|
405
402
|
// Shell (Linux)
|
|
406
403
|
const output = await testdriver.exec("sh", "ls -la", 5000);
|
|
407
404
|
|
|
@@ -568,9 +568,6 @@ await testdriver.pressKeys(["pagedown"]);
|
|
|
568
568
|
### Executing Code in Sandbox
|
|
569
569
|
|
|
570
570
|
```javascript
|
|
571
|
-
// JavaScript
|
|
572
|
-
const result = await testdriver.exec("js", "return document.title", 5000);
|
|
573
|
-
|
|
574
571
|
// Shell (Linux)
|
|
575
572
|
const output = await testdriver.exec("sh", "ls -la", 5000);
|
|
576
573
|
|
package/channel.json
ADDED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "exec"
|
|
3
3
|
sidebarTitle: "exec"
|
|
4
|
-
description: "Execute custom shell or
|
|
4
|
+
description: "Execute custom shell or PowerShell scripts within your tests."
|
|
5
5
|
icon: "code"
|
|
6
6
|
mode: "wide"
|
|
7
7
|
---
|
|
@@ -14,49 +14,43 @@ import Example from "/snippets/tests/exec-shell-yaml.mdx";
|
|
|
14
14
|
|
|
15
15
|
## Description
|
|
16
16
|
|
|
17
|
-
The `exec` command allows you to execute
|
|
17
|
+
The `exec` command allows you to execute shell commands (Linux) or PowerShell commands (Windows) within your TestDriver tests. This is useful for launching applications, file operations, or performing system commands during a test.
|
|
18
18
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
| Argument | Type | Description |
|
|
22
22
|
| :------: | :------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
-
| `lang` | `string` | The language of the script to execute. Supported values are `
|
|
23
|
+
| `lang` | `string` | The language of the script to execute. Supported values are `sh` (Shell/Linux) or `pwsh` (PowerShell/Windows). |
|
|
24
24
|
| `output` | `string` | The variable name to store the result of the script. This variable can be accessed as `${OUTPUT.<var>}` in future steps. |
|
|
25
|
-
| `code` | `string` | The script to execute
|
|
25
|
+
| `code` | `string` | The script to execute. |
|
|
26
26
|
| `silent` | `string` | Defaults to `false`. The command will print the output of the script. This is useful for suppressing unnecessary or private output in the test logs and it's useful for debugging. |
|
|
27
27
|
|
|
28
28
|
## Example usage
|
|
29
29
|
|
|
30
|
-
This example demonstrates how to use the `exec` command to
|
|
30
|
+
This example demonstrates how to use the `exec` command to launch a calculator application.
|
|
31
31
|
|
|
32
|
-
```yaml
|
|
32
|
+
```yaml calculator.yaml
|
|
33
33
|
version: 6.0.0
|
|
34
34
|
steps:
|
|
35
35
|
- commands:
|
|
36
36
|
- command: exec
|
|
37
37
|
lang: pwsh
|
|
38
38
|
code: |
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const { TOTP } = require("totp-generator");
|
|
45
|
-
let otp = TOTP.generate("JBSWY3DPEB3W64TMMQQQ").otp;
|
|
46
|
-
console.log(otp);
|
|
47
|
-
result = otp;
|
|
48
|
-
- command: type
|
|
49
|
-
text: ${OUTPUT.totp}
|
|
39
|
+
start /B calc.exe
|
|
40
|
+
timeout /t 5
|
|
41
|
+
- command: wait-for-text
|
|
42
|
+
text: "calculator"
|
|
43
|
+
timeout: 30000
|
|
50
44
|
```
|
|
51
45
|
|
|
52
46
|
## Additional details
|
|
53
47
|
|
|
54
|
-
- Supported `lang` values are `
|
|
55
|
-
- `
|
|
56
|
-
- `pwsh` code is executed in
|
|
48
|
+
- Supported `lang` values are `sh` or `pwsh`:
|
|
49
|
+
- `sh` code is executed in the shell on Linux sandboxes.
|
|
50
|
+
- `pwsh` code is executed in PowerShell on Windows sandboxes.
|
|
57
51
|
- **Note:** You can also use `pwsh` in [lifecycle](/guide/lifecycle) scripts to install npm packages if you need them.
|
|
58
52
|
- Otherwise, the `pwsh` code can be used within test steps to launch applications or perform simple commands (like writing text to a file on the machine to perform a simple file upload).
|
|
59
|
-
- The `output`argument
|
|
53
|
+
- The `output` argument captures stdout from your script.
|
|
60
54
|
|
|
61
55
|
## Protips
|
|
62
56
|
|
|
@@ -372,20 +372,11 @@ await testdriver.scrollUntilText('Footer', 'down', 5000);
|
|
|
372
372
|
|
|
373
373
|
### exec(language, code, timeout, silent) - Execute Code
|
|
374
374
|
|
|
375
|
-
Execute
|
|
375
|
+
Execute shell or PowerShell in the sandbox.
|
|
376
376
|
|
|
377
377
|
```javascript
|
|
378
|
-
//
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
await testdriver.exec('js', `
|
|
382
|
-
document.querySelector('#username').value = 'testuser';
|
|
383
|
-
`, 5000);
|
|
384
|
-
|
|
385
|
-
// Get element text
|
|
386
|
-
const text = await testdriver.exec('js', `
|
|
387
|
-
document.querySelector('.notification').textContent
|
|
388
|
-
`, 5000);
|
|
378
|
+
// Shell execution (Linux sandbox)
|
|
379
|
+
const output = await testdriver.exec('sh', 'ls -la', 5000);
|
|
389
380
|
|
|
390
381
|
// PowerShell execution (Windows sandbox)
|
|
391
382
|
await testdriver.exec('pwsh', 'npm install -g http-server', 30000);
|
|
@@ -843,7 +834,7 @@ Using explicit sandboxes provides:
|
|
|
843
834
|
| `assert(text)` | Verify state | `await testdriver.assert('button is visible')` |
|
|
844
835
|
| `pressKeys(keys)` | Keyboard shortcuts | `await testdriver.pressKeys(['ctrl', 'c'])` |
|
|
845
836
|
| `scroll(dir, amt)` | Scroll page | `await testdriver.scroll('down', 500)` |
|
|
846
|
-
| `exec(lang, code)` | Execute code | `await testdriver.exec('
|
|
837
|
+
| `exec(lang, code)` | Execute code | `await testdriver.exec('sh', 'ls -la', 5000)` |
|
|
847
838
|
| `connect(opts)` | Connect to sandbox | `await testdriver.connect({ sandboxId: 'i-123' })` |
|
|
848
839
|
| `disconnect()` | Close connection | `await testdriver.disconnect()` |
|
|
849
840
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "exec"
|
|
3
3
|
sidebarTitle: "exec"
|
|
4
|
-
description: "Execute custom shell or
|
|
4
|
+
description: "Execute custom shell or PowerShell scripts within your tests."
|
|
5
5
|
icon: "code"
|
|
6
6
|
mode: "wide"
|
|
7
7
|
---
|
|
@@ -14,49 +14,43 @@ import Example from "/snippets/tests/exec-shell-yaml.mdx";
|
|
|
14
14
|
|
|
15
15
|
## Description
|
|
16
16
|
|
|
17
|
-
The `exec` command allows you to execute
|
|
17
|
+
The `exec` command allows you to execute shell commands (Linux) or PowerShell commands (Windows) within your TestDriver tests. This is useful for launching applications, file operations, or performing system commands during a test.
|
|
18
18
|
|
|
19
19
|
## Arguments
|
|
20
20
|
|
|
21
21
|
| Argument | Type | Description |
|
|
22
22
|
| :------: | :------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
-
| `lang` | `string` | The language of the script to execute. Supported values are `
|
|
23
|
+
| `lang` | `string` | The language of the script to execute. Supported values are `sh` (Shell/Linux) or `pwsh` (PowerShell/Windows). |
|
|
24
24
|
| `output` | `string` | The variable name to store the result of the script. This variable can be accessed as `${OUTPUT.<var>}` in future steps. |
|
|
25
|
-
| `code` | `string` | The script to execute
|
|
25
|
+
| `code` | `string` | The script to execute. |
|
|
26
26
|
| `silent` | `string` | Defaults to `false`. The command will print the output of the script. This is useful for suppressing unnecessary or private output in the test logs and it's useful for debugging. |
|
|
27
27
|
|
|
28
28
|
## Example usage
|
|
29
29
|
|
|
30
|
-
This example demonstrates how to use the `exec` command to
|
|
30
|
+
This example demonstrates how to use the `exec` command to launch a calculator application.
|
|
31
31
|
|
|
32
|
-
```yaml
|
|
32
|
+
```yaml calculator.yaml
|
|
33
33
|
version: 6.0.0
|
|
34
34
|
steps:
|
|
35
35
|
- commands:
|
|
36
36
|
- command: exec
|
|
37
37
|
lang: pwsh
|
|
38
38
|
code: |
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const { TOTP } = require("totp-generator");
|
|
45
|
-
let otp = TOTP.generate("JBSWY3DPEB3W64TMMQQQ").otp;
|
|
46
|
-
console.log(otp);
|
|
47
|
-
result = otp;
|
|
48
|
-
- command: type
|
|
49
|
-
text: ${OUTPUT.totp}
|
|
39
|
+
start /B calc.exe
|
|
40
|
+
timeout /t 5
|
|
41
|
+
- command: wait-for-text
|
|
42
|
+
text: "calculator"
|
|
43
|
+
timeout: 30000
|
|
50
44
|
```
|
|
51
45
|
|
|
52
46
|
## Additional details
|
|
53
47
|
|
|
54
|
-
- Supported `lang` values are `
|
|
55
|
-
- `
|
|
56
|
-
- `pwsh` code is executed in
|
|
48
|
+
- Supported `lang` values are `sh` or `pwsh`:
|
|
49
|
+
- `sh` code is executed in the shell on Linux sandboxes.
|
|
50
|
+
- `pwsh` code is executed in PowerShell on Windows sandboxes.
|
|
57
51
|
- **Note:** You can also use `pwsh` in [lifecycle](/guide/lifecycle) scripts to install npm packages if you need them.
|
|
58
52
|
- Otherwise, the `pwsh` code can be used within test steps to launch applications or perform simple commands (like writing text to a file on the machine to perform a simple file upload).
|
|
59
|
-
- The `output`argument
|
|
53
|
+
- The `output` argument captures stdout from your script.
|
|
60
54
|
|
|
61
55
|
## Protips
|
|
62
56
|
|
package/docs/v7/exec.mdx
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "exec()"
|
|
3
3
|
sidebarTitle: "exec"
|
|
4
|
-
description: "Execute
|
|
4
|
+
description: "Execute shell or PowerShell commands in the sandbox"
|
|
5
5
|
icon: "terminal"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
Execute
|
|
10
|
+
Execute shell commands (Linux) or PowerShell commands (Windows) in the sandbox environment.
|
|
11
11
|
|
|
12
12
|
## Syntax
|
|
13
13
|
|
|
@@ -18,7 +18,7 @@ await testdriver.exec(language, code, timeout, silent)
|
|
|
18
18
|
## Parameters
|
|
19
19
|
|
|
20
20
|
<ParamField path="language" type="string" required>
|
|
21
|
-
Language to execute: `'
|
|
21
|
+
Language to execute: `'sh'` (Shell/Linux) or `'pwsh'` (PowerShell/Windows)
|
|
22
22
|
</ParamField>
|
|
23
23
|
|
|
24
24
|
<ParamField path="code" type="string" required>
|
|
@@ -37,57 +37,40 @@ await testdriver.exec(language, code, timeout, silent)
|
|
|
37
37
|
|
|
38
38
|
`Promise<string>` - Command output
|
|
39
39
|
|
|
40
|
-
##
|
|
40
|
+
## Shell Execution (Linux)
|
|
41
41
|
|
|
42
|
-
Execute
|
|
42
|
+
Execute shell commands in the Linux sandbox.
|
|
43
43
|
|
|
44
|
-
###
|
|
44
|
+
### Basic Commands
|
|
45
45
|
|
|
46
46
|
```javascript
|
|
47
|
-
//
|
|
48
|
-
await testdriver.exec('
|
|
49
|
-
document.querySelector('#submit-button').click();
|
|
50
|
-
`, 5000);
|
|
47
|
+
// List files
|
|
48
|
+
const files = await testdriver.exec('sh', 'ls -la', 5000);
|
|
51
49
|
|
|
52
|
-
//
|
|
53
|
-
await testdriver.exec('
|
|
54
|
-
document.querySelector('#username').value = 'testuser';
|
|
55
|
-
document.querySelector('#password').value = 'password123';
|
|
56
|
-
document.querySelector('#login-form').submit();
|
|
57
|
-
`, 5000);
|
|
50
|
+
// Check current directory
|
|
51
|
+
const pwd = await testdriver.exec('sh', 'pwd', 5000);
|
|
58
52
|
|
|
59
|
-
//
|
|
60
|
-
await testdriver.exec('
|
|
61
|
-
document.querySelector('#footer').scrollIntoView();
|
|
62
|
-
`, 5000);
|
|
53
|
+
// Run a script
|
|
54
|
+
await testdriver.exec('sh', './setup.sh', 60000);
|
|
63
55
|
```
|
|
64
56
|
|
|
65
|
-
###
|
|
57
|
+
### File Operations
|
|
66
58
|
|
|
67
59
|
```javascript
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
console.log('Page title:', title);
|
|
71
|
-
|
|
72
|
-
// Get all links
|
|
73
|
-
const links = await testdriver.exec('js', `
|
|
74
|
-
Array.from(document.querySelectorAll('a'))
|
|
75
|
-
.map(a => a.href)
|
|
76
|
-
.join('\\n')
|
|
77
|
-
`, 5000);
|
|
60
|
+
// Create a file
|
|
61
|
+
await testdriver.exec('sh', 'echo "Hello World" > test.txt', 5000);
|
|
78
62
|
|
|
79
|
-
//
|
|
80
|
-
const
|
|
81
|
-
document.querySelector('.error-message') !== null
|
|
82
|
-
`, 5000);
|
|
63
|
+
// Read a file
|
|
64
|
+
const content = await testdriver.exec('sh', 'cat test.txt', 5000);
|
|
83
65
|
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
66
|
+
// Copy files
|
|
67
|
+
await testdriver.exec('sh', 'cp source.txt dest.txt', 5000);
|
|
68
|
+
|
|
69
|
+
// Delete files
|
|
70
|
+
await testdriver.exec('sh', 'rm test.txt', 5000);
|
|
88
71
|
```
|
|
89
72
|
|
|
90
|
-
## PowerShell Execution
|
|
73
|
+
## PowerShell Execution (Windows)
|
|
91
74
|
|
|
92
75
|
Execute PowerShell commands in the Windows sandbox.
|
|
93
76
|
|
|
@@ -216,7 +199,7 @@ await testdriver.exec('pwsh', '.\\setup.ps1', 60000, true);
|
|
|
216
199
|
|
|
217
200
|
```javascript
|
|
218
201
|
// Quick operations: 5000ms
|
|
219
|
-
await testdriver.exec('
|
|
202
|
+
await testdriver.exec('sh', 'ls -la', 5000);
|
|
220
203
|
|
|
221
204
|
// Installations: 30000-60000ms
|
|
222
205
|
await testdriver.exec('pwsh', 'npm install -g package', 30000);
|
|
@@ -289,27 +272,20 @@ describe('Code Execution', () => {
|
|
|
289
272
|
await testdriver.disconnect();
|
|
290
273
|
});
|
|
291
274
|
|
|
292
|
-
it('should execute
|
|
293
|
-
|
|
275
|
+
it('should execute shell commands on Linux', async () => {
|
|
276
|
+
// List directory
|
|
277
|
+
const files = await testdriver.exec('sh', 'ls -la', 5000);
|
|
278
|
+
console.log('Files:', files);
|
|
294
279
|
|
|
295
|
-
//
|
|
296
|
-
|
|
297
|
-
console.log('Page title:', title);
|
|
280
|
+
// Create a file
|
|
281
|
+
await testdriver.exec('sh', 'echo "Hello World" > test.txt', 5000);
|
|
298
282
|
|
|
299
|
-
//
|
|
300
|
-
await testdriver.exec('
|
|
301
|
-
|
|
302
|
-
`, 5000);
|
|
303
|
-
|
|
304
|
-
// Verify
|
|
305
|
-
const value = await testdriver.exec('js', `
|
|
306
|
-
document.querySelector('#username').value
|
|
307
|
-
`, 5000);
|
|
308
|
-
|
|
309
|
-
expect(value).toBe('testuser');
|
|
283
|
+
// Read the file
|
|
284
|
+
const content = await testdriver.exec('sh', 'cat test.txt', 5000);
|
|
285
|
+
expect(content).toContain('Hello World');
|
|
310
286
|
});
|
|
311
287
|
|
|
312
|
-
it('should install and use tools', async () => {
|
|
288
|
+
it('should install and use tools on Windows', async () => {
|
|
313
289
|
// Install tool
|
|
314
290
|
await testdriver.exec('pwsh', 'npm install -g http-server', 30000, true);
|
|
315
291
|
|
|
@@ -331,10 +307,6 @@ describe('Code Execution', () => {
|
|
|
331
307
|
`, 5000);
|
|
332
308
|
|
|
333
309
|
await testdriver.focusApplication('Google Chrome');
|
|
334
|
-
|
|
335
|
-
// Verify page loaded
|
|
336
|
-
const content = await testdriver.exec('js', 'document.body.textContent', 5000);
|
|
337
|
-
expect(content).toContain('Test Page');
|
|
338
310
|
});
|
|
339
311
|
});
|
|
340
312
|
```
|
|
@@ -342,5 +314,5 @@ describe('Code Execution', () => {
|
|
|
342
314
|
## Related Methods
|
|
343
315
|
|
|
344
316
|
- [`focusApplication()`](/v7/focus-application) - Focus apps before exec
|
|
345
|
-
- [`find()`](/v7/find) - Locate elements
|
|
346
|
-
- [`type()`](/v7/type) - Type text
|
|
317
|
+
- [`find()`](/v7/find) - Locate elements visually
|
|
318
|
+
- [`type()`](/v7/type) - Type text into inputs
|
package/docs/v7/quickstart.mdx
CHANGED
|
@@ -23,7 +23,7 @@ TestDriver makes it easy to write automated computer-use tests for web browsers,
|
|
|
23
23
|
npx testdriverai init
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
This will walk you through creating a new project folder, installing dependencies,
|
|
26
|
+
This will walk you through creating a new project folder, installing dependencies, setting up your API key, and configuring MCP for your preferred AI assistant (VS Code, Cursor, Claude Desktop, etc.).
|
|
27
27
|
|
|
28
28
|
</Step>
|
|
29
29
|
|
|
@@ -12,7 +12,8 @@ const { execSync } = require("child_process");
|
|
|
12
12
|
require("dotenv").config();
|
|
13
13
|
|
|
14
14
|
// API configuration
|
|
15
|
-
const
|
|
15
|
+
const channelConfig = require("../../../../channel.json");
|
|
16
|
+
const API_BASE_URL = process.env.TD_API_ROOT || channelConfig.channels[channelConfig.active];
|
|
16
17
|
const POLL_INTERVAL = 5000; // 5 seconds
|
|
17
18
|
const POLL_TIMEOUT = 900000; // 15 minutes
|
|
18
19
|
|