Fix flaky PageGoBackTests.ShouldWork by awaiting navigation response#3133
Merged
Fix flaky PageGoBackTests.ShouldWork by awaiting navigation response#3133
Conversation
ea24d47 to
0c055c0
Compare
Port upstream's async navigationResponse() pattern to PuppeteerSharp. The LifecycleWatcher now tracks when the navigation response arrives via a TaskCompletionSource that's resolved on Response or RequestFailed events. NavigationResponseAsync() awaits this before reading the response, preventing races where lifecycle events resolve the navigation before the response is available. Also fix LifecycleWatcher.Navigated to return early for BackForwardCacheRestore (matching upstream behavior) instead of falling through to CheckLifecycleComplete. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0c055c0 to
792f730
Compare
This was referenced Feb 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LifecycleWatcher.NavigationResponse was a synchronous property that read _navigationRequest?.Response immediately when the navigation lifecycle completed. This caused a race condition where the HTTP response hadn't been attached to the request object yet, returning null and causing NullReferenceException in tests.
Aligned with upstream Puppeteer by making NavigationResponse async, adding Response/RequestFailed event listeners to properly wait for the HTTP response to arrive before returning it.