Repository navigation
Stabilize CanDisplayBindingErrorsCollectionsToDefaultForm flaky test - #68056
Merged
Merged
Conversation
CanDisplayBindingErrorsCollectionsToDefaultForm flaky test
ilonatommy
approved these changes
Jul 28, 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.
Stabilize
FormWithParentBindingContextTest.CanDisplayBindingErrorsCollectionsToDefaultFormDescription
This PR addresses flakiness in
FormWithParentBindingContextTest.CanDisplayBindingErrorsCollectionsToDefaultForm.The test could intermittently fail with
StaleElementReferenceExceptionduring form submission and validation rendering. When the form is submitted with invalid values, Blazor rerenders the validation UI to display binding errors. During this rerender, existing validation message elements are removed and recreated. As a result, Selenium can occasionally attempt to access DOM elements that have already been replaced, causing stale element failures.To make the test more resilient, the assertions have been updated to use retryable
Browser.Contains(...),Browser.Equal(...), andBrowser.True(...)assertions with DOM queries performed inside the assertion delegate. This allows the test framework to retry until the expected UI state is reached while resolving fresh DOM elements on each poll.The updated assertions explicitly wait for:
This follows the same stabilization pattern used in PR #67677 by avoiding interactions with potentially stale element references and validating the UI only after rendering has completed.
With these changes in place, the test no longer relies on element references captured before a rerender and is resilient to transient rendering timing variations.
Validation / Investigation
As part of the investigation:
While the issue is timing-dependent and occurs during UI rerendering, the updated assertions eliminate the stale-element window by validating against newly queried elements on every retry.
Changes
Browser.Contains(...),Browser.Equal(...), andBrowser.True(...)assertions.Fixes #68021.