Skip to content

Stabilize Blazor Web JS initializer tests - #70258

Merged
BrennanConroy merged 2 commits into
mainfrom
flaky/68856-js-initializers-root-fix
Nov 9, 2026
Merged

BrennanConroy merged 2 commits into
mainfrom
flaky/68856-js-initializers-root-fix

Conversation

@BrennanConroy

@BrennanConroy BrennanConroy commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Stabilize Blazor Web JS initializer tests

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making.

Make the Blazor Web initializer setup deterministic and validate the WASM asset path.

Description

BlazorWebJsInitializersTest uses the streaming browser context, whose Selenium page-load strategy does not wait for navigation to complete. The test previously wrote block-webassembly-settings to session storage after navigating to /initializers, racing the page's Blazor.start() call:

  • If startup read storage first, the test used the normal WebAssembly settings and usually passed without exercising the intended no-options path. The late value could also leak into a later theory row.
  • If the test write won, startup received no WebAssembly settings. The server-project initializer callbacks were registered, but dotnet.js was requested from /subdir/_framework/dotnet.js instead of the test client's /subdir/WasmMinimal/_framework/dotnet.js. Historical failures show that wrong-path request intermittently returning 200 text/plain with no module MIME type, aborting startup before callbacks were recorded.

The fix passes one-shot initializer settings in the target URL, so they are available before startup without cross-row storage state. The server-project beforeWebStart initializer supplies the /WasmMinimal resource mapping when the caller intentionally omits WebAssembly options. This preserves the original coverage for #54049: the framework-created options.webAssembly object is used by initializers before WebAssembly startup.

The modern test now also asserts that the browser loaded /WasmMinimal/_framework/dotnet.js, making the failure path deterministic instead of relying on the wrong route to intermittently return an invalid MIME type. The classic test shares the same setup and is unquarantined as part of the same fix. Related existing proposal: #69193.

Evidence

Without the beforeWebStart mapping, the unchanged regression assertion failed all four WebAssembly rows and the captured network log showed 200 text/javascript - /subdir/_framework/dotnet.js; all four non-WebAssembly controls passed. With the fix:

  • E2E project build: succeeded with 0 warnings and 0 errors.
  • Combined modern and classic initializer matrices: 16 passed, 0 failed.
  • Ten repeated combined runs: 160 passed, 0 failed.

Remaining uncertainty: validation used local Linux with Chrome 156. The historical MIME failure is environment-sensitive, so the draft should remain open until the repository's Linux/Windows Helix coverage confirms the route assertion and initializer behavior.

Issue: #68856

🤖 Posted by Flaky (AI Agent)

@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Nov 2, 2026

Copy link
Copy Markdown
Member Author

/azp run aspnetcore-components-e2e

The Mono server leg failed only in ServerRoutingTest.NavigationLock_CanBlockExternalNavigation, which Build Analysis reports at a 30.84% historical failure rate. The failure is an external-navigation URL assertion unrelated to the initializer files changed here; the CoreCLR E2E leg and 20 other checks passed. Requesting the repository-standard single rerun to verify it does not reproduce.

🤖 Posted by Flaky (AI Agent)

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@BrennanConroy
BrennanConroy marked this pull request as ready for review November 4, 2026 19:42
@BrennanConroy
BrennanConroy requested a review from a team as a code owner November 4, 2026 19:42
Copilot AI balanced review requested due to automatic review settings November 4, 2026 19:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The environment-sensitive initializer failures still need Linux and Windows Helix confirmation, as reported validation covers only local Linux/Chrome and reviewers could not execute the browser matrices.

No open issues 🎉

What changed in this PR

Stabilizes Blazor Web JavaScript initializer tests by making startup settings available before navigation-driven initialization, while preserving coverage for startup without explicit WebAssembly options.

Changes:

  • Passes initializer settings through query parameters instead of race-prone session storage writes.
  • Adds fallback WebAssembly resource mapping and asserts that startup loads WasmMinimal/_framework/dotnet.js.
  • Removes quarantine attributes from the modern and classic initializer tests.
File Description
src/​Components/​test/​testassets/​Components.TestServer/​wwwroot/​Components.TestServer.lib.module.js Supplies fallback resource mapping in beforeWebStart.
src/​Components/​test/​testassets/​Components.TestServer/​RazorComponents/​App.razor Reads initializer startup settings from query parameters.
src/​Components/​test/​E2ETest/​ServerRenderingTests/​BlazorWebJsInitializersTest.cs Updates test URLs, checks the WebAssembly asset path, and removes quarantine attributes.

Review effort: Balanced

@PureWeen

PureWeen commented Nov 4, 2026

Copy link
Copy Markdown
Member

/review

@PureWeen

PureWeen commented Nov 5, 2026

Copy link
Copy Markdown
Member

Copilot's local review panel found no issues to raise at this commit.

@BrennanConroy
BrennanConroy enabled auto-merge (squash) November 6, 2026 22:34
@BrennanConroy
BrennanConroy merged commit 0d7e878 into main Nov 9, 2026
32 checks passed
@BrennanConroy
BrennanConroy deleted the flaky/68856-js-initializers-root-fix branch November 9, 2026 09:57
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

✅ No documentation PR was created.

Confidence that documentation is needed: 2%

No docs needed: the PR only stabilizes Blazor Web JS initializer E2E tests (test infrastructure).

Documentation surfaces considered

  • Conceptual article: Not required — Only E2E tests and test assets under src/Components/test changed; no public behavior.
  • Migration guidance: Not required — No user-facing change to adopt.
  • Breaking change: Not required — No compatibility impact; signals showed no_signal.

@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 10, 2026
wtgodbe added a commit that referenced this pull request Nov 11, 2026
Backport of #70258. Preserve the release branch quarantine state.

(cherry picked from commit 0d7e878)

Co-authored-by: Brennan <[email protected]>
Co-authored-by: Copilot <[email protected]>

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 64dc336c Deployed Nov 9, 2026 by BrennanConroy via conclusion #246
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-reviewed-approved area-blazor Includes: Blazor, Razor Components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants