testdriverai 7.2.62 → 7.2.63

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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## [7.2.63](https://github.com/testdriverai/testdriverai/compare/v7.2.62...v7.2.63) (2026-01-30)
2
+
3
+
4
+
1
5
  ## [7.2.62](https://github.com/testdriverai/testdriverai/compare/v7.2.61...v7.2.62) (2026-01-30)
2
6
 
3
7
 
package/agent/index.js CHANGED
@@ -446,7 +446,8 @@ class TestDriverAgent extends EventEmitter2 {
446
446
  }
447
447
  );
448
448
 
449
- this.emitter.emit(events.log.markdown.static, response.data);
449
+ // Use log.log (not markdown.static) so output goes through console spy to sandbox
450
+ this.emitter.emit(events.log.log, response.data);
450
451
 
451
452
  this.lastScreenshot = thisScreenshot;
452
453
 
@@ -27,6 +27,7 @@ describe('My Test Suite', () => {
27
27
  - `provision.vscode()` - Launch VS Code with optional extensions
28
28
  - `provision.installer()` - Download and install applications
29
29
  - `provision.electron()` - Launch Electron applications
30
+ - `provision.dashcam()` - Initialize Dashcam recording with logging
30
31
 
31
32
  ---
32
33
 
@@ -248,6 +249,66 @@ it('should launch Electron app', async (context) => {
248
249
 
249
250
  ---
250
251
 
252
+ ## provision.dashcam()
253
+
254
+ Initialize Dashcam recording with logging. Use this when you want to start Dashcam recording without launching a specific application (e.g., for custom application launches or testing scenarios).
255
+
256
+ ```javascript
257
+ await testdriver.provision.dashcam({
258
+ logPath: '/tmp/myapp.log',
259
+ logName: 'My Application Log',
260
+ title: 'Custom Test Recording'
261
+ });
262
+ ```
263
+
264
+ **Options:**
265
+ | Option | Type | Default | Description |
266
+ |--------|------|---------|-------------|
267
+ | `logPath` | string | auto-generated | Path to log file to track |
268
+ | `logName` | string | `'TestDriver Log'` | Display name for the log |
269
+ | `webLogs` | boolean | `true` | Enable web log tracking |
270
+ | `title` | string | - | Custom title for the recording |
271
+
272
+ **Example - Basic Recording:**
273
+
274
+ ```javascript
275
+ it('should record a custom application test', async (context) => {
276
+ const testdriver = TestDriver(context, ());
277
+
278
+ // Start Dashcam recording
279
+ await testdriver.provision.dashcam();
280
+
281
+ // Launch your custom application
282
+ await testdriver.exec('sh', './my-custom-app.sh &', 10000);
283
+
284
+ // Interact with the application
285
+ await testdriver.find('main window').click();
286
+
287
+ const result = await testdriver.assert('Application is running');
288
+ expect(result).toBeTruthy();
289
+ });
290
+ ```
291
+
292
+ **Example - Custom Log File:**
293
+
294
+ ```javascript
295
+ it('should record with custom log file', async (context) => {
296
+ const testdriver = TestDriver(context, ());
297
+
298
+ // Start Dashcam with custom log tracking
299
+ await testdriver.provision.dashcam({
300
+ logPath: '/var/log/myapp/application.log',
301
+ logName: 'My App Logs',
302
+ title: 'Custom App Test'
303
+ });
304
+
305
+ // Your test code here
306
+ await testdriver.exec('sh', 'myapp --start', 30000);
307
+ });
308
+ ```
309
+
310
+ ---
311
+
251
312
  ## How Provision Methods Work
252
313
 
253
314
  When you call a provision method:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testdriverai",
3
- "version": "7.2.62",
3
+ "version": "7.2.63",
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",
package/sdk.d.ts CHANGED
@@ -769,6 +769,18 @@ export interface ProvisionElectronOptions {
769
769
  args?: string[];
770
770
  }
771
771
 
772
+ /** Options for provision.dashcam */
773
+ export interface ProvisionDashcamOptions {
774
+ /** Path to log file (auto-generated if not provided) */
775
+ logPath?: string;
776
+ /** Display name for the log (default: 'TestDriver Log') */
777
+ logName?: string;
778
+ /** Enable web log tracking (default: true) */
779
+ webLogs?: boolean;
780
+ /** Custom title for the recording */
781
+ title?: string;
782
+ }
783
+
772
784
  /** Provision API for launching applications */
773
785
  export interface ProvisionAPI {
774
786
  /**
@@ -801,6 +813,12 @@ export interface ProvisionAPI {
801
813
  * @param options - Electron launch options
802
814
  */
803
815
  electron(options: ProvisionElectronOptions): Promise<void>;
816
+
817
+ /**
818
+ * Initialize Dashcam recording with logging
819
+ * @param options - Dashcam options
820
+ */
821
+ dashcam(options?: ProvisionDashcamOptions): Promise<void>;
804
822
  }
805
823
 
806
824
  /** Dashcam API for screen recording */
package/sdk.js CHANGED
@@ -1506,64 +1506,7 @@ class TestDriverSDK {
1506
1506
  await this._dashcam.addWebLog("**", "Web Logs");
1507
1507
  }
1508
1508
 
1509
- // Set up Chrome profile with preferences
1510
1509
  const shell = this.os === "windows" ? "pwsh" : "sh";
1511
- const userDataDir =
1512
- this.os === "windows"
1513
- ? "C:\\Users\\testdriver\\AppData\\Local\\TestDriver\\Chrome"
1514
- : "/tmp/testdriver-chrome-profile";
1515
-
1516
- // Create user data directory and Default profile directory
1517
- const defaultProfileDir =
1518
- this.os === "windows"
1519
- ? `${userDataDir}\\Default`
1520
- : `${userDataDir}/Default`;
1521
-
1522
- const createDirCmd =
1523
- this.os === "windows"
1524
- ? `New-Item -ItemType Directory -Path "${defaultProfileDir}" -Force | Out-Null`
1525
- : `mkdir -p "${defaultProfileDir}"`;
1526
-
1527
- await this.exec(shell, createDirCmd, 60000, true);
1528
-
1529
- // Write Chrome preferences
1530
- const chromePrefs = {
1531
- credentials_enable_service: false,
1532
- profile: {
1533
- password_manager_enabled: false,
1534
- default_content_setting_values: {},
1535
- },
1536
- signin: {
1537
- allowed: false,
1538
- },
1539
- sync: {
1540
- requested: false,
1541
- first_setup_complete: true,
1542
- sync_all_os_types: false,
1543
- },
1544
- autofill: {
1545
- enabled: false,
1546
- },
1547
- local_state: {
1548
- browser: {
1549
- has_seen_welcome_page: true,
1550
- },
1551
- },
1552
- };
1553
-
1554
- const prefsPath =
1555
- this.os === "windows"
1556
- ? `${defaultProfileDir}\\Preferences`
1557
- : `${defaultProfileDir}/Preferences`;
1558
-
1559
- const prefsJson = JSON.stringify(chromePrefs, null, 2);
1560
- const writePrefCmd =
1561
- this.os === "windows"
1562
- ? // Use compact JSON and [System.IO.File]::WriteAllText to avoid Set-Content hanging issues
1563
- `[System.IO.File]::WriteAllText("${prefsPath}", '${JSON.stringify(chromePrefs).replace(/'/g, "''")}')`
1564
- : `cat > "${prefsPath}" << 'EOF'\n${prefsJson}\nEOF`;
1565
-
1566
- await this.exec(shell, writePrefCmd, 60000, true);
1567
1510
 
1568
1511
  // Build Chrome launch command
1569
1512
  const chromeArgs = [];
@@ -1575,7 +1518,6 @@ class TestDriverSDK {
1575
1518
  "--no-first-run",
1576
1519
  "--no-experiments",
1577
1520
  "--disable-infobars",
1578
- `--user-data-dir=${userDataDir}`,
1579
1521
  );
1580
1522
 
1581
1523
  // Add remote debugging port for captcha solving support
@@ -1788,64 +1730,6 @@ with zipfile.ZipFile(io.BytesIO(zip_data)) as zf:
1788
1730
  await this._dashcam.addWebLog("**", "Web Logs");
1789
1731
  }
1790
1732
 
1791
- // Set up Chrome profile with preferences
1792
- const userDataDir =
1793
- this.os === "windows"
1794
- ? "C:\\Users\\testdriver\\AppData\\Local\\TestDriver\\Chrome"
1795
- : "/tmp/testdriver-chrome-profile";
1796
-
1797
- // Create user data directory and Default profile directory
1798
- const defaultProfileDir =
1799
- this.os === "windows"
1800
- ? `${userDataDir}\\Default`
1801
- : `${userDataDir}/Default`;
1802
-
1803
- const createDirCmd =
1804
- this.os === "windows"
1805
- ? `New-Item -ItemType Directory -Path "${defaultProfileDir}" -Force | Out-Null`
1806
- : `mkdir -p "${defaultProfileDir}"`;
1807
-
1808
- await this.exec(shell, createDirCmd, 60000, true);
1809
-
1810
- // Write Chrome preferences
1811
- const chromePrefs = {
1812
- credentials_enable_service: false,
1813
- profile: {
1814
- password_manager_enabled: false,
1815
- default_content_setting_values: {},
1816
- },
1817
- signin: {
1818
- allowed: false,
1819
- },
1820
- sync: {
1821
- requested: false,
1822
- first_setup_complete: true,
1823
- sync_all_os_types: false,
1824
- },
1825
- autofill: {
1826
- enabled: false,
1827
- },
1828
- local_state: {
1829
- browser: {
1830
- has_seen_welcome_page: true,
1831
- },
1832
- },
1833
- };
1834
-
1835
- const prefsPath =
1836
- this.os === "windows"
1837
- ? `${defaultProfileDir}\\Preferences`
1838
- : `${defaultProfileDir}/Preferences`;
1839
-
1840
- const prefsJson = JSON.stringify(chromePrefs, null, 2);
1841
- const writePrefCmd =
1842
- this.os === "windows"
1843
- ? // Use compact JSON and [System.IO.File]::WriteAllText to avoid Set-Content hanging issues
1844
- `[System.IO.File]::WriteAllText("${prefsPath}", '${JSON.stringify(chromePrefs).replace(/'/g, "''")}')`
1845
- : `cat > "${prefsPath}" << 'EOF'\n${prefsJson}\nEOF`;
1846
-
1847
- await this.exec(shell, writePrefCmd, 60000, true);
1848
-
1849
1733
  // Build Chrome launch command
1850
1734
  const chromeArgs = [];
1851
1735
  if (maximized) chromeArgs.push("--start-maximized");
@@ -1856,7 +1740,6 @@ with zipfile.ZipFile(io.BytesIO(zip_data)) as zf:
1856
1740
  "--no-experiments",
1857
1741
  "--disable-infobars",
1858
1742
  "--disable-features=ChromeLabs",
1859
- `--user-data-dir=${userDataDir}`,
1860
1743
  );
1861
1744
 
1862
1745
  // Add remote debugging port for captcha solving support
@@ -2160,6 +2043,58 @@ with zipfile.ZipFile(io.BytesIO(zip_data)) as zf:
2160
2043
 
2161
2044
  await this.focusApplication("Electron");
2162
2045
  },
2046
+
2047
+ /**
2048
+ * Initialize Dashcam recording with logging
2049
+ * @param {Object} options - Dashcam options
2050
+ * @param {string} [options.logPath] - Path to log file (auto-generated if not provided)
2051
+ * @param {string} [options.logName='TestDriver Log'] - Display name for the log
2052
+ * @param {boolean} [options.webLogs=true] - Enable web log tracking
2053
+ * @param {string} [options.title] - Custom title for the recording
2054
+ * @returns {Promise<void>}
2055
+ */
2056
+ dashcam: async (options = {}) => {
2057
+ const {
2058
+ logPath,
2059
+ logName = "TestDriver Log",
2060
+ webLogs = true,
2061
+ title,
2062
+ } = options;
2063
+
2064
+ // Ensure dashcam is available
2065
+ if (!this._dashcam) {
2066
+ console.warn(
2067
+ "[provision.dashcam] Dashcam is not available. Skipping.",
2068
+ );
2069
+ return;
2070
+ }
2071
+
2072
+ // Set custom title if provided
2073
+ if (title) {
2074
+ this._dashcam.setTitle(title);
2075
+ }
2076
+
2077
+ // Add file log tracking
2078
+ const actualLogPath =
2079
+ logPath ||
2080
+ (this.os === "windows"
2081
+ ? "C:\\Users\\testdriver\\testdriver.log"
2082
+ : "/tmp/testdriver.log");
2083
+
2084
+ await this._dashcam.addFileLog(actualLogPath, logName);
2085
+
2086
+ // Add web log tracking if enabled
2087
+ if (webLogs) {
2088
+ await this._dashcam.addWebLog("**", "Web Logs");
2089
+ }
2090
+
2091
+ // Start recording if not already recording
2092
+ if (!(await this._dashcam.isRecording())) {
2093
+ await this._dashcam.start();
2094
+ }
2095
+
2096
+ console.log("[provision.dashcam] ✅ Dashcam recording started");
2097
+ },
2163
2098
  };
2164
2099
 
2165
2100
  // Wrap all provision methods with reconnect check using Proxy