testdriverai 6.0.16-canary.a5849eb.0 → 6.0.16-canary.ea858d7.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/agent/index.js CHANGED
@@ -192,7 +192,7 @@ class TestDriverAgent extends EventEmitter2 {
192
192
 
193
193
  // fatal errors always exit the program
194
194
  // this ensure we log the error, summarize it, and exit cleanly
195
- async dieOnFatal(error) {
195
+ async dieOnFatal(error, skipPostrun = false) {
196
196
  // Show error with source context if available
197
197
  const errorContext = this.sourceMapper.getErrorWithSourceContext(error);
198
198
  if (errorContext) {
@@ -204,9 +204,13 @@ class TestDriverAgent extends EventEmitter2 {
204
204
  );
205
205
  }
206
206
 
207
- await this.summarize(error.message);
208
- // Always run postrun lifecycle script, even for fatal errors
209
- return await this.exit(true, false, true);
207
+ if (skipPostrun) {
208
+ this.exit(true);
209
+ } else {
210
+ await this.summarize(error.message);
211
+ // Always run postrun lifecycle script, even for fatal errors
212
+ return await this.exit(true, false, true);
213
+ }
210
214
  }
211
215
 
212
216
  // creates a new "thread" in which the AI is given an error
@@ -447,13 +451,14 @@ class TestDriverAgent extends EventEmitter2 {
447
451
  sourcePosition: sourcePosition,
448
452
  });
449
453
 
450
- return await this.haveAIResolveError(
454
+ await this.haveAIResolveError(
451
455
  error,
452
456
  yaml.dump({ commands: [yml] }),
453
457
  depth,
454
458
  true,
455
459
  shouldSave,
456
460
  );
461
+ throw error;
457
462
  }
458
463
  }
459
464
 
@@ -1583,9 +1588,12 @@ ${regression}
1583
1588
  this.emitter.emit(events.log.log, `This is beta software!`);
1584
1589
  this.emitter.emit(
1585
1590
  events.log.log,
1586
- theme.yellow(`Join our Forums for help`),
1591
+ theme.yellow(`Join our Discord for help`),
1592
+ );
1593
+ this.emitter.emit(
1594
+ events.log.log,
1595
+ `https://discord.com/invite/cWDFW8DzPm`,
1587
1596
  );
1588
- this.emitter.emit(events.log.log, `https://forums.testdriver.ai`);
1589
1597
 
1590
1598
  // make testdriver directory if it doesn't exist
1591
1599
  let testdriverFolder = path.join(this.workingDir);
@@ -1692,9 +1700,26 @@ ${regression}
1692
1700
  events.log.log,
1693
1701
  theme.gray(`- establishing connection...`),
1694
1702
  );
1695
- await this.sandbox.boot(this.config.TD_API_ROOT);
1703
+ let ableToBoot = await this.sandbox.boot(this.config.TD_API_ROOT);
1704
+
1705
+ if (!ableToBoot) {
1706
+ return await this.dieOnFatal(
1707
+ `Unable to connect to TestDriver sandbox service at ${this.config.TD_API_ROOT}.
1708
+ Please check your network connection, TD_API_KEY, or the service status.`,
1709
+ true,
1710
+ );
1711
+ }
1712
+
1696
1713
  this.emitter.emit(events.log.log, theme.gray(`- authenticating...`));
1697
- await this.sandbox.auth(this.config.TD_API_KEY);
1714
+ let ableToAuth = await this.sandbox.auth(this.config.TD_API_KEY);
1715
+
1716
+ if (!ableToAuth) {
1717
+ return await this.dieOnFatal(
1718
+ `Unable to authorize with TestDriver sandbox service at ${this.config.TD_API_ROOT}.
1719
+ Please check your network connection, TD_API_KEY, or the service status.`,
1720
+ true,
1721
+ );
1722
+ }
1698
1723
  }
1699
1724
 
