fix(browser): default hook timeout 2m

This commit is contained in:
Peter Steinberger
2025-12-20 09:45:04 +00:00
parent f54c801bd2
commit 94c495c8ed
4 changed files with 8 additions and 8 deletions

View File

@@ -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

View File

@@ -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();
});

View File

@@ -222,7 +222,7 @@ export async function armFileUploadViaPlaywright(opts: {
}): Promise<void> {
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<void> {
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;

View File

@@ -268,7 +268,7 @@ export function registerBrowserActionInputCommands(
.option("--target-id <id>", "CDP target id (or unique prefix)")
.option(
"--timeout-ms <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 <id>", "CDP target id (or unique prefix)")
.option(
"--timeout-ms <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) => {