@@ -2486,6 +2486,28 @@ describe("browser tool url alias support", () => {
24862486 } ) ;
24872487 } ) ;
24882488
2489+ it . each ( [
2490+ { requestedTimeoutMs : 10 , expectedTimeoutMs : 1_000 } ,
2491+ { requestedTimeoutMs : 180_000 , expectedTimeoutMs : 120_000 } ,
2492+ { requestedTimeoutMs : Number . MAX_SAFE_INTEGER , expectedTimeoutMs : 120_000 } ,
2493+ ] ) (
2494+ "normalizes host navigation timeout $requestedTimeoutMs before browser dispatch" ,
2495+ async ( { requestedTimeoutMs, expectedTimeoutMs } ) => {
2496+ await createBrowserTool ( ) . execute ?.( "call-1" , {
2497+ action : "navigate" ,
2498+ target : "host" ,
2499+ url : "https://example.com/slow" ,
2500+ targetId : "tab-1" ,
2501+ timeoutMs : requestedTimeoutMs ,
2502+ } ) ;
2503+
2504+ expect ( browserActionsMocks . browserNavigate ) . toHaveBeenCalledWith (
2505+ undefined ,
2506+ expect . objectContaining ( { timeoutMs : expectedTimeoutMs } ) ,
2507+ ) ;
2508+ } ,
2509+ ) ;
2510+
24892511 it ( "preserves an explicit navigation timeout across node and Gateway watchdogs" , async ( ) => {
24902512 mockSingleBrowserProxyNode ( ) ;
24912513 gatewayMocks . callGatewayTool
@@ -2528,6 +2550,54 @@ describe("browser tool url alias support", () => {
25282550 } ) ;
25292551 } ) ;
25302552
2553+ it . each ( [
2554+ { requestedTimeoutMs : 10 , expectedTimeoutMs : 1_000 } ,
2555+ { requestedTimeoutMs : 180_000 , expectedTimeoutMs : 120_000 } ,
2556+ { requestedTimeoutMs : Number . MAX_SAFE_INTEGER , expectedTimeoutMs : 120_000 } ,
2557+ ] ) (
2558+ "keeps normalized node navigation timeout $requestedTimeoutMs inside nested watchdogs" ,
2559+ async ( { requestedTimeoutMs, expectedTimeoutMs } ) => {
2560+ mockSingleBrowserProxyNode ( ) ;
2561+ gatewayMocks . callGatewayTool
2562+ . mockResolvedValueOnce ( {
2563+ ok : true ,
2564+ payload : {
2565+ result : { ok : true , targetId : "tab-1" , url : "https://example.com/slow" } ,
2566+ } ,
2567+ } )
2568+ . mockResolvedValueOnce ( {
2569+ ok : true ,
2570+ payload : {
2571+ result : {
2572+ ok : true ,
2573+ format : "ai" ,
2574+ targetId : "tab-1" ,
2575+ url : "https://example.com/slow" ,
2576+ snapshot : "slow page" ,
2577+ } ,
2578+ } ,
2579+ } ) ;
2580+
2581+ await createBrowserTool ( ) . execute ?.( "call-1" , {
2582+ action : "navigate" ,
2583+ target : "node" ,
2584+ url : "https://example.com/slow" ,
2585+ targetId : "tab-1" ,
2586+ timeoutMs : requestedTimeoutMs ,
2587+ } ) ;
2588+
2589+ const { options, request } = nodeInvokeCall ( 0 ) ;
2590+ expect ( options . timeoutMs ) . toBe ( expectedTimeoutMs + 10_000 ) ;
2591+ expect ( request . timeoutMs ) . toBe ( expectedTimeoutMs + 5_000 ) ;
2592+ expect ( request . params ?. timeoutMs ) . toBe ( expectedTimeoutMs ) ;
2593+ expect ( request . params ?. body ) . toEqual ( {
2594+ url : "https://example.com/slow" ,
2595+ targetId : "tab-1" ,
2596+ timeoutMs : expectedTimeoutMs ,
2597+ } ) ;
2598+ } ,
2599+ ) ;
2600+
25312601 it ( "returns inline page state after navigate" , async ( ) => {
25322602 browserActionsMocks . browserNavigate . mockResolvedValueOnce ( {
25332603 ok : true ,
0 commit comments