testdriverai 7.3.42 → 7.3.43
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 +4 -0
- package/lib/vitest/hooks.mjs +51 -0
- package/package.json +1 -1
- package/sdk.js +2 -2
package/CHANGELOG.md
CHANGED
package/lib/vitest/hooks.mjs
CHANGED
|
@@ -217,6 +217,47 @@ function cleanupConsoleSpy(client) {
|
|
|
217
217
|
const testDriverInstances = new WeakMap();
|
|
218
218
|
const lifecycleHandlers = new WeakMap();
|
|
219
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Known log file paths on the Windows test runner.
|
|
222
|
+
* These are written by pyautogui-cli.py and related services.
|
|
223
|
+
*/
|
|
224
|
+
const WINDOWS_RUNNER_LOG_PATHS = [
|
|
225
|
+
"C:\\Windows\\Temp\\pyautogui-cli.log",
|
|
226
|
+
];
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Fetch log files from the Windows test runner via exec() and save them locally.
|
|
230
|
+
* This runs before disconnect so we can still communicate with the sandbox.
|
|
231
|
+
*
|
|
232
|
+
* @param {import('../../sdk.js').default} client - TestDriver SDK instance
|
|
233
|
+
* @param {string} testName - Test file name (used for local directory naming)
|
|
234
|
+
*/
|
|
235
|
+
async function fetchRunnerLogs(client, testName) {
|
|
236
|
+
if (!client.connected) return;
|
|
237
|
+
if (client.os !== "windows") return;
|
|
238
|
+
|
|
239
|
+
for (const remotePath of WINDOWS_RUNNER_LOG_PATHS) {
|
|
240
|
+
const localName = path.basename(remotePath);
|
|
241
|
+
try {
|
|
242
|
+
// Read the log file contents via PowerShell
|
|
243
|
+
const cmd = `if (Test-Path '${remotePath}') { Get-Content -Path '${remotePath}' -Raw } else { Write-Output '__FILE_NOT_FOUND__' }`;
|
|
244
|
+
const result = await Promise.race([
|
|
245
|
+
client.exec("pwsh", cmd, 10000, true),
|
|
246
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), 15000)),
|
|
247
|
+
]);
|
|
248
|
+
|
|
249
|
+
if (result && typeof result === "string" && !result.includes("__FILE_NOT_FOUND__")) {
|
|
250
|
+
console.log(`\n[TestDriver] === Runner Log: ${localName} ===`);
|
|
251
|
+
console.log(result);
|
|
252
|
+
console.log(`[TestDriver] === End Runner Log ===\n`);
|
|
253
|
+
}
|
|
254
|
+
} catch (err) {
|
|
255
|
+
// Fire-and-forget — don't let log retrieval break cleanup
|
|
256
|
+
console.warn(`[TestDriver] Could not fetch runner log ${remotePath}: ${err.message}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
220
261
|
/**
|
|
221
262
|
* Upload buffered SDK + console logs directly to S3 via the existing Log system.
|
|
222
263
|
* Extracts the replayId from the dashcam URL, calls POST /api/v1/logs to create
|
|
@@ -632,6 +673,16 @@ export function TestDriver(context, options = {}) {
|
|
|
632
673
|
context.task.meta.dashcamUrl = null;
|
|
633
674
|
}
|
|
634
675
|
|
|
676
|
+
// Fetch runner logs before disconnecting (Windows only)
|
|
677
|
+
// This grabs pyautogui-cli logs from the runner while we still have a connection
|
|
678
|
+
try {
|
|
679
|
+
const logTestName = testFile.replace(/[/\\]/g, "_").replace(/\.test\.m?js$/, "");
|
|
680
|
+
await fetchRunnerLogs(currentInstance, logTestName);
|
|
681
|
+
} catch (err) {
|
|
682
|
+
// Never let log retrieval block cleanup
|
|
683
|
+
console.warn("[TestDriver] Runner log fetch failed:", err.message);
|
|
684
|
+
}
|
|
685
|
+
|
|
635
686
|
// Clean up console spies
|
|
636
687
|
cleanupConsoleSpy(currentInstance);
|
|
637
688
|
|
package/package.json
CHANGED
package/sdk.js
CHANGED
|
@@ -1895,7 +1895,7 @@ class TestDriverSDK {
|
|
|
1895
1895
|
// Add web log tracking with domain wildcard pattern, then start dashcam
|
|
1896
1896
|
if (this.dashcamEnabled) {
|
|
1897
1897
|
const domainPattern = this._getUrlDomainPattern(url);
|
|
1898
|
-
await this.dashcam.addWebLog(domainPattern, "Web Logs");
|
|
1898
|
+
// await this.dashcam.addWebLog(domainPattern, "Web Logs");
|
|
1899
1899
|
|
|
1900
1900
|
// Start dashcam recording after logs are configured
|
|
1901
1901
|
if (!(await this.dashcam.isRecording())) {
|
|
@@ -2462,7 +2462,7 @@ with zipfile.ZipFile(io.BytesIO(zip_data)) as zf:
|
|
|
2462
2462
|
const pattern = this._provisionedChromeUrl
|
|
2463
2463
|
? this._getUrlDomainPattern(this._provisionedChromeUrl)
|
|
2464
2464
|
: "**";
|
|
2465
|
-
await this.dashcam.addWebLog(pattern, "Web Logs");
|
|
2465
|
+
// await this.dashcam.addWebLog(pattern, "Web Logs");
|
|
2466
2466
|
}
|
|
2467
2467
|
|
|
2468
2468
|
// Start recording if not already recording
|