File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
PuppeteerSharp.Tests/BrowserTests Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1+ using System . Threading . Tasks ;
2+ using Xunit ;
3+ using Xunit . Abstractions ;
4+
5+ namespace PuppeteerSharp . Tests . BrowserTests
6+ {
7+ [ Collection ( "PuppeteerLoaderFixture collection" ) ]
8+ public class IsConnectedTests : PuppeteerBrowserBaseTest
9+ {
10+ public IsConnectedTests ( ITestOutputHelper output ) : base ( output )
11+ {
12+ }
13+
14+ [ Fact ]
15+ public async Task ShouldSetTheBrowserConnectedState ( )
16+ {
17+ var newBrowser = await Puppeteer . ConnectAsync ( new ConnectOptions
18+ {
19+ BrowserWSEndpoint = Browser . WebSocketEndpoint
20+ } ) ;
21+ Assert . True ( newBrowser . IsConnected ) ;
22+ newBrowser . Disconnect ( ) ;
23+ Assert . False ( newBrowser . IsConnected ) ;
24+ }
25+ }
26+ }
Original file line number Diff line number Diff line change @@ -165,7 +165,10 @@ public bool IsClosed
165165 /// Dafault wait time in milliseconds. Defaults to 30 seconds.
166166 /// </summary>
167167 public int DefaultWaitForTimeout { get ; set ; } = Puppeteer . DefaultTimeout ;
168-
168+ /// <summary>
169+ /// Indicates that the browser is connected.
170+ /// </summary>
171+ public bool IsConnected => ! Connection . IsClosed ;
169172 #endregion
170173
171174 #region Public Methods
You can’t perform that action at this time.
0 commit comments