testdriverai 7.2.89 → 7.2.91

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/README.md CHANGED
@@ -56,7 +56,7 @@ expect(result).toBeTruthy();
56
56
  ### Step 2: Initialize Your Project
57
57
 
58
58
  ```bash
59
- npx testdriverai@beta init
59
+ npx testdriverai init
60
60
  ```
61
61
 
62
62
  This will:
package/agent/index.js CHANGED
@@ -214,6 +214,9 @@ class TestDriverAgent extends EventEmitter2 {
214
214
  // Ignore sandbox close errors during exit
215
215
  }
216
216
  }
217
+
218
+ // Clean up IDE session file
219
+ this.cleanupIdeSessionFile();
217
220
 
218
221
  shouldRunPostrun =
219
222
  !this.hasRunPostrun &&
@@ -2056,15 +2059,26 @@ ${regression}
2056
2059
  const path = require("path");
2057
2060
 
2058
2061
  const sessionDir = path.join(os.homedir(), ".testdriver");
2059
- const sessionFile = path.join(sessionDir, "ide-session.json");
2062
+ const sessionsDir = path.join(sessionDir, "ide-sessions");
2063
+
2064
+ // Generate a unique session ID based on test file and timestamp
2065
+ const testFileName = (data.testFile || this.thisFile || "test")
2066
+ .split(path.sep).pop()
2067
+ .replace(/\.[^/.]+$/, ""); // Remove file extension
2068
+ const sessionId = `${testFileName}-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
2069
+ const sessionFile = path.join(sessionsDir, `${sessionId}.json`);
2060
2070
 
2061
2071
  try {
2062
- // Ensure directory exists
2072
+ // Ensure directories exist
2063
2073
  if (!fs.existsSync(sessionDir)) {
2064
2074
  fs.mkdirSync(sessionDir, { recursive: true });
2065
2075
  }
2076
+ if (!fs.existsSync(sessionsDir)) {
2077
+ fs.mkdirSync(sessionsDir, { recursive: true });
2078
+ }
2066
2079
 
2067
2080
  const sessionData = {
2081
+ sessionId: sessionId,
2068
2082
  debuggerUrl: debuggerUrl,
2069
2083
  resolution: data.resolution || this.config.TD_RESOLUTION,
2070
2084
  testFile: data.testFile || this.thisFile,
@@ -2074,10 +2088,29 @@ ${regression}
2074
2088
 
2075
2089
  fs.writeFileSync(sessionFile, JSON.stringify(sessionData, null, 2));
2076
2090
  logger.log(`IDE session file written: ${sessionFile}`);
2091
+
2092
+ // Store session file path for cleanup on exit
2093
+ this._ideSessionFile = sessionFile;
2077
2094
  } catch (error) {
2078
2095
  logger.warn(`Failed to write IDE session file: ${error.message}`);
2079
2096
  }
2080
2097
  }
2098
+
2099
+ // Clean up IDE session file when test completes
2100
+ cleanupIdeSessionFile() {
2101
+ if (this._ideSessionFile) {
2102
+ const fs = require("fs");
2103
+ try {
2104
+ if (fs.existsSync(this._ideSessionFile)) {
2105
+ fs.unlinkSync(this._ideSessionFile);
2106
+ logger.log(`IDE session file cleaned up: ${this._ideSessionFile}`);
2107
+ }
2108
+ } catch (error) {
2109
+ // Ignore cleanup errors
2110
+ }
2111
+ this._ideSessionFile = null;
2112
+ }
2113
+ }
2081
2114
 
2082
2115
  async connectToSandboxService() {
2083
2116
  this.emitter.emit(
@@ -7,7 +7,7 @@ mcp-servers:
7
7
  command: npx
8
8
  args:
9
9
  - -p
10
- - testdriverai@beta
10
+ - testdriverai
11
11
  - testdriverai-mcp
12
12
  env:
13
13
  TD_API_KEY: ${TD_API_KEY}
@@ -55,7 +55,7 @@ Use this agent when the user asks to:
55
55
 
56
56
  **CLI:**
57
57
  ```bash
58
- npx testdriverai@beta init
58
+ npx testdriverai init
59
59
  ```
60
60
 
61
61
  **MCP (via this agent):**
@@ -97,10 +97,10 @@ Get your API key at: **https://console.testdriver.ai/team**
97
97
 
98
98
  ### Manual Installation
99
99
 
100
- If not using `init`, always use the **beta** tag when installing TestDriver:
100
+ If not using `init`, install TestDriver:
101
101
 
102
102
  ```bash
