Skip to content

Add test for Blazor web app Error page rendering with [PersistentState]#66269

Open
Copilot wants to merge 4 commits intomainfrom
copilot/fix-review-comment-test
Open

Add test for Blazor web app Error page rendering with [PersistentState]#66269
Copilot wants to merge 4 commits intomainfrom
copilot/fix-review-comment-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 10, 2026

Description

Adds a new test BlazorWebTemplate_ErrorPage_RendersCorrectly to BlazorWebTemplateTest.cs to verify the Error page in the Blazor web app template renders correctly.

This test was requested as a review comment on PR #66245, which fixed Error.razor by making the RequestId property public. The [PersistentState] attribute requires a public getter — when private, PersistentValueProviderComponentSubscription.PropertyGetterFactory would throw:

InvalidOperationException: A public property 'RequestId' on component type '...' with a public getter wasn't found.

The test:

  1. Creates a Blazor web app with Server interactivity (where [PersistentState] is exercised across the prerender → circuit hydration boundary)
  2. Navigates to /Error via Playwright
  3. Asserts the page renders with h1.text-danger and h2.text-danger content
  4. Asserts the Request ID is displayed — this directly validates that [PersistentState] on the public RequestId property is functioning; a private property would throw before the page could render

Changes

  • src/ProjectTemplates/test/Templates.Blazor.Tests/BlazorWebTemplateTest.cs: New BlazorWebTemplate_ErrorPage_RendersCorrectly test

  • 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. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Copilot AI requested a review from akoeplinger April 10, 2026 14:19
@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Apr 10, 2026
@akoeplinger akoeplinger marked this pull request as ready for review April 10, 2026 14:44
Copilot AI review requested due to automatic review settings April 10, 2026 14:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an end-to-end Playwright test to the Blazor web app template test suite to validate that the /Error page renders successfully under Server interactivity, covering the [PersistentState]/RequestId regression scenario from #66245.

Changes:

  • Add a new BlazorWebTemplate_ErrorPage_RendersCorrectly Playwright test that navigates to /Error and asserts expected headings and the presence of “Request ID”.
  • Add the necessary Microsoft.Playwright using for WaitUntilState usage in the new test.

…lateTest.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@dotnet-policy-service dotnet-policy-service Bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants