Skip to content

Commit

Permalink
Add test for waitForFunction with cross-process navigation (#909)
Browse files Browse the repository at this point in the history
* Add test for waitForFunction with cross-process navigation

* fixed test
  • Loading branch information
Meir017 authored and kblok committed Feb 9, 2019
1 parent c61e545 commit 74deb46
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/PuppeteerSharp.Tests/FrameTests/WaitForFunctionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,22 @@ public async Task ShouldDisableTimeoutWhenItsSetTo0()
await Page.EvaluateExpressionAsync("window.__injected = true");
await watchdog;
}

[Fact]
public async Task ShouldSurviveCrossProcessNavigation()
{
var fooFound = false;
var waitForFunction = Page.WaitForExpressionAsync("window.__FOO === 1")
.ContinueWith(_ => fooFound = true);
await Page.GoToAsync(TestConstants.EmptyPage);
Assert.False(fooFound);
await Page.ReloadAsync();
Assert.False(fooFound);
await Page.GoToAsync(TestConstants.CrossProcessUrl + "/grid.html");
Assert.False(fooFound);
await Page.EvaluateExpressionAsync("window.__FOO = 1");
await waitForFunction;
Assert.True(fooFound);
}
}
}

0 comments on commit 74deb46

Please sign in to comment.