Skip to content

Stabilize and Unquarantine VirtualizationTest.ScrollToItem_AfterEndJump_LandsAtTarget - #69379

Merged
ilonatommy merged 16 commits into
dotnet:mainfrom
irfanajaffer:68644_VirtualizeTest
Sep 21, 2026
Merged

ilonatommy merged 16 commits into
dotnet:mainfrom
irfanajaffer:68644_VirtualizeTest

Conversation

@irfanajaffer

@irfanajaffer irfanajaffer commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR stabilizes and unquarantines
VirtualizationTest.ScrollToItem_AfterEndJump_LandsAtTarget.

The test navigates to the end of a virtualized list and then invokes
ScrollToItemAsync(200). The existing check for item 999 only proves that the
last item was rendered; it does not prove that the render count, scroll position,
and first rendered item resulting from the End-key operation have settled.

This change adds WaitForRenderToSettle(container, js) after the End-key
navigation and before starting the scroll-to-item operation. It also improves
the final assertion diagnostics and removes the quarantine attribute.

No product code or framework behavior is changed.

CI failure evidence

Issue #68644 captured four failures during its 30-day observation window:

  • Main-branch CI builds: 1558260, 1555778
  • Merged-PR CI builds: 1553376, 1557499

All four failures reported:

OpenQA.Selenium.BrowserAssertFailedException:
Xunit.Sdk.TrueException: Assert.True() Failure
Expected: True
Actual:   False

The stack trace pointed to
VirtualizationTest.ScrollToItem_AfterEndJump_LandsAtTarget() at line 5539 of
the source revision used by those CI runs. That line was:

Browser.True(() => GetTopRenderedIndex(js) == targetIndex);

This shows that the top rendered item did not reach the target index within the
assertion timeout. The old boolean-only assertion did not record the actual
index or pixel offset, so the historical failures cannot be used to calculate a
pixel difference or identify a consistent offset pattern.

The assertion now records the last observed top rendered index, its difference
from the target index, and scrollTop if the failure recurs.

Validation

  • Executed ScrollToItem_AfterEndJump_LandsAtTarget 100 consecutive times
    locally during the initial investigation; all iterations passed.
  • Built the Components E2E project successfully with no warnings or errors.
  • Ran the targeted Selenium test after the final changes:
    • Passed: 2
    • Failed: 0
    • Skipped: 0
  • Confirmed that the quarantine attribute is removed.

