From b8da8c2f45ff4bf529b4a6ce9e2060e22f68fff0 Mon Sep 17 00:00:00 2001 From: Vally Fixture Date: Tue, 4 Aug 2026 00:57:56 +0200 Subject: [PATCH 1/2] Stabilize initial parent-child SafeArea layout check Retry the initial geometry assertions while iOS finishes laying out the issue page instead of accepting a transient off-screen rect. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9be49656-7117-4235-9d96-404779ab6b16 --- .../Issues/Issue28986_ParentChildTest.cs | 60 +++++++++---------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28986_ParentChildTest.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28986_ParentChildTest.cs index 4b9997fc215d..1dfe7ba3f964 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28986_ParentChildTest.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28986_ParentChildTest.cs @@ -46,43 +46,37 @@ public void VerifyInitialStateParentTopChildBottom() // 2. Bottom indicator is inset from screen bottom by safe area (child handles bottom) // 3. Both work independently without conflict - // Get screen dimensions - var parentGridRect = App.WaitForElement("ParentGrid").GetRect(); - var screenTop = parentGridRect.Y; - var screenBottom = parentGridRect.Y + parentGridRect.Height; - // Verify initial status WaitForText("StatusLabel", "Parent: Top=Container, Bottom=None | Child: Bottom=Container"); - // Measure top indicator position - var topIndicatorRect = App.WaitForElement("TopIndicator").GetRect(); - var topIndicatorTop = topIndicatorRect.Y; - - // Top indicator should be below the screen top (safe area applied) - var topInsetFromScreenTop = topIndicatorTop - screenTop; - Assert.That(topInsetFromScreenTop, Is.GreaterThan(5), - $"Top indicator should be inset from screen top by safe area. " + - $"Current inset: {topInsetFromScreenTop}pt (expected >5pt)"); - - // Measure bottom indicator position - var bottomIndicatorRect = App.WaitForElement("BottomIndicator").GetRect(); - var bottomIndicatorBottom = bottomIndicatorRect.Y + bottomIndicatorRect.Height; - - // Bottom indicator should be above the screen bottom (safe area applied) - var bottomInsetFromScreenBottom = screenBottom - bottomIndicatorBottom; - // On devices with bottom safe area (iOS home indicator, Android nav bar), verify meaningful inset. - // On gesture-nav Android devices, bottom safe area is correctly 0. - if (HasBottomSafeArea(bottomInsetFromScreenBottom)) - { - Assert.That(bottomInsetFromScreenBottom, Is.GreaterThan(5), - $"Bottom indicator should be inset from screen bottom by safe area. " + - $"Current inset: {bottomInsetFromScreenBottom}pt (expected >5pt)"); - } - else + App.RetryAssert(() => { - Assert.That(bottomInsetFromScreenBottom, Is.GreaterThanOrEqualTo(0), - $"Bottom indicator should not extend below screen bottom. Inset: {bottomInsetFromScreenBottom}pt"); - } + var parentGridRect = App.WaitForElement("ParentGrid").GetRect(); + var screenTop = parentGridRect.Y; + var screenBottom = parentGridRect.Y + parentGridRect.Height; + + var topIndicatorRect = App.WaitForElement("TopIndicator").GetRect(); + var topInsetFromScreenTop = topIndicatorRect.Y - screenTop; + Assert.That(topInsetFromScreenTop, Is.GreaterThan(5), + $"Top indicator should be inset from screen top by safe area. " + + $"Current inset: {topInsetFromScreenTop}pt (expected >5pt)"); + + var bottomIndicatorRect = App.WaitForElement("BottomIndicator").GetRect(); + var bottomIndicatorBottom = bottomIndicatorRect.Y + bottomIndicatorRect.Height; + var bottomInsetFromScreenBottom = screenBottom - bottomIndicatorBottom; + + if (HasBottomSafeArea(bottomInsetFromScreenBottom)) + { + Assert.That(bottomInsetFromScreenBottom, Is.GreaterThan(5), + $"Bottom indicator should be inset from screen bottom by safe area. " + + $"Current inset: {bottomInsetFromScreenBottom}pt (expected >5pt)"); + } + else + { + Assert.That(bottomInsetFromScreenBottom, Is.GreaterThanOrEqualTo(0), + $"Bottom indicator should not extend below screen bottom. Inset: {bottomInsetFromScreenBottom}pt"); + } + }); } [Test, Order(2)] From 53cdbd7e5e7ad8982154cf19c58b1448ba27784d Mon Sep 17 00:00:00 2001 From: Vally Fixture Date: Tue, 4 Aug 2026 01:36:45 +0200 Subject: [PATCH 2/2] Avoid nested waits in SafeArea layout retry Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9be49656-7117-4235-9d96-404779ab6b16 --- .../Tests/Issues/Issue28986_ParentChildTest.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28986_ParentChildTest.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28986_ParentChildTest.cs index 1dfe7ba3f964..b21ef5ba592f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28986_ParentChildTest.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue28986_ParentChildTest.cs @@ -51,17 +51,17 @@ public void VerifyInitialStateParentTopChildBottom() App.RetryAssert(() => { - var parentGridRect = App.WaitForElement("ParentGrid").GetRect(); + var parentGridRect = App.FindElement("ParentGrid").GetRect(); var screenTop = parentGridRect.Y; var screenBottom = parentGridRect.Y + parentGridRect.Height; - var topIndicatorRect = App.WaitForElement("TopIndicator").GetRect(); + var topIndicatorRect = App.FindElement("TopIndicator").GetRect(); var topInsetFromScreenTop = topIndicatorRect.Y - screenTop; Assert.That(topInsetFromScreenTop, Is.GreaterThan(5), $"Top indicator should be inset from screen top by safe area. " + $"Current inset: {topInsetFromScreenTop}pt (expected >5pt)"); - var bottomIndicatorRect = App.WaitForElement("BottomIndicator").GetRect(); + var bottomIndicatorRect = App.FindElement("BottomIndicator").GetRect(); var bottomIndicatorBottom = bottomIndicatorRect.Y + bottomIndicatorRect.Height; var bottomInsetFromScreenBottom = screenBottom - bottomIndicatorBottom;