From 8b3dd8c6799dfb945412a033f41502b888d3cf3a Mon Sep 17 00:00:00 2001 From: Anandhan Rajagopal Date: Fri, 8 Nov 2024 19:09:44 +0530 Subject: [PATCH 1/3] enabled UI tests from XamarinUItests into Appium --- .../Issues/XFIssue/Issue2597.cs | 4 +- .../Issues/XFIssue/Issue2681.cs | 3 +- .../TestCases.HostApp/Issues/XFIssue2681.cs | 82 ------------------- .../Tests/Issues/Bugzilla/Bugzilla38978.cs | 23 ++++-- .../Tests/Issues/XFIssue/Issue2597.cs | 28 ++----- .../Tests/Issues/XFIssue/Issue2681.cs | 15 ++-- .../Tests/Issues/XFIssue2681.cs | 27 ------ 7 files changed, 36 insertions(+), 146 deletions(-) delete mode 100644 src/Controls/tests/TestCases.HostApp/Issues/XFIssue2681.cs delete mode 100644 src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue2681.cs diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2597.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2597.cs index 4732a52f8480..72b135b3e5ce 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2597.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2597.cs @@ -22,7 +22,8 @@ protected override void Init() Increment = 0.1, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand, - IsEnabled = false + IsEnabled = false, + AutomationId = "Stepper" }; #pragma warning restore CS0618 // Type or member is obsolete stepper.ValueChanged += OnStepperValueChanged; @@ -33,6 +34,7 @@ protected override void Init() #pragma warning disable CS0612 // Type or member is obsolete _label = new Label { + AutomationId = "StepperValue", Text = "Stepper value is 0", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), HorizontalOptions = LayoutOptions.Center, diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2681.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2681.cs index fd33ce49ede0..b2ccf42d7bf0 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2681.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2681.cs @@ -7,7 +7,7 @@ public class Issue2681 : TestNavigationPage const string NavigateToPage = "Click Me."; protected override void Init() { - PushAsync(new ContentPage() { Title = "Freeze Test", Content = new Button() { Text = NavigateToPage, Command = new Command(() => this.PushAsync(new FreezeMe())) } }); + PushAsync(new ContentPage() { Title = "Freeze Test", Content = new Button() { AutomationId = "NavigateToPage", Text = NavigateToPage, Command = new Command(() => this.PushAsync(new FreezeMe())) } }); } @@ -27,6 +27,7 @@ public FreezeMe() { var label = new Label() { Text = "sassifrass" }; label.SetBinding(Label.TextProperty, "."); + label.SetBinding(AutomationIdProperty, new Binding(".", stringFormat: "{0}")); return new ViewCell() { View = label }; }); diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue2681.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue2681.cs deleted file mode 100644 index bbc8f6c79174..000000000000 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue2681.cs +++ /dev/null @@ -1,82 +0,0 @@ -namespace Maui.Controls.Sample.Issues; - -[Issue(IssueTracker.None, 2681, "[UWP] Label inside Listview gets stuck inside infinite loop", - PlatformAffected.UWP)] - -public class XFIssue2681 : NavigationPage -{ - public XFIssue2681() : base(new TestPage()) - { - } - - public class TestPage : TestContentPage - { - const string NavigateToPage = "Click Me."; - protected override void Init() - { - Content = new Button() - { - Text = NavigateToPage, - AutomationId = "ClickMe", - Command = new Command(async () => await this.Navigation.PushAsync(new FreezeMe())) - }; - } - - public class FreezeMe : ContentPage - { - public List Items { get; set; } - - public FreezeMe() - { - this.BindingContext = this; - var lv = new ListView() - { - Margin = new Thickness(20, 5, 5, 5) - }; - - lv.ItemTemplate = new DataTemplate(() => - { - var label = new Label() { Text = "sassifrass" }; - label.SetBinding(Label.TextProperty, "."); - label.SetBinding(Label.AutomationIdProperty, "."); - return new ViewCell() { View = label }; - }); - - lv.SetBinding(ListView.ItemsSourceProperty, "Items"); - - this.Content = new ScrollView() - { - Content = new StackLayout() - { - Children = - { - new Label(){ Text = "If page is not frozen this test has passed" }, - new StackLayout() - { - Orientation = StackOrientation.Horizontal, - Children = - { - lv - } - }, - new Button(){ - Text = "Go Back", - AutomationId = "GoBack", - Command = new Command(async () => - { - await Navigation.PopAsync(); - }) - } - } - } - }; - - this.Appearing += (s, e) => - { - this.Items = new List { 1, 2, 3 }; - this.OnPropertyChanged("Items"); - }; - } - } - } -} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38978.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38978.cs index 7a7e5d69d2ae..d91c12c799a5 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38978.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38978.cs @@ -12,13 +12,18 @@ public Bugzilla38978(TestDevice testDevice) : base(testDevice) public override string Issue => "Cell.ForceUpdateSize issues with row selection/deselection (ViewCell)"; - // [Test] - // [FailsOnIOSWhenRunningOnXamarinUITest] - // [Category(UITestCategories.ManualReview)] - // public void Bugzilla38978Test () - // { - // App.WaitForElement("2"); - // App.Tap("2"); - // App.Screenshot("If the tapped image is not larger, this test has failed."); - // } + [Test] + [FailsOnIOSWhenRunningOnXamarinUITest] + [Category(UITestCategories.ManualReview)] + public void Bugzilla38978Test() + { + App.WaitForElement("2"); + var beforeRect = App.FindElement("2").GetRect(); + + App.Tap("2"); + var afterRect = App.FindElement("2").GetRect(); + + Assert.That(afterRect.Width, Is.GreaterThan(beforeRect.Width)); + Assert.That(afterRect.Height, Is.GreaterThan(beforeRect.Height)); + } } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2597.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2597.cs index 3b61ee369c36..12723f1fc7d6 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2597.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2597.cs @@ -12,26 +12,16 @@ public Issue2597(TestDevice testDevice) : base(testDevice) public override string Issue => "Stepper control .IsEnabled doesn't work"; - // [Test] - // [Category(UITestCategories.Stepper)] - // [FailsOnIOSWhenRunningOnXamarinUITest] -// public void Issue2597Test() -// { -// #if __IOS__ -// App.Tap(x => x.Marked("Increment")); -// #else -// App.Tap("+"); -// #endif - -// App.WaitForElement(q => q.Marked("Stepper value is 0")); + [Test] + [Category(UITestCategories.Stepper)] + public void Issue2597Test() + { + App.IncreaseStepper("Stepper"); + Assert.That(App.FindElement("StepperValue").GetText(), Is.EqualTo("Stepper value is 0")); -// #if __IOS__ -// App.Tap(x => x.Marked("Decrement")); -// #else -// App.Tap("−"); -// #endif + App.DecreaseStepper("Stepper"); -// App.WaitForElement(q => q.Marked("Stepper value is 0")); -// } + Assert.That(App.FindElement("StepperValue").GetText(), Is.EqualTo("Stepper value is 0")); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2681.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2681.cs index d465604b7290..bf96cf1e783d 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2681.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2681.cs @@ -12,11 +12,12 @@ public Issue2681(TestDevice testDevice) : base(testDevice) public override string Issue => "[UWP] Label inside Listview gets stuck inside infinite loop"; - // [Test] - // [Category(UITestCategories.ListView)] - // public void ListViewDoesntFreezeApp() - // { - // App.Tap(x => x.Marked(NavigateToPage)); - // App.WaitForElement("3"); - // } + [Test] + [Category(UITestCategories.ListView)] + public void ListViewDoesntFreezeApp() + { + App.WaitForElement("NavigateToPage"); + App.Tap("NavigateToPage"); + App.WaitForElement("3"); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue2681.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue2681.cs deleted file mode 100644 index 9eb72fc6d212..000000000000 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue2681.cs +++ /dev/null @@ -1,27 +0,0 @@ -using NUnit.Framework; -using UITest.Appium; -using UITest.Core; - -namespace Microsoft.Maui.TestCases.Tests.Issues -{ - public class XFIssue2681 : _IssuesUITest - { - const string NavigateToPage = "ClickMe"; - - public XFIssue2681(TestDevice device) : base(device) - { - } - - public override string Issue => "[UWP] Label inside Listview gets stuck inside infinite loop"; - - // [Test] - // [Category(UITestCategories.ListView)] - // public void ListViewDoesntFreezeApp() - // { - // App.WaitForElement(NavigateToPage); - // App.Tap(NavigateToPage); - // App.WaitForElement("3"); - // App.Tap("GoBack"); - // } - } -} From 08ae6de2965b091488b38bc62ec360a2d97b240f Mon Sep 17 00:00:00 2001 From: Anandhan Rajagopal Date: Fri, 8 Nov 2024 19:17:30 +0530 Subject: [PATCH 2/3] enabled Issue13390 --- .../TestCases.Shared.Tests/Tests/Issues/Issue13390.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13390.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13390.cs index 735f53280837..664c3354d43c 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13390.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13390.cs @@ -1,7 +1,6 @@ -/* -#if IOS -using NUnit.Framework; +using NUnit.Framework; using UITest.Appium; +using UITest.Core; namespace Microsoft.Maui.TestCases.Tests.Issues { @@ -23,5 +22,3 @@ public void CustomSlideFlyoutTransitionCausesCrash() } } } -#endif -*/ \ No newline at end of file From bdd6481a200d82928ef82a374201095ac17e36e0 Mon Sep 17 00:00:00 2001 From: Anandhan Rajagopal Date: Fri, 8 Nov 2024 19:54:35 +0530 Subject: [PATCH 3/3] Enabled Issue 4356 --- .../Issues/XFIssue/Issue4356.xaml | 6 ++--- .../Tests/Issues/XFIssue/Issue4356.cs | 22 +++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue4356.xaml b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue4356.xaml index 15f2d5d80d3f..0e0fe7c9d31c 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue4356.xaml +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue4356.xaml @@ -2,8 +2,8 @@ -