Skip to content

BlazorWebTemplate_ConditionalPasskeyRegistration reads response body after navigation #69494

Description

@ilonatommy

Description

BlazorWebTemplate_ConditionalPasskeyRegistration intermittently fails on Windows because the test reads a Playwright IResponse body after the page has navigated away from that response.

The generated application appears to complete the passkey flow correctly. The failure occurs later while the test inspects the captured HTML response.

Failure

Microsoft.Playwright.PlaywrightException: Protocol error (Network.getResponseBody): No resource with given identifier found
Response body is not available for a response that was navigated away from. Read response.body() before triggering any navigation.

   at Microsoft.Playwright.Core.Response.BodyAsync()
   at Microsoft.Playwright.Core.Response.TextAsync()
   at BlazorTemplates.Tests.BlazorWebTemplateTest.BlazorWebTemplate_ConditionalPasskeyRegistration(...)
      in /_/src/ProjectTemplates/test/Templates.Blazor.Tests/BlazorWebTemplateTest.cs:line 266

The failing line is:

var redisplayedPage = await upgradeResponse.TextAsync();

Observed failures

Build PR Theory case
1610717 #69441 Failure / Success
1610395 #69461 DatabaseFailure / Success
1608370 #67553 Failure / Success
1607585 #69422 Failure / Unsupported

For builds 1610395 and 1608370, the published Templates.Blazor.Tests_net11.0_x64.xml contains 27 tests with 26 passing and this as the only failure.

Cause

The test captures the first /Account/PasskeyUpgrade response, but does not read its body immediately:

var upgradeResponseTask = page.WaitForResponseAsync(...);
await page.GetByRole(...).ClickAsync();
var upgradeResponse = await upgradeResponseTask;
await page.WaitForURLAsync(returnUrl, ...);

The browser then performs another upgrade request and navigates back to returnUrl. The test performs additional page and server-state checks before finally calling upgradeResponse.TextAsync(). Chromium can discard the original response body once navigation occurs, producing Network.getResponseBody: No resource with given identifier found.

A representative successful server sequence before the exception is:

POST /Account/PasskeyUpgrade -> 200 text/html
POST /Account/PasskeyUpgrade -> 302
GET /auth?... -> 200 text/html
GET /test/passkeys -> 200 application/json
Network.getResponseBody fails while reading the earlier 200 response

This test and ordering were introduced in #68194. The affected builds belong to unrelated PRs, supporting that this is a shared test race rather than a product regression in those PRs.

Suggested fix

Read and retain the response text immediately after upgradeResponseTask completes and before waiting for or triggering subsequent navigation. Use the retained string for the later assertions.

Activity

  1. added
    area-identity
    feature-playwright 🎭
    on Sep 24, 2026
  2. github-actions commented on Sep 24, 2026

    @github-actions
    Contributor

    Triage Summary

    Area: area-identity (already labeled; the failure is in the Blazor Web App template's passkey/Identity flow test)
    Type: Task (bounded fix to a flaky test: read the response body before triggering navigation, rather than a product regression)

    Potential Duplicates

    • None found

    Generated by Issue Triage Agent for dotnet/aspnetcore for #69494 · copilot · auto · 43.5 AIC · ⌖ 3.73 AIC · ⊞ 28.8K · ◷

  3. Youssef1313 commented on Nov 4, 2026

    @Youssef1313
    Member

    @wtgodbe Should this test be quarantined?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-identityfeature-playwright 🎭test-failure

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions