Skip to content

Commit afab561

Browse files
authored
Add missing browser tests (#1900)
1 parent 773e851 commit afab561

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Threading.Tasks;
2+
using PuppeteerSharp.Tests.Attributes;
3+
using PuppeteerSharp.Xunit;
4+
using Xunit;
5+
using Xunit.Abstractions;
6+
7+
namespace PuppeteerSharp.Tests.BrowserTests
8+
{
9+
[Collection(TestConstants.TestFixtureCollectionName)]
10+
public class BrowserVersionTests : PuppeteerBrowserBaseTest
11+
{
12+
public BrowserVersionTests(ITestOutputHelper output) : base(output)
13+
{
14+
}
15+
16+
[PuppeteerTest("browser.spec.ts", "Browser.version", "should return whether we are in headless")]
17+
[PuppeteerFact]
18+
public async Task ShouldReturnWhetherWeAreInHeadless()
19+
{
20+
var version= await Browser.GetVersionAsync();
21+
Assert.NotEmpty(version);
22+
}
23+
}
24+
}

lib/PuppeteerSharp.Tests/BrowserTests/ProcessTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ public ProcessTests(ITestOutputHelper output) : base(output) { }
1313

1414
[PuppeteerTest("browser.spec.ts", "Browser.process", "should return child_process instance")]
1515
[PuppeteerFact]
16-
public async Task ShouldReturnProcessInstance()
16+
public void ShouldReturnProcessInstance()
1717
{
1818
var process = Browser.Process;
1919
Assert.True(process.Id > 0);
20+
}
21+
22+
[PuppeteerTest("browser.spec.ts", "Browser.process", "should not return child_process for remote browser")]
23+
[PuppeteerFact]
24+
public async Task ShouldNotReturnChildProcessForRemoteBrowser()
25+
{
2026
var browserWSEndpoint = Browser.WebSocketEndpoint;
2127
var remoteBrowser = await Puppeteer.ConnectAsync(
2228
new ConnectOptions { BrowserWSEndpoint = browserWSEndpoint }, TestConstants.LoggerFactory);

0 commit comments

Comments
 (0)