Skip to content

Commit d6e2a9d

Browse files
wtgodbeilonatommyCopilot
authored
[release/10.0] Fix flaky CanElevateEffectiveMaxItemCount_WhenOverscanExceedsMax (#67705)
Backport of #66291 to release/10.0. 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. This fix was already made on main via #66291 but was never backported to release/10.0, where the test is still flaking in the components-e2e pipeline. Co-authored-by: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3d6aeb1 commit d6e2a9d

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

src/Components/test/E2ETest/Tests/VirtualizationTest.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,14 @@ public void CanElevateEffectiveMaxItemCount_WhenOverscanExceedsMax()
578578
{
579579
Browser.MountTestComponent<VirtualizationLargeOverscan>();
580580
var container = Browser.Exists(By.Id("virtualize-large-overscan"));
581-
// Ensure we have an initial contiguous batch and the elevated effective max has kicked in (>= OverscanCount)
582-
var indices = GetVisibleItemIndices();
583-
Browser.True(() => indices.Count >= 200);
581+
// Wait for the elevated effective max to kick in (>= OverscanCount).
582+
// Re-query inside the retry loop so we see new items as they render.
583+
List<int> indices = null;
584+
Browser.True(() =>
585+
{
586+
indices = GetVisibleItemIndices();
587+
return indices.Count >= 200;
588+
});
584589

585590
// Give focus so PageDown works
586591
container.Click();
@@ -595,8 +600,13 @@ public void CanElevateEffectiveMaxItemCount_WhenOverscanExceedsMax()
595600
var scrollTop = (long)js.ExecuteScript("return arguments[0].scrollTop", container);
596601
while (scrollTop + clientHeight < scrollHeight)
597602
{
598-
// Validate contiguity on the current page
599-
Browser.True(() => IsCurrentViewContiguous(indices));
603+
// Re-query visible items after each scroll so contiguity and
604+
// progress checks reflect the current DOM state.
605+
Browser.True(() =>
606+
{
607+
indices = GetVisibleItemIndices();
608+
return IsCurrentViewContiguous(indices);
609+
});
600610

601611
// Track progress in indices
602612
var currentMax = indices.Max();

0 commit comments

Comments
 (0)