From a4357ed316bcbb5a7105a7b6deb93636ec4ac668 Mon Sep 17 00:00:00 2001 From: Agnik47 <140933190+Agnik47@users.noreply.github.com> Date: Wed, 2 Sep 2026 03:45:28 +0530 Subject: [PATCH] test: keep browser-run temp dirs in the OS temp dir Two browser-run tests seed a persistent context with `fs.mkdtempSync('/tmp/webcmd-persistent-browser-run-')`. Off POSIX that POSIX-absolute path is not the OS temp dir: on Windows it resolves against the current drive, so the tests write to `:\tmp` when that directory happens to exist and fail with ENOENT when it does not. Use `path.join(os.tmpdir(), ...)`, which the same file already uses for its artifact temp dir. Both tests also launch their own Chromium persistent context inside the test body while still on Vitest's 5s default, so they time out under a loaded full suite run even when the launch itself succeeds. Give them the 20s budget this repo already uses for process-launching tests. `stepDownload` gets the same treatment: its cookie test passed a hardcoded `/tmp/webcmd-download-test` and created that directory in the drive root, while the sibling test above it already resolved the same name through `os.tmpdir()`. CI does not install Playwright browsers for the unit job, so `describeWithChromium` skips this block there; the failures only show up on a contributor machine that has Chromium. --- src/browser/run/runner.test.ts | 8 ++++---- src/pipeline/steps/download.test.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/browser/run/runner.test.ts b/src/browser/run/runner.test.ts index c885bbf3..658dd0fa 100644 --- a/src/browser/run/runner.test.ts +++ b/src/browser/run/runner.test.ts @@ -543,7 +543,7 @@ afterAll(async () => { }); it('initializes against a pre-launched persistent context without registering it twice', async () => { - const userDataDir = fs.mkdtempSync('/tmp/webcmd-persistent-browser-run-'); + const userDataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'webcmd-persistent-browser-run-')); const persistent = await chromium.launchPersistentContext(userDataDir, { headless: true }); try { const persistentPage = persistent.pages()[0] ?? await persistent.newPage(); @@ -566,10 +566,10 @@ afterAll(async () => { await persistent.close(); fs.rmSync(userDataDir, { recursive: true, force: true }); } - }); + }, 20_000); it('hides sibling Session pages in a persistent context', async () => { - const userDataDir = fs.mkdtempSync('/tmp/webcmd-persistent-browser-run-'); + const userDataDir = fs.mkdtempSync(path.join(os.tmpdir(), 'webcmd-persistent-browser-run-')); const persistent = await chromium.launchPersistentContext(userDataDir, { headless: true }); try { const owned = persistent.pages()[0] ?? await persistent.newPage(); @@ -597,7 +597,7 @@ afterAll(async () => { await persistent.close(); fs.rmSync(userDataDir, { recursive: true, force: true }); } - }); + }, 20_000); it('waits for requests and responses', async () => { const output = await run(` diff --git a/src/pipeline/steps/download.test.ts b/src/pipeline/steps/download.test.ts index a0fd815e..c5e6dad5 100644 --- a/src/pipeline/steps/download.test.ts +++ b/src/pipeline/steps/download.test.ts @@ -154,7 +154,7 @@ describe('stepDownload', () => { page, { url: '${{ item.url }}', - dir: '/tmp/webcmd-download-test', + dir: path.join(os.tmpdir(), 'webcmd-download-test'), filename: '${{ index }}.mp4', progress: false, concurrency: 1,