From 74deb4669e2b4a624053cc8baba67f1d856fe371 Mon Sep 17 00:00:00 2001 From: Meir Blachman Date: Sat, 9 Feb 2019 15:04:27 +0200 Subject: [PATCH] Add test for waitForFunction with cross-process navigation (#909) * Add test for waitForFunction with cross-process navigation * fixed test --- .../FrameTests/WaitForFunctionTests.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/PuppeteerSharp.Tests/FrameTests/WaitForFunctionTests.cs b/lib/PuppeteerSharp.Tests/FrameTests/WaitForFunctionTests.cs index ced1bf1c9..94461afa1 100644 --- a/lib/PuppeteerSharp.Tests/FrameTests/WaitForFunctionTests.cs +++ b/lib/PuppeteerSharp.Tests/FrameTests/WaitForFunctionTests.cs @@ -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); + } } } \ No newline at end of file