From 94c495c8edb3b3616f0e8719cdad13b545b9eb8d Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 20 Dec 2025 09:45:04 +0000 Subject: [PATCH] fix(browser): default hook timeout 2m --- docs/browser.md | 2 +- src/browser/pw-tools-core.test.ts | 6 +++--- src/browser/pw-tools-core.ts | 4 ++-- src/cli/browser-cli-actions-input.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/browser.md b/docs/browser.md index 54cfe5cad..a43a4a7b7 100644 --- a/docs/browser.md +++ b/docs/browser.md @@ -189,7 +189,7 @@ Actions: Notes: - `upload` and `dialog` are **arming** calls; run them before the click/press that triggers the chooser/dialog. -- The arm default timeout is **30s**; pass `timeoutMs` if you need longer. +- The arm default timeout is **2 minutes**; pass `timeoutMs` if you need longer. - `snapshot --format ai` returns AI snapshot markup used for ref-based actions. ## Security & privacy notes diff --git a/src/browser/pw-tools-core.test.ts b/src/browser/pw-tools-core.test.ts index d56cf48f1..46a7d0268 100644 --- a/src/browser/pw-tools-core.test.ts +++ b/src/browser/pw-tools-core.test.ts @@ -127,7 +127,7 @@ describe("pw-tools-core", () => { await Promise.resolve(); expect(waitForEvent).toHaveBeenCalledWith("filechooser", { - timeout: 30_000, + timeout: 120_000, }); expect(fileChooser.setFiles).toHaveBeenCalledWith(["/tmp/a.txt"]); }); @@ -205,7 +205,7 @@ describe("pw-tools-core", () => { }); await Promise.resolve(); - expect(waitForEvent).toHaveBeenCalledWith("dialog", { timeout: 30_000 }); + expect(waitForEvent).toHaveBeenCalledWith("dialog", { timeout: 120_000 }); expect(accept).toHaveBeenCalledWith("x"); expect(dismiss).not.toHaveBeenCalled(); @@ -219,7 +219,7 @@ describe("pw-tools-core", () => { }); await Promise.resolve(); - expect(waitForEvent).toHaveBeenCalledWith("dialog", { timeout: 30_000 }); + expect(waitForEvent).toHaveBeenCalledWith("dialog", { timeout: 120_000 }); expect(dismiss).toHaveBeenCalled(); expect(accept).not.toHaveBeenCalled(); }); diff --git a/src/browser/pw-tools-core.ts b/src/browser/pw-tools-core.ts index d28c44973..d0cb441c6 100644 --- a/src/browser/pw-tools-core.ts +++ b/src/browser/pw-tools-core.ts @@ -222,7 +222,7 @@ export async function armFileUploadViaPlaywright(opts: { }): Promise { const page = await getPageForTargetId(opts); const state = ensurePageState(page); - const timeout = Math.max(500, Math.min(120_000, opts.timeoutMs ?? 30_000)); + const timeout = Math.max(500, Math.min(120_000, opts.timeoutMs ?? 120_000)); state.armIdUpload = nextUploadArmId += 1; const armId = state.armIdUpload; @@ -256,7 +256,7 @@ export async function armDialogViaPlaywright(opts: { }): Promise { const page = await getPageForTargetId(opts); const state = ensurePageState(page); - const timeout = Math.max(500, Math.min(120_000, opts.timeoutMs ?? 30_000)); + const timeout = Math.max(500, Math.min(120_000, opts.timeoutMs ?? 120_000)); state.armIdDialog = nextDialogArmId += 1; const armId = state.armIdDialog; diff --git a/src/cli/browser-cli-actions-input.ts b/src/cli/browser-cli-actions-input.ts index a18bc7be1..59fc57479 100644 --- a/src/cli/browser-cli-actions-input.ts +++ b/src/cli/browser-cli-actions-input.ts @@ -268,7 +268,7 @@ export function registerBrowserActionInputCommands( .option("--target-id ", "CDP target id (or unique prefix)") .option( "--timeout-ms ", - "How long to wait for the next file chooser (default: 30000)", + "How long to wait for the next file chooser (default: 120000)", (v: string) => Number(v), ) .action(async (paths: string[], opts, cmd) => { @@ -332,7 +332,7 @@ export function registerBrowserActionInputCommands( .option("--target-id ", "CDP target id (or unique prefix)") .option( "--timeout-ms ", - "How long to wait for the next dialog (default: 30000)", + "How long to wait for the next dialog (default: 120000)", (v: string) => Number(v), ) .action(async (opts, cmd) => {