Skip to content

Commit 106f681

Browse files
authored
Page.Url tests (#88)
1 parent 933f8a1 commit 106f681

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Xunit;
4+
5+
namespace PuppeteerSharp.Tests.Page
6+
{
7+
[Collection("PuppeteerLoaderFixture collection")]
8+
public class UrlTests : PuppeteerBaseTest
9+
{
10+
[Fact]
11+
public async Task ShouldWork()
12+
{
13+
using (var page = await Browser.NewPageAsync())
14+
{
15+
Assert.Equal(TestConstants.AboutBlank, page.Url);
16+
await page.GoToAsync(TestConstants.EmptyPage);
17+
Assert.Equal(TestConstants.EmptyPage, page.Url);
18+
}
19+
}
20+
}
21+
}

lib/PuppeteerSharp.Tests/TestConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public static class TestConstants
88
public const string ServerUrl = "http://localhost:8907";
99
public const string HttpsPrefix = "https://localhost:8908";
1010
public const int ChromiumRevision = Downloader.DefaultRevision;
11+
public const string AboutBlank = "about:blank";
1112
public static readonly string EmptyPage = $"{ServerUrl}/empty.html";
1213

1314
public static LaunchOptions DefaultBrowserOptions() => new LaunchOptions

0 commit comments

Comments
 (0)