Skip to content

[Components][E2E] Fix and unquarantine CanElevateEffectiveMaxItemCount_WhenOverscanExceedsMax#66291

Merged
ilonatommy merged 1 commit intodotnet:mainfrom
ilonatommy:fix/servervirt-elevate-maxitemcount-stabilization
Apr 14, 2026
Merged

[Components][E2E] Fix and unquarantine CanElevateEffectiveMaxItemCount_WhenOverscanExceedsMax#66291
ilonatommy merged 1 commit intodotnet:mainfrom
ilonatommy:fix/servervirt-elevate-maxitemcount-stabilization

Conversation

@ilonatommy
Copy link
Copy Markdown
Member

@ilonatommy ilonatommy commented Apr 13, 2026

Summary

Fix the root cause of flakiness in ServerVirtualizationTest.CanElevateEffectiveMaxItemCount_WhenOverscanExceedsMax and unquarantine it.

Fixes #65962

Root cause

GetVisibleItemIndices() was called once and the resulting list was reused in all Browser.True() retry loops and across PageDown iterations. In server mode the async virtualization update had not finished when the snapshot was taken, so the retry loop kept checking a stale list that never reached 200 items, causing a timeout.

The same stale list was also used for contiguity and progress checks after each PageDown, meaning those checks operated on the initial view rather than the current DOM state.

What changed

  • Re-query GetVisibleItemIndices() inside each Browser.True() loop so retries reflect the current DOM state
  • Remove the quarantine attributes from both the base class and the ServerVirtualizationTest override
  • Remove the virtual modifier and override since they are no longer needed

…edsMax

The test was flaky because GetVisibleItemIndices() was called once and
the result was reused in all Browser.True() retry loops and across
PageDown iterations. In server mode, the async virtualization update
had not finished yet when the snapshot was taken, so the retry loops
kept checking a stale list that never reached 200 items.

Fix by re-querying GetVisibleItemIndices() inside each Browser.True()
loop so retries see the current DOM state.

Fixes dotnet#65962

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ilonatommy ilonatommy requested a review from a team as a code owner April 13, 2026 10:22
Copilot AI review requested due to automatic review settings April 13, 2026 10:22
@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Apr 13, 2026
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

Fixes flakiness in the Components E2E virtualization test CanElevateEffectiveMaxItemCount_WhenOverscanExceedsMax by ensuring DOM state is re-queried during retries and after paging, then removes the corresponding quarantine so the test runs normally again.

Changes:

  • Re-query GetVisibleItemIndices() inside Browser.True() retry loops so retries observe the latest DOM state.
  • Re-query visible indices after each PageDown so contiguity/progress checks validate the current viewport rather than a stale snapshot.
  • Remove quarantine attributes and the now-unnecessary virtual/override for this test (including the ServerExecution subclass override).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Components/test/E2ETest/Tests/VirtualizationTest.cs Updates the test logic to refresh visible-item snapshots during retries/scroll iterations, addressing the stale-list root cause.
src/Components/test/E2ETest/ServerExecutionTests/TestSubclasses.cs Removes the quarantined override so the server subclass inherits the fixed, unquarantined base test.

@ilonatommy ilonatommy merged commit 6dda1d4 into dotnet:main Apr 14, 2026
31 checks passed
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview4 milestone Apr 14, 2026
ilonatommy added a commit to ilonatommy/aspnetcore that referenced this pull request Apr 14, 2026
…e, restore missing PrependItems quarantine

The merge from main incorrectly re-introduced a quarantine for
CanElevateEffectiveMaxItemCount_WhenOverscanExceedsMax (dotnet#65962) which
was already fixed and unquarantined by dotnet#66291 on main. It also dropped
the DynamicContent_PrependItemsWhileScrolledToMiddle quarantine (dotnet#66308)
that was added by dotnet#66312 on main.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ilonatommy added a commit that referenced this pull request Apr 17, 2026
…re test setup (#66290)

* Stabilize NonZeroStartIndex_ScrollToMiddleThenMeasure E2E test setup

Apply the same retry-based scroll stabilization pattern from PR #66194
to NonZeroStartIndex_ScrollToMiddleThenMeasure. The test was racing in
server mode because it set scrollTop and then immediately checked the
rendered items, but the async virtualization update had not finished yet.

The fix computes the target offset up front, then retries both the
scroll assignment and the rendered-index check inside a single
Browser.True() loop before calling WaitForScrollStabilization.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Apply review feedback: fix spacing and reuse ScrollToOffsetWithStabilization helper

- Fix missing space around = in targetScrollTop assignment
- Extract scroll+retry logic into generalized ScrollToOffsetWithStabilization overload
- Reuse the helper in NonZeroStartIndex_ScrollToMiddleThenMeasure instead of duplicating

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix bad merge: remove stale CanElevateEffectiveMaxItemCount quarantine, restore missing PrependItems quarantine

The merge from main incorrectly re-introduced a quarantine for
CanElevateEffectiveMaxItemCount_WhenOverscanExceedsMax (#65962) which
was already fixed and unquarantined by #66291 on main. It also dropped
the DynamicContent_PrependItemsWhileScrolledToMiddle quarantine (#66308)
that was added by #66312 on main.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Use MutationObserver instead of scroll retry loop in NonZeroStartIndex test

Replace the retry-based ScrollToOffsetWithStabilization call with a
single scrollTop assignment followed by a MutationObserver that waits
for Blazor's DOM update to settle. This makes the test more
deterministic: it scrolls once and waits for the effect, rather than
retrying the scroll which could mask real bugs where the component
fails to handle the initial scroll correctly.

The MutationObserver waits for a 200ms quiet period after the last
DOM mutation, with a 2s fallback timeout. After that, scroll position
stabilization is verified, and the item index assertion is a hard
assert (not a retry loop).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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 ServerVirtualizationTest flaky tests (CanRenderHtmlTable and CanElevateEffectiveMaxItemCount_WhenOverscanExceedsMax)

3 participants