Skip to content

Commit 5ca1f7f

Browse files
Oxymoron290Copilot
andcommitted
Use FindElement in polling loop and add explicit width-change assertion
Replace App.WaitForElement with App.FindElement inside the polling loop to avoid compounding timeouts. Add an explicit assertion after the loop to report a clear failure if the width never changed, rather than letting it surface as a confusing downstream assertion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 260efec commit 5ca1f7f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • src/Controls/tests/TestCases.Shared.Tests/Tests/Issues

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue31109.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,20 @@ public void DynamicWidthRequestUpdatesFlexLayoutItems()
4040

4141
while (stopwatch.Elapsed < timeout)
4242
{
43-
var currentRect = App.WaitForElement("Item1").GetRect();
43+
var currentRect = App.FindElement("Item1").GetRect();
4444
if (System.Math.Abs(currentRect.Width - item1Before.Width) > 1)
4545
{
4646
break;
4747
}
4848

4949
System.Threading.Thread.Sleep(pollDelay);
5050
}
51+
52+
// Verify the width actually changed; fail here rather than in downstream assertions
53+
var item1Check = App.FindElement("Item1").GetRect();
54+
Assert.That(item1Check.Width, Is.Not.EqualTo(item1Before.Width).Within(1),
55+
"Item1 width should have changed within timeout after tapping ChangeWidths");
56+
5157
// After changing widths, all items should have equal width
5258
var item1After = App.WaitForElement("Item1").GetRect();
5359
var item2After = App.WaitForElement("Item2").GetRect();

0 commit comments

Comments
 (0)