Skip to content

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 11, 2025

Backport of #63640 to release/10.0

/cc @oroztocil

Fix and un-quarantine CanUseAntiforgeryAfterInitialRender test

Fix and un-quarantine a flaky E2E test for Blazor.

Description

The ServerRenderingTests.FormHandlingTests.CanUseAntiforgeryAfterInitialRender test was flaky due to a race condition between re-rendering an element and checking its text value in the test assertion.

As the final step of the test, we check the text value of a specific DOM element. There was a race condition due to which the element can get re-rerendered between the moment when we acquire a WebElement reference to the DOM element (using the Browser.Exists method) and when we read the element's text value. When that happens, StaleElementReferenceException is thrown.

The PR tries to remove the flakiness by:

  • Making the tested DOM element rendered only during interactive rendering and not during static rendering.
  • Wrapping the two-step operation of retrieving the element reference and reading its text value inside a retry block (provided by the Selenium waiting API).

Fixes #63640

Customer Impact

The change increases the test coverage of our code.

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Does not impact shipped code.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

When servicing release/2.3

  • Make necessary changes in eng/PatchConfig.props

@github-actions github-actions bot requested a review from a team as a code owner September 11, 2025 15:46
@oroztocil oroztocil added tell-mode Indicates a PR which is being merged during tell-mode area-blazor Includes: Blazor, Razor Components labels Sep 11, 2025
@ilonatommy ilonatommy requested a review from lewing September 12, 2025 08:27
@ilonatommy ilonatommy added this to the 10.0-rc2 milestone Sep 12, 2025
@wtgodbe wtgodbe merged commit c975a6b into release/10.0 Sep 12, 2025
28 checks passed
@wtgodbe wtgodbe deleted the backport/pr-63640-to-release/10.0 branch September 12, 2025 16:03
@dotnet-policy-service dotnet-policy-service bot modified the milestone: 10.0-rc2 Sep 12, 2025
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 tell-mode Indicates a PR which is being merged during tell-mode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants