Repository navigation
Fix local WASM Components E2E tests returning 404 - #67903
Merged
ilonatommy merged 3 commits intoJul 20, 2026
Merged
Conversation
The non-trimmed local E2E runs host BasicTestApp via the Blazor Gateway. The fixture passed --pathbase, but the gateway only binds Gateway:PathBase, so UsePathBase was never applied and the gateway's MapStaticAssets had no SPA fallback. Navigating to /subdir returned 404 and the browser-error assertion failed. Pass --Gateway:PathBase and enable StaticWebAssetSpaFallbackEnabled so the gateway serves index.html under the path base. Co-authored-by: Copilot <[email protected]> Copilot-Session: 343bb4ce-5611-47e2-90e3-d5485623d145
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a local-only failure in Blazor WebAssembly (client-mode) Components E2E tests where navigating under /subdir returned 404 before the app could boot when hosted via the Blazor Gateway in non-trimmed Debug runs.
Changes:
- Pass the Gateway path base via the correct configuration key (
Gateway:PathBase) soUsePathBaseis applied. - Enable SPA fallback generation in the static web assets endpoints manifest so client-side routes under the path base fall back to
index.htmlinstead of 404ing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Components/test/testassets/BasicTestApp/BasicTestApp.csproj | Enables SPA fallback in the static web assets endpoints manifest for BasicTestApp so client-side routes resolve under the Gateway host. |
| src/Components/test/E2ETest/Infrastructure/ServerFixtures/BlazorWasmTestAppFixture.cs | Fixes local Gateway hosting by binding the path base from the expected Gateway configuration section. |
dariatiurina
approved these changes
Jul 20, 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.
Problem
Running the Blazor WebAssembly (client-mode) Components E2E tests locally in Debug (non-trimmed) fails before the app even boots. The browser navigates to
/subdir, the host returns 404, the Blazor app never loads, and the test fails with:Each affected test also burns its full ~1-minute long-running timeout before failing.
Why it happened
Introduced in #65982.
Locally (non-trimmed),
BlazorWasmTestAppFixturehostsBasicTestAppthrough the Blazor Gateway (BlazorGateway.BuildWebHost). Two things were misconfigured for that path:--pathbase, but the gateway binds its options from theGatewayconfiguration section (BlazorGatewayOptions.SectionName = "Gateway", read viaConfiguration.GetSection("Gateway").Bind(options)).--pathbasepopulates the top-levelpathbasekey, which nothing reads (sooptions.PathBasestayed null andapp.UsePathBase("/subdir")was never called).This only affects local Debug runs. On CI (
TestTrimmedApps == true) the fixture takes a different code path (CreateStaticWebHost -> StaticSiteStartup) that already callsUsePathBaseandMapFallbackToFile("index.html"), so CI was unaffected. That's why the breakage was invisible in CI and only bit local development.