103
- npm install --save-dev testdriverai@beta
103
+ npm install --save-dev testdriverai
104
104
  ```
105
105
 
106
106
  ### Test Runner
@@ -76,14 +76,20 @@ class InitCommand extends BaseCommand {
76
76
  async promptForApiKey() {
77
77
  const envPath = path.join(process.cwd(), ".env");
78
78
 
79
- // Check if .env already exists with TD_API_KEY
79
+ // Check if .env already exists with a valid TD_API_KEY value
80
80
  if (fs.existsSync(envPath)) {
81
81
  const envContent = fs.readFileSync(envPath, "utf8");
82
- if (envContent.includes("TD_API_KEY=")) {
83
- console.log(
84
- chalk.gray("\n API key already configured in .env, skipping...\n"),
85
- );
86
- return null;
82
+ // Match TD_API_KEY= that's not commented out and has a real value (not empty or placeholder)
83
+ const apiKeyMatch = envContent.match(/^TD_API_KEY=(.+)$/m);
84
+ if (apiKeyMatch) {
85
+ const value = apiKeyMatch[1].trim();
86
+ // Skip only if there's a real value (not empty or placeholder text)
87
+ if (value && value !== "your_api_key" && !value.startsWith("<") && !value.startsWith("$")) {
88
+ console.log(
89
+ chalk.gray("\n API key already configured in .env, skipping...\n"),
90
+ );
91
+ return null;
92
+ }
87
93
  }
88
94
  }
89
95
 
@@ -400,7 +406,7 @@ class InitCommand extends BaseCommand {
400
406
  printNextSteps() {
401
407
  console.log(chalk.cyan("Next steps:\n"));
402
408
  console.log(" 1. Run your tests:");
403
- console.log(chalk.gray(" npx vitest run\n"));
409
+ console.log(chalk.gray(" vitest run\n"));
404
410
  console.log(" 2. Use AI agents to write tests:");
405
411
  console.log(chalk.gray(" Open VSCode/Cursor and use @testdriver agent\n"));
406
412
  console.log(" 3. MCP server configured:");
@@ -231,7 +231,7 @@ jobs:
231
231
  - name: Run TestDriver.ai tests
232
232
  env:
233
233
  TD_API_KEY: \${{ secrets.TD_API_KEY }}
234
- run: npx vitest run
234
+ run: vitest run
235
235
 
236
236
  - name: Upload test results
237
237
  if: always()
@@ -267,7 +267,7 @@ jobs:
267
267
  servers: {
268
268
  testdriver: {
269
269
  command: "npx",
270
- args: ["-p", "testdriverai@beta", "testdriverai-mcp"],
270
+ args: ["-p", "testdriverai", "testdriverai-mcp"],
271
271
  env: {
272
272
  TD_API_KEY: "${input:testdriver-api-key}",
273
273
  },
@@ -409,19 +409,19 @@ jobs:
409
409
  if (!options.skipInstall) {
410
410
  progress("\nšŸ“¦ Installing dependencies...");
411
411
  try {
412
- execSync("npm install -D vitest testdriverai@beta && npm install dotenv", {
412
+ execSync("npm install -D vitest testdriverai && npm install dotenv", {
413
413
  cwd: targetDir,
414
414
  stdio: "pipe",
415
415
  });
416
416
  progress("āœ“ Dependencies installed successfully");
417
417
  } catch (error) {
418
418
  errors.push("Failed to install dependencies. Run manually:");
419
- errors.push(" npm install -D vitest testdriverai@beta");
419
+ errors.push(" npm install -D vitest testdriverai");
420
420
  errors.push(" npm install dotenv");
421
421
  }
422
422
  } else {
423
423
  progress("\nℹ Skipped dependency installation. Run manually:");
424
- progress(" npm install -D vitest testdriverai@beta");
424
+ progress(" npm install -D vitest testdriverai");
425
425
  progress(" npm install dotenv");
426
426
  }
427
427
 
@@ -1789,7 +1789,7 @@ API Key: The apiKey parameter is optional. If not provided, you'll need to manua
1789
1789
  šŸ“š Next steps:
1790
1790
 
1791
1791
  1. Run your tests:
1792
- npx vitest run
1792
+ vitest run
1793
1793
 
1794
1794
  2. Use AI agents to write tests:
1795
1795
  Open VSCode/Cursor and use @testdriver agent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "7.2.89",
3
+ "version": "7.2.91",
4
4
  "description": "Next generation autonomous AI agent for end-to-end testing of web & desktop",
5
5
  "main": "sdk.js",
6
6
  "types": "sdk.d.ts",