From eb3c2f02b2ccab1e26ef5449d1c5609ccdd4494d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2026 16:24:59 +0000 Subject: [PATCH] ci-fix: de-flake DropEventCoordinates retry loop (refs #35981, attempt 1/5) DropEventCoordinates is intermittently flaky on iOS 18.5: the retry loop accepted the first parseable drop reading even when the synthesized gesture landed with degenerate (0,0)/negative coordinates, which then failed the strictly-positive assertion. A degenerate drop also still fires OnDrop and moves "Blue" into the target layout, so a naive retry dragged within the same layout and was ignored. De-flake without weakening any assertion: - Tighten the loop success condition to the same positive-coordinate check the test already asserts, so an invalid first reading triggers a retry instead of a hard failure. - Reset to a clean state (ResetButton) between retries so each retry is a valid cross-layout drag. No assertions removed/weakened, no timeout bumped, no [Retry]/[Ignore] added. Refs: dotnet/maui#35981 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Tests/DragAndDropUITests.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/DragAndDropUITests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/DragAndDropUITests.cs index 7ca40e2712b8..60a2ea803955 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/DragAndDropUITests.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/DragAndDropUITests.cs @@ -366,10 +366,26 @@ public void DropEventCoordinates() bool dragDropSuccess = false; for (int i = 0; i < 3; i++) { + if (i > 0) + { + // A degenerate first gesture still fires OnDrop, which moves "Blue" into the + // target layout. Reset to a clean state before retrying; otherwise the retry would + // drag "Blue" within the same layout and OnDrop would ignore it (Source == layout). + App.Tap("ResetButton"); + App.WaitForElement("Blue"); + App.WaitForElement("Green"); + } + App.DragAndDrop("Blue", "Green"); Thread.Sleep(500); App.WaitForElement("DropRelativeLayout"); - if (GetCoordinatesFromLabel(App.FindElement("DropRelativeLayout").GetText()) != null) + + // Only treat the drag-and-drop as successful once the drop reports valid, positive + // coordinates (the same condition asserted below). On iOS 18.5 the first synthesized + // gesture can land with degenerate (0,0)/negative coordinates; retry from a clean + // state instead of accepting the first invalid reading. + var dropCoordinates = GetCoordinatesFromLabel(App.FindElement("DropRelativeLayout").GetText()); + if (dropCoordinates is not null && dropCoordinates.Value.X > 0 && dropCoordinates.Value.Y > 0) { dragDropSuccess = true; break;