From d04b0ef411ab1db07c6896ef3387a130befb2c23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Sua=CC=81rez=20Ruiz?= Date: Wed, 3 Feb 2021 13:52:54 +0100 Subject: [PATCH 1/3] Fix ShapesPathReceiveGestureRecognizers --- .../Issue12685.cs | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue12685.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue12685.cs index 956160f9d2f..8d0d621f2cc 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue12685.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue12685.cs @@ -1,7 +1,4 @@ -using System; -using System.ComponentModel; -using System.Windows.Input; -using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.CustomAttributes; using Xamarin.Forms.Internals; using Xamarin.Forms.Shapes; @@ -21,6 +18,9 @@ namespace Xamarin.Forms.Controls.Issues #endif public partial class Issue12685 : TestContentPage { + const string StatusLabelId = "StatusLabelId"; + const string PathId = "PathId"; + const string ResetStatus = "Path touch event not fired, touch path above."; const string ClickedStatus = "Path was clicked, click reset button to start over."; @@ -29,7 +29,7 @@ protected override void Init() var layout = new StackLayout(); var statusLabel = new Label { - AutomationId = "LabelValue", + AutomationId = StatusLabelId, Text = ResetStatus, }; @@ -42,6 +42,7 @@ protected override void Init() var path = new Path { + AutomationId = PathId, Data = pathGeometry, Fill = lgb }; @@ -69,11 +70,12 @@ protected override void Init() [Test] public void ShapesPathReceiveGestureRecognizers() { - var testLabel = RunningApp.WaitForFirstElement("LabelValue"); + var testLabel = RunningApp.WaitForFirstElement(StatusLabelId); Assert.AreEqual(ResetStatus, testLabel.ReadText()); - var pathRect = testLabel.Rect; - RunningApp.TapCoordinates(pathRect.X + 100, pathRect.Y-100); - Assert.AreEqual(ClickedStatus, RunningApp.WaitForFirstElement("LabelValue").ReadText()); + var testPath = RunningApp.WaitForFirstElement(PathId); + var pathRect = testPath.Rect; + RunningApp.TapCoordinates(pathRect.X + 1, pathRect.Y + 1); + Assert.AreEqual(ClickedStatus, RunningApp.WaitForFirstElement(StatusLabelId).ReadText()); } #endif } From 93524efd996d7dfcde8be3a49271f5d48d7e592c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Sua=CC=81rez=20Ruiz?= Date: Wed, 3 Feb 2021 16:32:40 +0100 Subject: [PATCH 2/3] Avoid execute Bugzilla43161Test in iOS 14 --- .../Bugzilla43161.cs | 6 +++++- .../Utilities/AppExtensions.cs | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs index 7218c4e1ff9..014480fd51d 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs @@ -56,10 +56,14 @@ protected override void Init() Content = new StackLayout { Children = { label, listView, listView2, listView3 } }; } -#if (UITEST && __IOS__) +#if UITEST && __IOS__ [Test] public void Bugzilla43161Test() { + // Avoid launch the test (temporarily) in iOS 14 due to a bug sometimes not rendering some cell. + if (RunningApp.IsVersionOrNewer(14)) + return; + RunningApp.WaitForElement(q => q.Marked("0")); RunningApp.WaitForElement(q => q.Marked("10")); RunningApp.WaitForElement(q => q.Marked("20")); diff --git a/Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs b/Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs index a8488d26cfb..ad78ca1d77f 100644 --- a/Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs +++ b/Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs @@ -78,6 +78,16 @@ public static bool IsApiHigherThan(this IApp app, int apiLevel, string apiLabelI return true; } +#if __IOS__ + public static bool IsVersionOrNewer(this IApp app, int version) + { + if (app is iOSApp iOSApp) + return iOSApp.Device.OSVersion.Major >= version; + + return true; + } +#endif + public static void TapOverflowMenuButton(this IApp app) { #if __ANDROID__ From 0add5e2bf77796037c65ff70e06b50cc75688ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Sua=CC=81rez=20Ruiz?= Date: Fri, 5 Feb 2021 13:48:48 +0100 Subject: [PATCH 3/3] Not ignore Bugzilla43161 test --- .../Bugzilla43161.cs | 6 +----- .../Utilities/AppExtensions.cs | 10 ---------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs index 014480fd51d..c651cc0afd0 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla43161.cs @@ -60,14 +60,10 @@ protected override void Init() [Test] public void Bugzilla43161Test() { - // Avoid launch the test (temporarily) in iOS 14 due to a bug sometimes not rendering some cell. - if (RunningApp.IsVersionOrNewer(14)) - return; - RunningApp.WaitForElement(q => q.Marked("0")); RunningApp.WaitForElement(q => q.Marked("10")); RunningApp.WaitForElement(q => q.Marked("20")); } #endif } -} +} \ No newline at end of file diff --git a/Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs b/Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs index ad78ca1d77f..a8488d26cfb 100644 --- a/Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs +++ b/Xamarin.Forms.Core.UITests.Shared/Utilities/AppExtensions.cs @@ -78,16 +78,6 @@ public static bool IsApiHigherThan(this IApp app, int apiLevel, string apiLabelI return true; } -#if __IOS__ - public static bool IsVersionOrNewer(this IApp app, int version) - { - if (app is iOSApp iOSApp) - return iOSApp.Device.OSVersion.Major >= version; - - return true; - } -#endif - public static void TapOverflowMenuButton(this IApp app) { #if __ANDROID__