Skip to content

Commit 5f22946

Browse files
kblokMeir017
authored andcommitted
Try to fix CSS coverage flakes on win (#626)
1 parent 1f3e60c commit 5f22946

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/PuppeteerSharp.Tests/JSCoverageTests/JSCoverageTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public JSCoverageTests(ITestOutputHelper output) : base(output)
2020
public async Task ShouldWork()
2121
{
2222
await Page.Coverage.StartJSCoverageAsync();
23-
await Page.GoToAsync(TestConstants.ServerUrl + "/jscoverage/simple.html");
23+
await Page.GoToAsync(TestConstants.ServerUrl + "/jscoverage/simple.html", WaitUntilNavigation.Networkidle0);
2424
var coverage = await Page.Coverage.StopJSCoverageAsync();
2525
Assert.Single(coverage);
2626
Assert.Contains("/jscoverage/simple.html", coverage[0].Url);

lib/PuppeteerSharp/Page.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,16 @@ await Task.WhenAll(
762762
public Task<Response> GoToAsync(string url, int? timeout = null, WaitUntilNavigation[] waitUntil = null)
763763
=> GoToAsync(url, new NavigationOptions { Timeout = timeout, WaitUntil = waitUntil });
764764

765+
/// <summary>
766+
/// Navigates to an url
767+
/// </summary>
768+
/// <param name="url">URL to navigate page to. The url should include scheme, e.g. https://.</param>
769+
/// <param name="waitUntil">When to consider navigation succeeded.
770+
/// <returns>Task which resolves to the main resource response. In case of multiple redirects, the navigation will resolve with the response of the last redirect</returns>
771+
/// <seealso cref="GoToAsync(string, NavigationOptions)"/>
772+
public Task<Response> GoToAsync(string url, WaitUntilNavigation waitUntil)
773+
=> GoToAsync(url, new NavigationOptions { WaitUntil = new[] { waitUntil } });
774+
765775
/// <summary>
766776
/// generates a pdf of the page with <see cref="MediaType.Print"/> css media. To generate a pdf with <see cref="MediaType.Screen"/> media call <see cref="EmulateMediaAsync(MediaType)"/> with <see cref="MediaType.Screen"/>
767777
/// </summary>

0 commit comments

Comments
 (0)