Stabilize VirtualizationTest.CancelsOutdatedRefreshes_Async flaky test - #68079
Conversation
|
This change looks too complex for just test stabilization purpose, you're basically introducing a new component with new logic. We don't want to edit the test so drastically, it's not just "mirroring the structure already in used in other stabilization PRs". From what I see, we had 2 failing lines:
- Browser.Equal("0", () => cancellationCount.Text);
+ Browser.Equal("0", () => Browser.FindElement(By.Id("cancellation-count")).Text);- js.ExecuteScript($"document.getElementById('async-container').scrollTo({{ top: {y} }})");
- Browser.Equal(y, () => (long)js.ExecuteScript("return document.getElementById('async-container').scrollTop"));
+ var target = y;
+ Browser.True(() =>
+ {
+ js.ExecuteScript($"document.getElementById('async-container').scrollTo({{ top: {target} }})");
+ return (long)js.ExecuteScript("return document.getElementById('async-container').scrollTop") >= target;
+ }or similar. By changing too much we're at risk of loosing the test coverage. Try to limit your fix to as few updates as possible. |
ilonatommy
left a comment
There was a problem hiding this comment.
If it passes I'm fine with the changes.
Thanks for the review — you're right that the previous draft was too
|
Stabilize
VirtualizationTest.CancelsOutdatedRefreshes_AsyncDescription
This PR addresses flakiness in
VirtualizationTest.CancelsOutdatedRefreshes_Async.The test could intermittently fail with
StaleElementReferenceExceptionor with
Expected: 1000, Actual: 0during the scroll-driven asyncrefresh of a
Virtualizecomponent rendered in server-side executionmode.
To make the test more resilient, the assertions have been updated to
re-query the DOM inside the assertion delegate so a fresh element
reference is obtained on every retry.
Validation / Investigation
IWebElementcapture of#cancellation-count.Browser.Equal(y, () => scrollTop)was astrict equality check on a possibly-converging value.
int.Parse(cancellationCount.Text, ...)could throwFormatExceptionon a transient empty/non-numeric value.Changes
cancellationCountelement and re-query it on every retry.Browser.Equal(y, () => scrollTop)withBrowser.True(() => scrollTop == targetY).int.TryParse.Fixes #66120.