Changes

  • Added WaitForRenderToSettle(container, js) after End-key navigation.
  • Added failure diagnostics for the actual top index, index delta, and
    scrollTop.
  • Removed
    [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/68644")].

Fixes #68644

@github-actions github-actions Bot added the area-blazor Includes: Blazor, Razor Components label Sep 18, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Sep 18, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @irfanajaffer. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@irfanajaffer
irfanajaffer marked this pull request as ready for review September 21, 2026 06:54
Copilot AI lite review requested due to automatic review settings September 21, 2026 06:54
@irfanajaffer
irfanajaffer requested a review from a team as a code owner September 21, 2026 06:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Remove the quarantine attribute so the stabilized test runs normally.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Stabilizes the virtualization E2E test by waiting for rendering to settle after End-key navigation.

Changes:

  • Adds synchronization before scrolling to item 200.
File Summary
src/​Components/​test/​E2ETest/​Tests/​VirtualizationTest.cs Adds render-settling synchronization, but the test remains quarantined.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@ilonatommy

Copy link
Copy Markdown
Member

The failure pattern appears to be timing-sensitive and is primarily observed in
slower CI environments.

What are the failures observed on CI? What error message and in what line did we see? It would be good to attach it to prove the failing line is the one that is being stabilized.

@irfanajaffer

irfanajaffer commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor Author

The failure pattern appears to be timing-sensitive and is primarily observed in
slower CI environments.

What are the failures observed on CI? What error message and in what line did we see? It would be good to attach it to prove the failing line is the one that is being stabilized.

@ilonatommy ,

Thanks for the feedback. I reviewed the CI evidence associated with #68644.

The available CI logs do not expose the intermediate virtualization state, so we cannot directly prove the race condition from the failure data alone. However, all recorded failures occurred at the assertion validating the result of ScrollToItemAsync(200):

Browser.True(() => GetTopRenderedIndex(js) == targetIndex);

The added WaitForRenderToSettle(container, js) is intentionally placed at the only asynchronous transition between the successful End-key navigation validation and the failing assertion. While this does not conclusively prove the underlying cause, it eliminates the possibility that ScrollToItemAsync(200) begins while virtualization updates triggered by the End-key navigation are still being processed.

I've also updated the PR description to clarify the observed failure point, the rationale for the additional synchronization, and the distinction between the CI evidence and the hypothesis behind the stabilization approach.

@ilonatommy

Copy link
Copy Markdown
Member

The available CI logs do not expose the intermediate virtualization state, so we cannot directly prove the race condition from the failure data alone. However, all recorded failures occurred at the assertion validating the result of ScrollToItemAsync(200):

Browser.True(() => GetTopRenderedIndex(js) == targetIndex);

By how many pixels? Is there any pattern in the difference between the target and reality?

@ilonatommy

ilonatommy commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

The available CI logs do not expose the intermediate virtualization state, so we cannot directly prove the race condition from the failure data alone. However, all recorded failures occurred at the assertion validating the result of ScrollToItemAsync(200):
Browser.True(() => GetTopRenderedIndex(js) == targetIndex);

By how many pixels? Is there any pattern in the difference between the target and reality?

Ah, it's only boolean, it won't tell us. Can you maybe change this line to log the diff if the assert fails? There are asserts with messages. In case the line you're adding won't be enough we will have more info the next time we visit this problem.

irfanajaffer and others added 3 commits September 21, 2026 14:21
Report the actual top item, index delta, and scroll offset if the stabilized assertion fails again.

Co-authored-by: Copilot <[email protected]>
Record the last observed top item, index delta, and scroll offset when the stabilized assertion times out.

Co-authored-by: Copilot <[email protected]>
@irfanajaffer

Copy link
Copy Markdown
Contributor Author

Addressed in 3b01d71. The final assertion now captures the last values observed by the polling loop and reports:

  • expected and actual top rendered item
  • index delta (actual - target)
  • scrollTop

The historical CI failures only recorded Expected: True / Actual: False, so they do not contain enough information to calculate the old pixel difference or establish an offset pattern. If this stabilization is insufficient, the next failure will now include the missing state.

I also rebuilt the Components E2E project and reran the targeted Selenium test after this change: 2 passed, 0 failed, 0 skipped.

@ilonatommy

ilonatommy commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

There are asserts with messages.

public static void True(this IWebDriver driver, Func<bool> actual, string message)

Please, try to apply the smallest changes possible and use the hints from the review. Try-catch with rethrow is a hammer solution.

- Browser.True(() => GetTopRenderedIndex(js) == targetIndex);
+ Browser.True(() => GetTopRenderedIndex(js) == targetIndex,
+    $"Top rendered item should be {targetIndex} but was {GetTopRenderedIndex(js)} " +
+    $"(index delta: {GetTopRenderedIndex(js) - targetIndex}), scrollTop={GetScrollTop(js, container)}.");

Use the existing Browser.True message overload as suggested in review.

Co-authored-by: Copilot <[email protected]>
@irfanajaffer

Copy link
Copy Markdown
Contributor Author

You're right; I over-engineered this instead of using the existing assertion overload you pointed to. I replaced the try/catch and rethrow with the exact minimal Browser.True(..., message) change in 15d1b5f.

Validation after the change:

  • Components E2E build: 0 warnings, 0 errors
  • Targeted Selenium test: 2 passed, 0 failed, 0 skipped

@ilonatommy
ilonatommy enabled auto-merge (squash) September 21, 2026 11:08
@ilonatommy
ilonatommy merged commit e10a071 into dotnet:main Sep 21, 2026
29 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 22, 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 community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quarantine VirtualizationTest.ScrollToItem_AfterEndJump_LandsAtTarget

3 participants