File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
lib/PuppeteerSharp.Tests/CDPSessionTests Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,26 @@ public async Task ShouldBeAbleToDetachSession()
9292 StringAssert . Contains ( "Session closed." , exception . Message ) ;
9393 }
9494
95+ [ PuppeteerTest ( "CDPSession.spec.ts" , "Target.createCDPSession" , "should not report created targets for custom CDP sessions" ) ]
96+ [ Skip ( SkipAttribute . Targets . Firefox ) ]
97+ public async Task ShouldNotReportCreatedTArgetsForCustomCDPSessions ( )
98+ {
99+ var called = 0 ;
100+ async void EventHandler ( object sender , TargetChangedArgs e )
101+ {
102+ called ++ ;
103+ if ( called > 1 )
104+ {
105+ throw new Exception ( "Too many targets created" ) ;
106+ }
107+
108+ await e . Target . CreateCDPSessionAsync ( ) ;
109+ }
110+ Page . BrowserContext . TargetCreated += EventHandler ;
111+ await Browser . NewPageAsync ( ) ;
112+ Page . BrowserContext . TargetCreated -= EventHandler ;
113+ }
114+
95115 [ PuppeteerTest ( "CDPSession.spec.ts" , "Target.createCDPSession" , "should throw nice errors" ) ]
96116 [ Skip ( SkipAttribute . Targets . Firefox ) ]
97117 public async Task ShouldThrowNiceErrors ( )
You can’t perform that action at this time.
0 commit comments