Repository navigation
Capture passkey upgrade HTML before automatic navigation - #70362
Conversation
Retain the first failed-persistence response before the browser can submit its continuation. Preserve the existing request, cookie, signaling, and navigation assertions. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
All eight generated-application theory rows remain unexecuted against pinned Playwright 1.62.0, so the new interception still needs human integration validation of cookie handling, continuation requests, and final navigation.
No open issues 🎉
What changed in this PR
Addresses #69494 by retaining passkey-upgrade response HTML before automatic navigation can make it unavailable to the Blazor template test.
Changes:
- Intercepts the first upgrade POST in failure cases, captures its body without following redirects, then delivers the response to the browser.
- Uses the retained HTML for assertions while preserving normal GET and subsequent POST handling, existing assertions, and all eight theory rows.
Full generated-application validation remains outstanding, as noted in the PR description.
| File | Description |
|---|---|
| src/ProjectTemplates/test/Templates.Blazor.Tests/BlazorWebTemplateTest.cs | Captures upgrade HTML before delivery and uses it for later assertions. |
Review effort: Balanced
|
✅ No documentation PR was created. Confidence that documentation is needed: 2% No docs needed: test infrastructure change only (BlazorWebTemplateTest.cs); PR states no production code changes. Documentation surfaces considered
|
Capture passkey upgrade HTML before automatic navigation
Retain passkey upgrade HTML before its automatic continuation can navigate.
Description
BlazorWebTemplate_ConditionalPasskeyRegistrationreads the first upgrade response after the page has submitted its continuation form and navigated away. Chromium can discard that response body, producing theNetwork.getResponseBodyerror documented in dotnet/aspnetcore#69494.For the failure cases that inspect redisplayed HTML, fetch and retain the first POST response before fulfilling the original browser request. Do not follow redirects during capture; leave GETs and subsequent POSTs on the normal browser path. Preserve the existing status, request, cookie, credential, signaling, and final-navigation assertions. All eight existing theory rows remain; no production code, retry, delay, timeout, or quarantine changes.
Simply moving the body read after the login click would still race the page's automatic navigation. Capturing before delivery provides an explicit ordering guarantee.
Validation
node <session-files>\passkey-response-repro.cjs— passed using installed Edge/Chromium 155 and cached Playwright 1.61.0, a loopback server, and the actual templatePasskeySubmit.razor.js. Baseline: 12/12 runs reproduced the body-read error. Capture: 12/12 passed, covering successful, rejected, pending, and unsupported signaling. Checked initial GET/query handling, continuation POST, cookie deletion, credential-field removal, original response status, redirect, and final page.& <session-files>\validate-passkey-capture.ps1— passed; the exact C# capture block compiles with nullable checks and warnings as errors against cached Playwright 1.61.0 and existing .NET 10 references.git -c core.longpaths=true diff --check— passed.. .\activate.ps1; dotnet --version— blocked: repository SDK12.0.100-alpha.1.26531.102is not installed. No tools were installed.BlazorWebTemplate_ConditionalPasskeyRegistrationin the generated ASP.NET application. The repository SDK and matching built product/template artifacts are unavailable. The browser reproduction does not validate persistence or the eight complete C# theory rows, and the API probe does not replace a project build against pinned Playwright 1.62.0. This draft does not claim verified CI remediation.Tradeoff: a small test-only interception is justified by repeated documented failures and a reproduced browser-lifetime mechanism. It retains all failure detection instead of adding retries or weakening assertions. The added response-path complexity is bounded to one response in affected rows; complete generated-application validation remains required before treating the flake as fixed.
Originally prepared in mmitche/AspNetCore#8, now submitted against upstream
mainat the user's request. Implementation and review were assisted by GitHub Copilot.Fixes #69494