File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -252,5 +252,18 @@ public async Task CanEvaluateScriptAsyncWithEncodedStringArguments()
252252 output . WriteLine ( "{0} passes {1}" , test , javascriptResponse . Result ) ;
253253 }
254254 }
255+
256+ [ Theory ]
257+ [ InlineData ( "(async () => { function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }; await sleep(2000); return true; })();" ) ]
258+ public async Task ShouldTimeout ( string script )
259+ {
260+ AssertInitialLoadComplete ( ) ;
261+
262+ var exception = await Assert . ThrowsAsync < TaskCanceledException > (
263+ async ( ) => await Browser . EvaluateScriptAsync ( script , timeout : TimeSpan . FromMilliseconds ( 100 ) ) ) ;
264+
265+ Assert . NotNull ( exception ) ;
266+ Assert . IsType < TaskCanceledException > ( exception ) ;
267+ }
255268 }
256269}
You can’t perform that action at this time.
0 commit comments