Skip to content

Fix flaky QuickGrid paginator E2E test by waiting for rerender completion - #67978

Merged
ilonatommy merged 3 commits into
dotnet:mainfrom
irfanajaffer:67350_GridFlakyTest
Jul 24, 2026
Merged

ilonatommy merged 3 commits into
dotnet:mainfrom
irfanajaffer:67350_GridFlakyTest

Conversation

@irfanajaffer

@irfanajaffer irfanajaffer commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Stabilize and Unquarantine QuickGridInteractiveTest.PaginatorCorrectItemsPerPage

Description

This PR addresses flakiness in
QuickGridInteractiveTest.PaginatorCorrectItemsPerPage.

The test was previously quarantined due to intermittent
StaleElementReferenceException failures. When the paginator advances to the
next page, QuickGrid triggers a Blazor rerender that recreates both the
paginator elements and the grid rows. As a result, Selenium can occasionally
attempt to interact with DOM elements that have been replaced, causing stale
element failures.

To make the test more resilient, the assertions have been updated to use
Browser.Equal(...) 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:

  • The paginator to display the expected page number after navigation.
  • The grid to finish rerendering before validating the row count.

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 reproduces the flaky behavior
that originally led to quarantine.

Validation / Investigation

As part of the investigation:

  • The test was executed individually and in 100 repeated iterations locally.
  • All executions passed successfully and the intermittent failure could not be reproduced locally.
  • The test flow was reviewed, including the use of Browser.Equal(), which provides built-in retry/polling behavior for UI assertions.
  • The intermittent failure was only observed in CI and could not be reproduced during local validation.

While we were unable to gather before/after reproduction statistics due to the inability to reproduce the issue locally, the change aligns the test with an existing stabilization pattern and improves resiliency against rerender-related stale element interactions.

Changes

  • Replaced direct paginator and grid validations with retryable
    Browser.Equal(...) assertions.
  • Re-query DOM elements inside assertion delegates to ensure fresh element
    references are used on every retry.
  • Added comments documenting the rerendering behavior and the reason for the
    stabilization approach.
  • Removed
    [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/67350")]
    from PaginatorCorrectItemsPerPage.

Fixes #67350

@irfanajaffer
irfanajaffer requested a review from a team as a code owner July 23, 2026 12:06
@gfoidl gfoidl added the area-blazor Includes: Blazor, Razor Components label Jul 23, 2026

@ilonatommy ilonatommy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@irfanajaffer, thank you for the contribution. It would be good to add an information about the stats in the PR description, how many times did you have to run to reproduce the failure locally and how many times you run with the fix - to prove to the reviewers that the change is tested and justified.

@ilonatommy

Copy link
Copy Markdown
Member

@irfanajaffer why did you merge with main?

@irfanajaffer

Copy link
Copy Markdown
Contributor Author

@ilonatommy ,

Sorry, that was unintended. I saw a remaining check and tried to retrigger it by updating/rebasing my branch. It ended up bringing in main and creating the merge commit. Apologies for the confusion and inconvenience.

@ilonatommy

Copy link
Copy Markdown
Member

I saw a remaining check and tried to retrigger it by updating/rebasing my branch. It ended up bringing in main and creating the merge commit. Apologies for the confusion and inconvenience.

That one can be triggered only by us, no worries. Did you already manage to gather the stats from local runs for this PR? It will be helpful even in the future, if the bot will catch new failures on this test, to analyze the history of fixes.

@irfanajaffer

Copy link
Copy Markdown
Contributor Author

@ilonatommy ,

Thanks for following up.

We were not able to reproduce the failure locally, so we could not gather before/after reproduction statistics for the specific flaky behavior. As part of the validation, we ran the test both individually and in 100 repeated iterations, and all executions passed successfully without reproducing the failure.
We also reviewed the test flow and the use of Browser.Equal(), which provides built-in retry/polling behavior for UI assertions. Based on that review, the change aligns the test with an existing stabilization pattern already used in similar scenarios.

We've added these validation details to the PR description so there is historical context available for future investigations, especially if the bot reports new failures on this test. While we do not have reproduction metrics for the original failure, the recorded local validation results and investigation notes should help with future analysis.

@ilonatommy
ilonatommy merged commit 66b8fc3 into dotnet:main Jul 24, 2026
26 checks passed
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quarantine QuickGridInteractiveTest.PaginatorCorrectItemsPerPage (StaleElementReferenceException)

4 participants