1700
1725
  async connectToSandboxDirect(sandboxId, persist = false) {
@@ -84,10 +84,6 @@ const createSandbox = (emitter, analytics) => {
84
84
  this.socket.on("close", () => {
85
85
  clearInterval(this.heartbeat);
86
86
  // Emit a clear error event for API key issues
87
- emitter.emit(events.error.fatal, {
88
- message: "Socket closed. Check your API KEY (TD_API_KEY)",
89
- code: "API_KEY_MISSING_OR_INVALID",
90
- });
91
87
  reject();
92
88
  this.apiSocketConnected = false;
93
89
  });
@@ -23,9 +23,9 @@ Parallel testing allows you to split your test actions into multiple files and r
23
23
  - Use a test matrix strategy to execute these files in parallel.
24
24
 
25
25
  <Warning>
26
- The `run` command is used in your test files to run other test files. This is
27
- useful for breaking down large tests into smaller, more manageable pieces. To
28
- run multiple separate tests, use a test matrix strategy.
26
+ The [`run`](/commands/run) command is used in your test files to run other
27
+ test files. This is useful for breaking down large tests into smaller, more
28
+ manageable pieces. To run multiple separate tests, use a test matrix strategy.
29
29
  </Warning>
30
30
 
31
31
  Example:
@@ -43,12 +43,12 @@ strategy:
43
43
 
44
44
  ### 2. Use optimized matching methods
45
45
 
46
- For actions like `hover-text`, `wait-for-text`, and `scroll-until-text`, use the `turbo` matching method instead of `ai`. The `turbo` method uses text similarity to quickly compute the most relevant match, making it about 40% faster than the `ai` method.
46
+ For actions like [`hover-text`](/commands/hover-text), [`wait-for-text`](/commands/wait-for-text), and [`scroll-until-text`](/commands/scroll-until-text), use the `turbo` matching method instead of `ai`. The `turbo` method uses text similarity to quickly compute the most relevant match, making it about 40% faster than the `ai` method.
47
47
 
48
48
  #### Example
49
49
 
50
50
  ```yaml
51
- command: hover-text
51
+ command: [`hover-text`](/commands/hover-text)
52
52
  text: Sign In
53
53
  description: login button
54
54
  action: click
@@ -59,12 +59,12 @@ method: turbo
59
59
 
60
60
  ### 3. Use `async` asserts
61
61
 
62
- The `assert` command supports the `async: true` property, allowing you to create non-blocking assertions. This means your tests can continue running while the assertion is being validated, saving valuable time.
62
+ The [`assert`](/commands/assert) command supports the `async: true` property, allowing you to create non-blocking assertions. This means your tests can continue running while the assertion is being validated, saving valuable time.
63
63
 
64
64
  #### Example
65
65
 
66
66
  ```yaml
67
- command: assert
67
+ command: [`assert`](/commands/assert)
68
68
  expect: The user is logged in
69
69
  async: true
70
70
  ```
package/docs/docs.json CHANGED
@@ -220,8 +220,8 @@
220
220
  "href": "https://github.com/testdriverai/testdriverai"
221
221
  },
222
222
  {
223
- "label": "Forums",
224
- "href": "https://forums.testdriver.ai"
223
+ "label": "Discord",
224
+ "href": "https://discord.com/invite/cWDFW8DzPm"
225
225
  },
226
226
  {
227
227
  "label": "Report an Issue",
@@ -13,6 +13,7 @@ When executing the `hover-image` and `hover-text` command, TestDriver may use th
13
13
 
14
14
  TestDriver may not accurately locate matches in certain cases. This can lead to unexpected behavior when using the `hover-image` or `hover-text` command. For example, if you specify a description that's too generic or similar to other images on the screen, TestDriver may not be able to identify the correct image to interact with. To improve accuracy, use specific and unique descriptions for images and text.
15
15
  When executing the `hover-image` and `hover-text` commands, TestDriver uses the provided description to identify the target image or text. If the description is too generic or matches multiple elements on the screen, TestDriver may not be able to determine which one to interact with, leading to unexpected behavior. To improve accuracy, always use specific and unique descriptions for both images and text.
16
+
16
17
  ### Avoid using `hover-text` for single characters (ex: `1`, `>`, `|`)
17
18
 
18
19
  To improve accuracy of our model, we do not include single characters or symbols in the matching data. This means that `hover-text` may not work as expected for these cases. If you need to interact with single characters or symbols, consider using the `match-image` command with a screenshot of the target element instead.
@@ -29,14 +30,14 @@ Assertions use the current state of the page to determine if the step passes or
29
30
 
30
31
  ## Reporting issues
31
32
 
32
- If you encounter any issues while using TestDriver, please report them to us. You can do this by creating a new issue in the [Feedback Forum](https://forums.testdriver.ai/c/feedback/10). We appreciate your feedback and will work to resolve any problems as quickly as possible.
33
+ If you encounter any issues while using TestDriver, please report them to us. You can do this by creating a new issue in the [discord](https://discord.com/invite/cWDFW8DzPm). We appreciate your feedback and will work to resolve any problems as quickly as possible.
33
34
 
34
35
  <Card
35
36
  title="Report an Issue"
36
37
  icon="arrow-turn-down-right"
37
38
  iconType="duotone"
38
39
  horizontal
39
- href="https://forums.testdriver.ai/c/feedback/10"
40
+ href="https://discord.com/invite/cWDFW8DzPm"
40
41
  >
41
42
  We'd love to hear from you!
42
43
  </Card>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "6.0.16-canary.a5849eb.0",
3
+ "version": "6.0.16-canary.ea858d7.0",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -22,16 +22,33 @@ steps:
22
22
 
23
23
  # Define paths
24
24
  $extensionPath = Join-Path (Get-Location) "node_modules/dashcam-chrome/build"
25
- $profilePath = Join-Path $env:TEMP "chrome-profile-$(Get-Random)"
25
+ $profilePath = Join-Path $env:TEMP "chrome-profile-$(Get-Random)"
26
+ $defaultDir = Join-Path $profilePath "Default"
27
+ $prefsPath = Join-Path $defaultDir "Preferences"
26
28
 
27
29
  Write-Host "Extension path: $extensionPath"
28
30
  Write-Host "Chrome user data dir: $profilePath"
29
31
 
30
- # Validate extension path
31
- if (-not (Test-Path $extensionPath)) {
32
- Write-Host "Extension not found at $extensionPath"
33
- }
32
+ # Create a clean profile + Preferences to disable password manager & autofill
33
+ Remove-Item $profilePath -Recurse -Force -ErrorAction SilentlyContinue
34
+ New-Item $defaultDir -ItemType Directory -Force | Out-Null
34
35
 
36
+ $prefs = @{
37
+ "credentials_enable_service" = $false
38
+ "profile" = @{
39
+ "password_manager_enabled" = $false
40
+ }
41
+ "autofill" = @{
42
+ "profile_enabled" = $false
43
+ "address_enabled" = $false
44
+ "credit_card_enabled" = $false
45
+ }
46
+ } | ConvertTo-Json -Depth 6
47
+
48
+ # Write Preferences before Chrome starts (ASCII/UTF8 is fine)
49
+ $prefs | Set-Content -Path $prefsPath -Encoding ASCII
50
+
51
+ # Build args
35
52
  $chromeArgs = @(
36
53
  "--start-maximized",
37
54
  "--load-extension=$extensionPath",
@@ -43,9 +60,6 @@ steps:
43
60
  ) -join ' '
44
61
 
45
62
  Start-Process "cmd.exe" -ArgumentList "/c", "npx @puppeteer/browsers launch chrome -- $chromeArgs"
46
-
47
- Write-Host "Script complete."
48
- exit
49
63
  - command: wait-for-text
50
64
  text: ${TD_WEBSITE}
51
65
  timeout: 60000
package/curl.sh DELETED
@@ -1,13 +0,0 @@
1
- curl -X POST "https://forums.testdriver.ai/users" \
2
- -H "Content-Type: application/json" \
3
- -H "Api-Key: YOUR_ADMIN_API_KEY" \
4
- -H "Api-Username: admin" \
5
- -d '{
6
- "name": "Jane Doe",
7
- "email": "jane.doe@example.com",
8
- "username": "janedoe",
9
- "active": false,
10
- "approved": true,
11
- "email_verified": false,
12
- "staged": false
13
- }'
package/debug-ast.js DELETED
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const yamlAst = require("@stoplight/yaml-ast-parser");
4
- const yaml = require("js-yaml");
5
- const fs = require("fs");
6
-
7
- function debugAST() {
8
- const testFile =
9
- "/Users/ianjennings/Development/testdriverai/test-source-mapping.yaml";
10
- const yamlContent = fs.readFileSync(testFile, "utf-8");
11
-
12
- console.log("YAML Content:");
13
- console.log(yamlContent);
14
- console.log("\n" + "=".repeat(50) + "\n");
15
-
16
- const ast = yamlAst.load(yamlContent);
17
-
18
- console.log("AST Structure:");
19
- console.log(
20
- JSON.stringify(
21
- ast,
22
- (key, value) => {
23
- if (key === "parent") return "[parent]"; // Avoid circular reference
24
- return value;
25
- },
26
- 2,
27
- ),
28
- );
29
-
30
- console.log("\n" + "=".repeat(50) + "\n");
31
-
32
- // Test with js-yaml for comparison
33
- const yamlObj = yaml.load(yamlContent);
34
- console.log("js-yaml result:");
35
- console.log(JSON.stringify(yamlObj, null, 2));
36
- }
37
-
38
- debugAST();
@@ -1 +0,0 @@
1
- TD_API_KEY=
File without changes
@@ -1,46 +0,0 @@
1
- version: 6.0.0
2
- session: 67f00511acbd9ccac373edf7
3
- steps:
4
- - prompt: download arc browser
5
- commands:
6
- - command: exec
7
- lang: pwsh
8
- code: |
9
- # === Setup ===
10
- $chocoUrl = "https://www.chocolate-doom.org/downloads/3.0.1/chocolate-doom-3.0.1-win32.zip"
11
- $wadUrl = "https://archive.org/download/DOOMIWADFILE/DOOM.WAD"
12
- $basePath = "$env:USERPROFILE\choco-doom"
13
- $extractDir = "$basePath\choco-extracted"
14
- $wadFile = "$basePath\DOOM.WAD"
15
- $chocoExe = "$extractDir\chocolate-doom.exe"
16
- $zipPath = "$basePath\choco.zip"
17
-
18
- # === Ensure clean folders ===
19
- New-Item -ItemType Directory -Force -Path $basePath | Out-Null
20
- New-Item -ItemType Directory -Force -Path $extractDir | Out-Null
21
-
22
- # === Download Chocolate DOOM if missing ===
23
- if (-not (Test-Path $zipPath)) {
24
- Write-Host "Downloading Chocolate DOOM..."
25
- Invoke-WebRequest -Uri $chocoUrl -OutFile $zipPath
26
- }
27
-
28
- # === Extract if not already extracted ===
29
- if (-not (Test-Path $chocoExe)) {
30
- Write-Host "Extracting Chocolate DOOM..."
31
- Expand-Archive -LiteralPath $zipPath -DestinationPath $extractDir -Force
32
- }
33
-
34
- # === Download DOOM.WAD if missing ===
35
- if (-not (Test-Path $wadFile)) {
36
- Write-Host "Downloading DOOM.WAD..."
37
- Invoke-WebRequest -Uri $wadUrl -OutFile $wadFile
38
- }
39
-
40
- # === Set SDL variables for software rendering ===
41
- $env:SDL_VIDEODRIVER = "windows"
42
- $env:SDL_RENDER_DRIVER = "software"
43
-
44
- # === Launch DOOM ===
45
- Write-Host "Launching Chocolate DOOM with software rendering..."
46
- Start-Process -FilePath $chocoExe -ArgumentList "-iwad `"$wadFile`""
@@ -1 +0,0 @@
1
- Can launch doom, but can not interact with it (probably due to emulation).
@@ -1,3 +0,0 @@
1
- # TBD
2
-
3
- - Alex is working on this
File without changes
@@ -1,19 +0,0 @@
1
- version: 6.0.0
2
- session: 67f00511acbd9ccac373edf7
3
- steps:
4
- - prompt: download and run npm
5
- commands:
6
- - command: exec
7
- lang: pwsh
8
- code: |
9
- # Download and install Chocolatey:
10
- powershell -c "irm https://community.chocolatey.org/install.ps1|iex"
11
-
12
- # Download and install Node.js:
13
- choco install nodejs --version="22.17.1"
14
-
15
- # Verify the Node.js version:
16
- node -v # Should print "v22.17.1".
17
-
18
- # Verify npm version:
19
- npm -v # Should print "10.9.2".
@@ -1,40 +0,0 @@
1
- version: 6.0.0
2
- session: 67f00511acbd9ccac373edf7
3
- steps:
4
- - prompt: download and run npm
5
- commands:
6
- - command: exec
7
- lang: pwsh
8
- code: |
9
- # Set the output log file path
10
- $logFile = "$PSScriptRoot\SystemUsageLog.csv"
11
-
12
- # Write header if the log file does not exist
13
- if (!(Test-Path $logFile)) {
14
- "Timestamp,CPU_Usage_Percent,Memory_Used_MB,Memory_Total_MB,Memory_Usage_Percent" | Out-File $logFile
15
- }
16
-
17
- # Monitor loop
18
- while ($true) {
19
- $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
20
-
21
- # Get CPU usage
22
- $cpuUsage = Get-Counter '\Processor(_Total)\% Processor Time'
23
- $cpuValue = [math]::Round($cpuUsage.CounterSamples.CookedValue, 2)
24
-
25
- # Get memory usage
26
- $comp = Get-CimInstance Win32_OperatingSystem
27
- $totalMemory = [math]::Round($comp.TotalVisibleMemorySize / 1024, 2)
28
- $freeMemory = [math]::Round($comp.FreePhysicalMemory / 1024, 2)
29
- $usedMemory = [math]::Round($totalMemory - $freeMemory, 2)
30
- $memPercent = [math]::Round(($usedMemory / $totalMemory) * 100, 2)
31
-
32
- # Append log entry
33
- "$timestamp,$cpuValue,$usedMemory,$totalMemory,$memPercent" | Out-File -Append -Encoding utf8 $logFile
34
-
35
- # Output to screen (optional)
36
- Write-Host "$timestamp | CPU: $cpuValue% | RAM: $usedMemory / $totalMemory MB ($memPercent%)"
37
-
38
- # Wait before next poll
39
- Start-Sleep -Seconds 5
40
- }
@@ -1,40 +0,0 @@
1
- version: 6.0.0
2
- session: 67f00511acbd9ccac373edf7
3
- steps:
4
- - prompt: download and run npm
5
- commands:
6
- - command: exec
7
- lang: pwsh
8
- code: |
9
- # Set the output log file path
10
- $logFile = "$PSScriptRoot\SystemUsageLog.csv"
11
-
12
- # Write header if the log file does not exist
13
- if (!(Test-Path $logFile)) {
14
- "Timestamp,CPU_Usage_Percent,Memory_Used_MB,Memory_Total_MB,Memory_Usage_Percent" | Out-File $logFile
15
- }
16
-
17
- # Monitor loop
18
- while ($true) {
19
- $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
20
-
21
- # Get CPU usage
22
- $cpuUsage = Get-Counter '\Processor(_Total)\% Processor Time'
23
- $cpuValue = [math]::Round($cpuUsage.CounterSamples.CookedValue, 2)
24
-
25
- # Get memory usage
26
- $comp = Get-CimInstance Win32_OperatingSystem
27
- $totalMemory = [math]::Round($comp.TotalVisibleMemorySize / 1024, 2)
28
- $freeMemory = [math]::Round($comp.FreePhysicalMemory / 1024, 2)
29
- $usedMemory = [math]::Round($totalMemory - $freeMemory, 2)
30
- $memPercent = [math]::Round(($usedMemory / $totalMemory) * 100, 2)
31
-
32
- # Append log entry
33
- "$timestamp,$cpuValue,$usedMemory,$totalMemory,$memPercent" | Out-File -Append -Encoding utf8 $logFile
34
-
35
- # Output to screen (optional)
36
- Write-Host "$timestamp | CPU: $cpuValue% | RAM: $usedMemory / $totalMemory MB ($memPercent%)"
37
-
38
- # Wait before next poll
39
- Start-Sleep -Seconds 5
40
- }
@@ -1 +0,0 @@
1
- Needs `dashcam track` call
@@ -1,2 +0,0 @@
1
- steps:
2
- - prompt: interact with the webpage
@@ -1,28 +0,0 @@
1
- version: 6.0.0
2
- session: 67f00511acbd9ccac373edf7
3
- steps:
4
- - prompt: launch playwright test recorder
5
- commands:
6
- - command: exec
7
- lang: pwsh
8
- code: |
9
- powershell -c "irm https://community.chocolatey.org/install.ps1|iex"
10
-
11
- # Download and install Node.js:
12
- choco install nodejs --version="22.17.1"
13
-
14
- # Verify the Node.js version:
15
- node -v # Should print "v22.17.1".
16
-
17
- # Verify npm version:
18
- npm -v # Should print "10.9.2".
19
-
20
- echo "Step 3: Installing Playwright dependencies"
21
- npx playwright install --with-deps chromium
22
-
23
- echo "Step 4: Generating Playwright script"
24
- $process = Start-Process -FilePath "npx" -ArgumentList "playwright codegen --target playwright-test https://airbnb.com" -PassThru
25
- Write-Output "Started Playwright with PID: $($process.Id)"
26
-
27
- echo "Step 5: Completed"
28
- exit
@@ -1 +0,0 @@
1
- Worked in v5, `npx` may be failing