diff --git a/eng/NuGetVersions.targets b/eng/NuGetVersions.targets index a1377e3bb6b5..6d0ead35f269 100644 --- a/eng/NuGetVersions.targets +++ b/eng/NuGetVersions.targets @@ -305,7 +305,6 @@ Version="$(SystemDrawingCommonPackageVersion)" /> - diff --git a/eng/Versions.props b/eng/Versions.props index 8936679473a4..073f1ec33459 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -131,7 +131,7 @@ 1.3.0 0.9.0 4.2.3 - 8.0.3 + 9.0.0 9.0.0-beta.24572.2 9.0.0-beta.24572.2 9.0.0-beta.24572.2 diff --git a/src/Controls/src/Build.Tasks/Controls.Build.Tasks.csproj b/src/Controls/src/Build.Tasks/Controls.Build.Tasks.csproj index 913661fc3d10..1414b6da49b9 100644 --- a/src/Controls/src/Build.Tasks/Controls.Build.Tasks.csproj +++ b/src/Controls/src/Build.Tasks/Controls.Build.Tasks.csproj @@ -25,10 +25,8 @@ - - diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue1028.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue1028.cs index cf8ffac16203..fc14de1e74ab 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue1028.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue1028.cs @@ -1,7 +1,7 @@ namespace Maui.Controls.Sample.Issues; -[Issue(IssueTracker.Github, 1028, "ViewCell in TableView raises exception - root page is ContentPage, Content is TableView", PlatformAffected.WinPhone, NavigationBehavior.PushModalAsync)] +[Issue(IssueTracker.Github, 1028, "ViewCell in TableView raises exception - root page is ContentPage, Content is TableView", PlatformAffected.WinPhone)] public class Issue1028 : TestContentPage { diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue264.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue264.cs index 95c3e794d4ab..7907a446a779 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue264.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue264.cs @@ -35,7 +35,7 @@ public class AboutPage : ContentPage public AboutPage() { BackgroundColor = Colors.Bisque; - Content = new Button { Text = "Close", Command = new Command(() => Navigation.PopModalAsync()) }; + Content = new Button { Text = "CloseMe", Command = new Command(() => Navigation.PopModalAsync()) }; } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2809.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2809.cs index 6a0f4afd316f..aa64acd6ef99 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2809.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2809.cs @@ -1,16 +1,16 @@ -namespace Maui.Controls.Sample.Issues; - +using Maui.Controls.Sample.Issues; [Issue(IssueTracker.Github, 2809, "Secondary ToolbarItems cause app to hang during PushAsync", PlatformAffected.iOS)] -public class Issue2809 : TestContentPage +public class Issue2809 : TestNavigationPage { protected override void Init() { - ToolbarItems.Add(new ToolbarItem("Item 1", string.Empty, + var contentPage = new ContentPage(); + contentPage.ToolbarItems.Add(new ToolbarItem("Item 1", string.Empty, DummyAction, ToolbarItemOrder.Secondary)); - - ToolbarItems.Add(new ToolbarItem("Item 2", string.Empty, + contentPage.ToolbarItems.Add(new ToolbarItem("Item 2", string.Empty, DummyAction, ToolbarItemOrder.Secondary)); + Navigation.PushAsync(contentPage); } public void DummyAction() diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2883.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2883.cs index 3ef76336765d..9eb6840bb437 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2883.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue2883.cs @@ -92,7 +92,6 @@ protected override void Init() Content = new StackLayout { Orientation = StackOrientation.Vertical, - VerticalOptions = LayoutOptions.Start, Children = { tableview, listview, listview2 } }; } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue8279.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue8279.cs index a3e09fe39676..cc7347794ece 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue8279.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue8279.cs @@ -13,7 +13,7 @@ public class Issue8279 : TestContentPage const string ScrollWithItemWithGroup = "ScrollWithItemWithGroup"; const string ScrollWithNoItemNoGroup = "ScrollWithNoItemNoGroup"; const string ScrollWithNoItemEmptyGroup = "ScrollWithNoItemEmptyGroup"; - const string Reset = "Reset"; + const string ResetButton = "Reset"; protected override void Init() { @@ -97,7 +97,7 @@ public Issue8279() var resetButton = new Button() { Text = "Reset", - AutomationId = Reset, + AutomationId = ResetButton, Command = new Command(() => List.ScrollTo(null, firstGroup, ScrollToPosition.Center, true)) }; @@ -111,13 +111,13 @@ public Issue8279() #pragma warning restore CS0618 // Type or member is obsolete #pragma warning restore CS0618 // Type or member is obsolete - stackLayout.AddLogicalChild(resetButton); - stackLayout.AddLogicalChild(button1); - stackLayout.AddLogicalChild(button2); - stackLayout.AddLogicalChild(button3); - stackLayout.AddLogicalChild(button4); - stackLayout.AddLogicalChild(button5); - stackLayout.AddLogicalChild(List); + stackLayout.Children.Add(resetButton); + stackLayout.Children.Add(button1); + stackLayout.Children.Add(button2); + stackLayout.Children.Add(button3); + stackLayout.Children.Add(button4); + stackLayout.Children.Add(button5); + stackLayout.Children.Add(List); Content = stackLayout; } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue8461.cs b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue8461.cs index bc934042e8d6..b5530ed6ef21 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue8461.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/XFIssue/Issue8461.cs @@ -1,6 +1,6 @@ namespace Maui.Controls.Sample.Issues; -[Issue(IssueTracker.Github, 8461, "[Bug] [iOS] [Shell] \"Nav Stack consistency error\"", PlatformAffected.iOS)] +[Issue(IssueTracker.Github, 8461, "[Bug] [iOS] [Shell] Nav Stack consistency error", PlatformAffected.iOS)] public class Issue8461 : TestShell { const string ButtonId = "PageButtonId"; @@ -28,6 +28,7 @@ protected override void Init() { new Label() { + AutomationId = "InstructionsLabel", Text = "1. Swipe left to dismiss this page, but cancel the gesture before it completes" }, new Label() @@ -55,7 +56,7 @@ protected override void Init() }; // Use this BoxView to anchor our swipe to left of the screen - grid.AddLogicalChild(new BoxView() + grid.Children.Add(new BoxView() { AutomationId = LayoutId, HorizontalOptions = LayoutOptions.FillAndExpand, @@ -66,8 +67,8 @@ protected override void Init() #pragma warning restore CS0618 // Type or member is obsolete #pragma warning restore CS0618 // Type or member is obsolete #pragma warning restore CS0618 // Type or member is obsolete - grid.AddLogicalChild(instructions); + grid.Children.Add(instructions); page2.Content = grid; } -} +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/MauiProgram.cs b/src/Controls/tests/TestCases.HostApp/MauiProgram.cs index aae3247a39cb..237f4b0c6006 100644 --- a/src/Controls/tests/TestCases.HostApp/MauiProgram.cs +++ b/src/Controls/tests/TestCases.HostApp/MauiProgram.cs @@ -11,7 +11,7 @@ public static MauiApp CreateMauiApp() { var appBuilder = MauiApp.CreateBuilder(); -#if IOS || ANDROID +#if IOS || ANDROID || MACCATALYST appBuilder.UseMauiMaps(); #endif appBuilder.UseMauiApp() diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26171.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26171.cs index c14496e7c550..5ff833eb48f9 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26171.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26171.cs @@ -1,4 +1,5 @@ -/*using NUnit.Framework; +#if TEST_FAILS_ON_WINDOWS //Maps control is not supported on Windows platform. +using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -6,11 +7,11 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Bugzilla26171 : _IssuesUITest { - public Bugzilla26171(TestDevice testDevice) : base(testDevice) - { - } + public Bugzilla26171(TestDevice testDevice) : base(testDevice) + { + } - public override string Issue => "Microsoft.Maui.Controls.Maps is not updating VisibleRegion property when layout is changed"; + public override string Issue => "Microsoft.Maui.Controls.Maps is not updating VisibleRegion property when layout is changed"; [Test] [Category(UITestCategories.Maps)] @@ -18,4 +19,5 @@ public void Bugzilla26171Test() { App.WaitForElement("lblValue"); } -}*/ +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30317.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30317.cs index 96ac38f07384..bf81191cf9cc 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30317.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30317.cs @@ -86,4 +86,4 @@ public void Bugzilla30317ItemSourceTabbedPage() } } #endif -*/ +*/ \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue1028.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue1028.cs index 6848e41eedfd..d423fa96f86d 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue1028.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue1028.cs @@ -12,11 +12,11 @@ public Issue1028(TestDevice testDevice) : base(testDevice) public override string Issue => "ViewCell in TableView raises exception - root page is ContentPage, Content is TableView"; - // [Test] - // [Category(UITestCategories.TableView)] - // public void ViewCellInTableViewDoesNotCrash() - // { - // // If we can see this element, then we didn't crash. - // App.WaitForElement("Custom Slider View:"); - // } + [Test] + [Category(UITestCategories.TableView)] + public void ViewCellInTableViewDoesNotCrash() + { + // If we can see this element, then we didn't crash. + App.WaitForElement("Custom Slider View:"); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue12685.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue12685.cs index 5fe7abc2b2d2..db95bb05f706 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue12685.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue12685.cs @@ -6,22 +6,28 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue12685 : _IssuesUITest { + const string StatusLabelId = "StatusLabelId"; + const string ResetStatus = "Path touch event not fired, touch path above."; + const string ClickedStatus = "Path was clicked, click reset button to start over."; public Issue12685(TestDevice testDevice) : base(testDevice) { } public override string Issue => "[iOs][Bug] TapGestureRecognizer in Path does not work on iOS"; - // [Test] - // [Category(UITestCategories.Shape)] - // [FailsOnIOS] - // public void ShapesPathReceiveGestureRecognizers() - // { - // var testLabel = App.WaitForFirstElement(StatusLabelId); - // Assert.AreEqual(ResetStatus, testLabel.ReadText()); - // var testPath = App.WaitForFirstElement(PathId); - // var pathRect = testPath.Rect; - // App.TapCoordinates(pathRect.X + 1, pathRect.Y + 1); - // Assert.AreEqual(ClickedStatus, App.WaitForFirstElement(StatusLabelId).ReadText()); - // } + [Test] + [Category(UITestCategories.Shape)] + public void ShapesPathReceiveGestureRecognizers() + { + var testLabel = App.WaitForFirstElement(StatusLabelId); + Assert.That(testLabel.ReadText(), Is.EqualTo(ResetStatus)); + var labelRect = App.WaitForFirstElement(StatusLabelId).GetRect(); // Path element not able get via automationid so getting the rect of the label calculated points to tap on the path +#if MACCATALYST // TapCoordinates is not working on MacCatalyst Issue: https://github.com/dotnet/maui/issues/19754 + App.ClickCoordinates(labelRect.X + 3, labelRect.Y - 10); +#else + App.TapCoordinates(labelRect.X + 3, labelRect.Y - 10); +#endif + App.WaitForElement(StatusLabelId); + Assert.That(testLabel.ReadText(), Is.EqualTo(ClickedStatus)); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2470.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2470.cs index 04bc0f13742f..a60737a6048f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2470.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2470.cs @@ -6,52 +6,56 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue2470 : _IssuesUITest { +#if ANDROID + const string Generate = "GENERATE"; + const string Results = "RESULTS"; +#else + const string Generate = "Generate"; + const string Results = "Results"; +#endif public Issue2470(TestDevice testDevice) : base(testDevice) { } public override string Issue => "ObservableCollection changes do not update ListView"; - //[Test] - //[Category(UITestCategories.ListView)] - //public void OnservableCollectionChangeListView() - //{ - // // Tab 1 - // App.Tap(q => q.Marked("Switch")); - // App.Screenshot("Switch On"); - // App.Tap(q => q.Marked("Results")); - - // // Tab 2 - // App.WaitForElement(q => q.Marked("Entry 0 of 5")); - // App.WaitForElement(q => q.Marked("Entry 1 of 5")); - // App.WaitForElement(q => q.Marked("Entry 2 of 5")); - // App.WaitForElement(q => q.Marked("Entry 3 of 5")); - // App.WaitForElement(q => q.Marked("Entry 4 of 5")); - // App.Screenshot("Should be 5 elements"); - // App.Tap(q => q.Marked("Generate")); - - // // Tab 1 - // App.Tap(q => q.Marked("Switch")); - // App.Screenshot("Switch Off"); - // App.Tap(q => q.Marked("Results")); - - // // Tab 2 - // App.WaitForElement(q => q.Marked("Entry 0 of 2")); - // App.WaitForElement(q => q.Marked("Entry 1 of 2")); - // App.Screenshot("Should be 2 elements"); - - // // Tab 1 - // App.Tap(q => q.Marked("Generate")); - // App.Tap(q => q.Marked("Switch")); - // App.Screenshot("Switch On"); - // App.Tap(q => q.Marked("Results")); - - // // Tab 2 - // App.WaitForElement(q => q.Marked("Entry 0 of 5")); - // App.WaitForElement(q => q.Marked("Entry 1 of 5")); - // App.WaitForElement(q => q.Marked("Entry 2 of 5")); - // App.WaitForElement(q => q.Marked("Entry 3 of 5")); - // App.WaitForElement(q => q.Marked("Entry 4 of 5")); - // App.Screenshot("Should be 5 elements"); - //} + [Test] + [Category(UITestCategories.ListView)] + public void OnservableCollectionChangeListView() + { + App.WaitForElement("Switch"); + // Tab 1 + App.Tap("Switch"); + App.Tap(Results); + + // Tab 2 + App.WaitForElement("Entry 0 of 5"); + App.WaitForElement("Entry 1 of 5"); + App.WaitForElement("Entry 2 of 5"); + App.WaitForElement("Entry 3 of 5"); + App.WaitForElement("Entry 4 of 5"); + + App.Tap(Generate); + + // Tab 1 + App.Tap("Switch"); + App.Tap(Results); + + // Tab 2 + App.WaitForElement("Entry 0 of 2"); + App.WaitForElement("Entry 1 of 2"); + + + // Tab 1 + App.Tap(Generate); + App.Tap("Switch"); + App.Tap(Results); + + // Tab 2 + App.WaitForElement("Entry 0 of 5"); + App.WaitForElement("Entry 1 of 5"); + App.WaitForElement("Entry 2 of 5"); + App.WaitForElement("Entry 3 of 5"); + App.WaitForElement("Entry 4 of 5"); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue264.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue264.cs index 3380c9005456..92b4f0c27811 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue264.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue264.cs @@ -12,25 +12,21 @@ public Issue264(TestDevice testDevice) : base(testDevice) public override string Issue => "PopModal NRE"; - // [Test] - // [Category(UITestCategories.DisplayAlert)] - // [FailsOnIOS] - // public void Issue264TestsPushAndPopModal() - // { - // App.WaitForElement(q => q.Marked("Home")); - // App.WaitForElement(q => q.Button("About")); - // App.Screenshot("All elements present"); + [Test] + [Category(UITestCategories.Navigation)] + public void Issue264TestsPushAndPopModal() + { + App.WaitForElement("Home"); + App.WaitForElement("About"); - // App.Tap(q => q.Button("About")); - // App.WaitForElement(q => q.Button("Close")); - // App.Screenshot("Modal pushed"); + App.Tap("About"); + App.WaitForElement("CloseMe"); - // App.Tap(q => q.Button("Close")); - // App.WaitForElement(q => q.Button("About")); - // App.Screenshot("Modal popped"); + App.Tap("CloseMe"); + App.WaitForElement("About"); - // App.Tap(q => q.Button("Pop me")); - // App.WaitForElement(q => q.Marked("Bug Repro's")); - // App.Screenshot("No crash"); - // } + // Due to the current architecture of the HostApp, we cannot navigate back to the Bug Repro's page. + // App.Tap("Pop me"); + // App.WaitForElement("Bug Repro's"); + } } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2767.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2767.cs index 0c18a84ce664..e2b60a52474d 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2767.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2767.cs @@ -12,12 +12,12 @@ public Issue2767(TestDevice testDevice) : base(testDevice) public override string Issue => "ArgumentException: NaN not valid for height"; - // [Test] - // [Category(UITestCategories.Grid)] - // [FailsOnIOS] - // public void Issue2767Test() - // { - // App.WaitForElement("Label 1:1"); - // Assert.IsEmpty(App.Query("Collapsed")); - // } + [Test] + [Category(UITestCategories.Layout)] + + public void Issue2767Test() + { + App.WaitForElement("Label 1:1"); + Assert.That(App.FindElements("Collapsed").Count, Is.EqualTo(0)); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2809.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2809.cs index bab004b53201..c5d277c6e097 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2809.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2809.cs @@ -12,23 +12,11 @@ public Issue2809(TestDevice testDevice) : base(testDevice) public override string Issue => "Secondary ToolbarItems cause app to hang during PushAsync"; - // [Test] - // [Category(UITestCategories.DisplayAlert)] - // [FailsOnIOS] - // public void TestPageDoesntCrash() - // { - // ShouldShowMenu(); - // App.Tap(c => c.Marked("Item 1")); - // App.Screenshot("Didn't crash"); - // } - - // void ShouldShowMenu() - // { - // #if ANDROID - // //show secondary menu - // App.TapOverflowMenuButton(); - // #elif WINDOWS - // App.Tap ("MoreButton"); - // #endif - // } + [Test] + [Category(UITestCategories.ToolbarItem)] + public void TestPageDoesntCrash() + { + App.TapMoreButton(); + App.Tap("Item 1"); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2883.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2883.cs index 812ae4db7847..4178feb16a6a 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2883.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2883.cs @@ -13,30 +13,37 @@ public Issue2883(TestDevice testDevice) : base(testDevice) public override string Issue => "ViewCell IsEnabled set to false does not disable a cell in a TableView"; - // [UITests.FailsOnIOSWhenRunningOnXamarinUITest] - // [Test] - // public void Issue2883TestDisabled () - // { - // App.Screenshot ("I am at Issue 2883"); - // App.Tap( c=> c.Marked("btnCustomCellTable")); - // App.WaitForNoElement( c=> c.Marked("Clicked")); - // App.Screenshot ("I dont see the disable cell"); - // App.Tap( c=> c.Marked("btnCustomCellListView")); - // App.WaitForNoElement( c=> c.Marked("Clicked")); - // App.Screenshot ("I dont see the disable cell"); - // } - - // [UITests.FailsOnIOSWhenRunningOnXamarinUITest] - // [Test] - // public void Issue2883TestEnabled () - // { - - // App.Tap( c=> c.Marked("btnCustomCellTableEnabled")); - // App.Screenshot ("I see the cell that is enabled"); - // App.WaitForElement( c=> c.Marked("Clicked")); - // App.Tap (c => c.Marked ("ok")); - // App.Tap( c=> c.Marked("btnCustomCellListViewEnabled")); - // App.WaitForElement( c=> c.Marked("Clicked")); - // App.Tap (c => c.Marked ("ok")); - // } + [Test] + public void Issue2883TestDisabled() + { + App.WaitForElement("btnCustomCellTable"); + App.Tap("btnCustomCellTable"); + App.WaitForNoElement("Clicked"); + + App.Tap("btnCustomCellListView"); + App.WaitForNoElement("Clicked"); + + } + + + [Test] + public void Issue2883TestEnabled() + { + App.WaitForElement("btnCustomCellTableEnabled"); + App.Tap("btnCustomCellTableEnabled"); + App.WaitForElement("Clicked"); +#if MACCATALYST // Unable to tap the ok button on the display alert using text. so here using the identifier for Mac. + App.Tap(AppiumQuery.ById("action-button--999")); +#else + App.Tap("ok"); +#endif + App.WaitForElement("btnCustomCellListViewEnabled"); + App.Tap("btnCustomCellListViewEnabled"); + App.WaitForElement("Clicked"); +#if MACCATALYST + App.Tap(AppiumQuery.ById("action-button--999")); +#else + App.Tap("ok"); +#endif + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2894.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2894.cs index dfb0616032d3..d0c37a352b76 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2894.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2894.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using System.Drawing; +using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -6,68 +7,62 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue2894 : _IssuesUITest { + const string kGesture1 = "Sentence 1: "; + const string kGesture2 = "Sentence 2: "; + const string kLabelAutomationId = "kLabelAutomationId"; + public Issue2894(TestDevice testDevice) : base(testDevice) { } public override string Issue => "Gesture Recognizers added to Span after it's been set to FormattedText don't work and can cause an NRE"; - // [FailsOnAndroid] - // [FailsOnIOS] - // [Test] - // [Category(UITestCategories.Gestures)] - // public void VariousSpanGesturePermutation() - // { - // App.WaitForElement($"{kGesture1}0"); - // App.WaitForElement($"{kGesture2}0"); - // var labelId = App.WaitForElement(kLabelAutomationId); - // var target = labelId.First().Rect; - - - // for (int i = 1; i < 5; i++) - // { - // App.Tap($"TestSpan{i}"); - - // // These tap retries work around a Tap Coordinate bug - // // with Xamarin.UITest >= 3.0.7 - // int tapAttempts = 0; - // do - // { - // App.TapCoordinates(target.X + 5, target.Y + 5); - // if (tapAttempts == 4) - // App.WaitForElement($"{kGesture1}{i}"); - - // tapAttempts++; - // } while (App.Query($"{kGesture1}{i}").Length == 0); - - // tapAttempts = 0; - - // do - // { - // #if WINDOWS - // App.TapCoordinates(target.X + target.Width - 10, target.Y + 2); - // #else - // App.TapCoordinates(target.X + target.CenterX, target.Y + 2); - // #endif - // if (tapAttempts == 4) - // App.WaitForElement($"{kGesture1}{i}"); - - // tapAttempts++; - - // } while (App.Query($"{kGesture2}{i}").Length == 0); - // } + [Test] + [Category(UITestCategories.Gestures)] + public void VariousSpanGesturePermutation() + { + App.WaitForElement($"{kGesture1}0"); + App.WaitForElement($"{kGesture2}0"); + var labelId = App.WaitForElement(kLabelAutomationId); + var target = labelId.GetRect(); + + for (int i = 1; i < 5; i++) + { + App.Tap($"TestSpan{i}"); + App.WaitForElement($"{kGesture1}{i-1}"); + App.WaitForElement(kLabelAutomationId); + PerformGestureActionForFirstSpan(target); + PerformGestureActionForSecondSpan(target); + } + + App.Tap($"TestSpan5"); + PerformGestureActionForFirstSpan(target); + PerformGestureActionForSecondSpan(target); + App.WaitForElement($"{kGesture1}4"); + App.WaitForElement($"{kGesture2}4"); + } + void PerformGestureAction(float x, float y) + { +#if MACCATALYST // TapCoordinates is not working on MacCatalyst Issue: https://github.com/dotnet/maui/issues/19754 + App.ClickCoordinates(x, y); +#else + App.TapCoordinates(x, y); +#endif + } - // App.Tap($"TestSpan5"); - // App.TapCoordinates(target.X + 5, target.Y + 5); + void PerformGestureActionForFirstSpan(Rectangle target) + { + PerformGestureAction(target.X + 5, target.Y + 5); + } - // #if WINDOWS - // App.TapCoordinates(target.X + target.Width - 10, target.Y + 2); - // #else - // App.TapCoordinates(target.X + target.CenterX, target.Y + 2); - // #endif + void PerformGestureActionForSecondSpan(Rectangle target) + { +#if ANDROID // Calculate points vary on Android and other platforms. + App.TapCoordinates(target.X + target.Width /2, target.Y + 2); +#else + PerformGestureAction(target.X + target.Width - 10, target.Y + 2); +#endif - // App.WaitForElement($"{kGesture1}4"); - // App.WaitForElement($"{kGesture2}4"); - // } + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2927.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2927.cs index 6a5d22fbf519..512ea65a4a94 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2927.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue2927.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +#if TEST_FAILS_ON_WINDOWS // Text is not rendered on windows. Issue - https://github.com/dotnet/maui/issues/22731 +using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -12,24 +13,23 @@ public Issue2927(TestDevice testDevice) : base(testDevice) public override string Issue => "ListView item tapped not firing multiple times"; - // [Test] - // [Category(UITestCategories.ListView)] - // [FailsOnIOS] - // public void Issue2927Test() - // { - // App.Screenshot("I am at Issue 2927"); - // App.WaitForElement(q => q.Marked("Cell1 0")); - // App.Tap(q => q.Marked("Cell1 0")); - // App.WaitForElement(q => q.Marked("Cell1 1")); - // App.Screenshot("Tapped Once"); - // App.Tap(q => q.Marked("Cell1 1")); - // App.WaitForElement(q => q.Marked("Cell1 2")); - // App.Screenshot("Tapped Twice"); - // App.Tap(q => q.Marked("Cell3 0")); - // App.WaitForElement(q => q.Marked("Cell3 1")); - // App.Screenshot("Click other cell"); - // App.Tap(q => q.Marked("Cell1 2")); - // App.WaitForElement(q => q.Marked("Cell1 3")); - // App.Screenshot("Click first cell again"); - // } -} \ No newline at end of file + [Test] + [Category(UITestCategories.ListView)] + public void Issue2927Test() + { + + App.WaitForElement("Cell1 0"); + App.Tap("Cell1 0"); + App.WaitForElement("Cell1 1"); + + App.Tap("Cell1 1"); + App.WaitForElement("Cell1 2"); + + App.Tap("Cell3 0"); + App.WaitForElement("Cell3 1"); + + App.Tap("Cell1 2"); + App.WaitForElement("Cell1 3"); + } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8279.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8279.cs index 2a08dcdfaa73..4947ab570083 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8279.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8279.cs @@ -10,61 +10,66 @@ public class Issue8279 : _IssuesUITest public Issue8279(TestDevice testDevice) : base(testDevice) { } - + const string ScrollWithNoItemButGroup = "ScrollWithNoItemButGroup"; + const string ScrollWithItemButNoGroup = "ScrollWithItemButNoGroup"; + const string ScrollWithItemWithGroup = "ScrollWithItemWithGroup"; + const string ScrollWithNoItemNoGroup = "ScrollWithNoItemNoGroup"; + const string ScrollWithNoItemEmptyGroup = "ScrollWithNoItemEmptyGroup"; + const string ResetButton = "Reset"; public override string Issue => "[Feature requested] ListView do not ScrollTo a group when there is no child of this group"; - //[Test] - //public void ScrollWithNoItemButGroupTest() - //{ - // App.WaitForElement(Reset); - // App.Tap(Reset); - // App.WaitForElement(ScrollWithNoItemButGroup); - // App.Tap(ScrollWithNoItemButGroup); - // // This will fail if the list didn't scroll. If it did scroll, it will succeed - // App.WaitForElement(q => q.Marked("Header 3"), timeout: TimeSpan.FromSeconds(2)); - //} + [Test] + public void AScrollWithNoItemButGroupTest() + { + App.WaitForElement(ResetButton); + App.Tap(ResetButton); + App.WaitForElement(ScrollWithNoItemButGroup); + App.Tap(ScrollWithNoItemButGroup); + // This will fail if the list didn't scroll. If it did scroll, it will succeed + App.WaitForElement("Header 3"); + } - //[Test] - //public void ScrollWithItemButNoGroupTest() - //{ - // App.WaitForElement(Reset); - // App.Tap(Reset); - // App.WaitForElement(ScrollWithItemButNoGroup); - // App.Tap(ScrollWithItemButNoGroup); - // // This will fail if the list didn't scroll. If it did scroll, it will succeed - // App.WaitForElement(q => q.Marked("title 1"), timeout: TimeSpan.FromSeconds(2)); - //} + [Test] + public void BScrollWithItemButNoGroupTest() + { + App.WaitForElement(ResetButton); + App.Tap(ResetButton); + App.WaitForElement(ScrollWithItemButNoGroup); + App.Tap(ScrollWithItemButNoGroup); + // This will fail if the list didn't scroll. If it did scroll, it will succeed + App.WaitForElement("title 1"); + } - //[Test] - //public void ScrollWithItemWithGroupTest() - //{ - // App.WaitForElement(Reset); - // App.Tap(Reset); - // App.WaitForElement(ScrollWithItemWithGroup); - // App.Tap(ScrollWithItemWithGroup); - // // This will fail if the list didn't scroll. If it did scroll, it will succeed - // App.WaitForElement(q => q.Marked("Header 3"), timeout: TimeSpan.FromSeconds(2)); - //} + [Test] + public void CScrollWithItemWithGroupTest() + { + App.WaitForElement(ResetButton); + App.Tap(ResetButton); + App.WaitForElement(ScrollWithItemWithGroup); + App.Tap(ScrollWithItemWithGroup); + // This will fail if the list didn't scroll. If it did scroll, it will succeed + App.WaitForElement("Header 3"); + } - //[Test] - //public void ScrollWithNoItemNoGroupTest() - //{ - // App.WaitForElement(Reset); - // App.Tap(Reset); - // App.WaitForElement(ScrollWithNoItemNoGroup); - // App.Tap(ScrollWithNoItemNoGroup); - // // This will pass if the list didn't scroll and remain on the same state - // App.WaitForElement(q => q.Marked("Header 1"), timeout: TimeSpan.FromSeconds(2)); - //} + [Test] + public void DScrollWithNoItemNoGroupTest() + { + App.WaitForElement(ResetButton); + App.Tap(ResetButton); + App.WaitForElement(ScrollWithNoItemNoGroup); + App.Tap(ScrollWithNoItemNoGroup); + // This will pass if the list didn't scroll and remain on the same state + App.WaitForElement("Header 1"); + } - //[Test] - //public void ScrollWithNoItemEmptyGroupTest() - //{ - // App.WaitForElement(Reset); - // App.Tap(Reset); - // App.WaitForElement(ScrollWithNoItemEmptyGroup); - // App.Tap(ScrollWithNoItemEmptyGroup); - // // This will fail if the list didn't scroll. If it did scroll, it will succeed - // App.WaitForElement(q => q.Marked("Header 2"), timeout: TimeSpan.FromSeconds(2)); - //} + [Test] + public void EScrollWithNoItemEmptyGroupTest() + { + App.WaitForElement(ResetButton); + App.Tap(ResetButton); + App.WaitForElement(ScrollWithNoItemEmptyGroup); + App.Tap(ScrollWithNoItemEmptyGroup); + // This will fail if the list didn't scroll. If it did scroll, it will succeed + App.WaitForElement("Header 2"); + } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8291.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8291.cs index da5388098c01..692869a48a50 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8291.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8291.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +#if TEST_FAILS_ON_CATALYST // TouchAndHold not supported on Mac, Also using LongPress is not applicable on this case, while LongPress does not open the context menu for Entry/Editor control. +using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -12,31 +13,34 @@ public Issue8291(TestDevice testDevice) : base(testDevice) public override string Issue => "[Android] Editor - Text selection menu does not appear when selecting text on an editor placed within a ScrollView"; - //[Test] - //[Category(UITestCategories.Editor)] - //[FailsOnAndroidWhenRunningOnXamarinUITest] - //public void ContextMenuShowsUpWhenPressAndHoldTextOnEditorAndEntryField() - //{ - // App.TouchAndHold("PressEditor"); - // TestForPopup(); - // App.Tap("PressEntry"); - // App.TouchAndHold("PressEntry"); - // TestForPopup(); - //} - - //void TestForPopup() - //{ - // var result = App.QueryUntilPresent(() => - // { - // return App.Query("Paste") - // .Union(App.Query("Share")) - // .Union(App.Query("Copy")) - // .Union(App.Query("Cut")) - // .Union(App.Query("Select All")) - // .ToArray(); - // }); - - // Assert.IsNotNull(result); - // Assert.IsTrue(result.Length > 0); - //} -} \ No newline at end of file + [Test] + [Category(UITestCategories.Editor)] + public void ContextMenuShowsUpWhenPressAndHoldTextOnEditorAndEntryField() + { + App.WaitForElement("PressEditor"); + App.TouchAndHold("PressEditor"); + + TestForPopup(); + App.Tap("PressEntry"); + + App.TouchAndHold("PressEditor"); + TestForPopup(); + } + + void TestForPopup() + { + var result = App.QueryUntilPresent(() => + { + return "Paste" + .Union("Share") + .Union("Copy") + .Union("Cut") + .Union("Select All") + .ToArray(); + }); + + Assert.That(result, Is.Not.Null); + Assert.That(result.Length, Is.GreaterThan(0)); + } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8461.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8461.cs index 4f8db8da603e..71a69ed62348 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8461.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue/Issue8461.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +#if TEST_FAILS_ON_CATALYST // Using SwipeLeftToRight leads to exception of type 'OpenQA.Selenium.WebDriverException'. "Only pointer type 'mouse' is supported. +using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -6,30 +7,43 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; public class Issue8461 : _IssuesUITest { + const string ButtonId = "PageButtonId"; + const string LayoutId = "LayoutId"; + const string InstructionsLabel = "InstructionsLabel"; + public Issue8461(TestDevice testDevice) : base(testDevice) { } - public override string Issue => "[Bug] [iOS] [Shell] \"Nav Stack consistency error\""; - - //[Test] - //[Category(UITestCategories.Navigation)] - //[FailsOnIOS] - //public void ShellSwipeToDismiss() - //{ - // var pushButton = App.WaitForElement(ButtonId); - // Assert.AreEqual(1, pushButton.Length); - - // App.Tap(ButtonId); - - // var page2Layout = App.WaitForElement(LayoutId); - // Assert.AreEqual(1, page2Layout.Length); - // // Swipe in from left across 1/2 of screen width - // App.SwipeLeftToRight(LayoutId, 0.99, 500, false); - // // Swipe in from left across full screen width - // App.SwipeLeftToRight(0.99, 500); - - // pushButton = App.WaitForElement(ButtonId); - // Assert.AreEqual(1, pushButton.Length); - //} -} \ No newline at end of file + public override string Issue => "[Bug] [iOS] [Shell] Nav Stack consistency error"; + + [Test] + [Category(UITestCategories.Navigation)] + + public void ShellSwipeToDismiss() + { + App.WaitForElement(ButtonId); + Assert.That(App.FindElements(ButtonId).Count, Is.EqualTo(1)); + + App.Tap(ButtonId); + + App.WaitForElement(InstructionsLabel); + Assert.That(App.FindElements(InstructionsLabel).Count, Is.EqualTo(1)); + + // Swipe in from left across 1/2 of screen width + App.SwipeLeftToRight(LayoutId, 0.99, 500, false); + // Swipe in from left across full screen width + App.SwipeLeftToRight(LayoutId); + + // On Android, swiping causes flyout items to overlap with the back arrow. + // Touch actions may need to be performed twice to work around this issue. +#if ANDROID + App.TapBackArrow(); +#endif + App.TapBackArrow(); + + App.WaitForElement(ButtonId); + Assert.That(App.FindElements(ButtonId).Count, Is.EqualTo(1)); + } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj b/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj index 69cfcd990229..9368246ae140 100644 --- a/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj +++ b/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj @@ -25,10 +25,8 @@ - - diff --git a/src/SingleProject/Resizetizer/src/Resizetizer.csproj b/src/SingleProject/Resizetizer/src/Resizetizer.csproj index 28a5b6e087ee..9de6ae047ec7 100644 --- a/src/SingleProject/Resizetizer/src/Resizetizer.csproj +++ b/src/SingleProject/Resizetizer/src/Resizetizer.csproj @@ -25,10 +25,8 @@ - - diff --git a/src/TestUtils/src/UITest.Appium/Actions/AppiumMouseActions.cs b/src/TestUtils/src/UITest.Appium/Actions/AppiumMouseActions.cs index 086fdcb7ac2f..b98c7706dbce 100644 --- a/src/TestUtils/src/UITest.Appium/Actions/AppiumMouseActions.cs +++ b/src/TestUtils/src/UITest.Appium/Actions/AppiumMouseActions.cs @@ -192,7 +192,7 @@ CommandResponse LongPress(IDictionary parameters) OpenQA.Selenium.Appium.Interactions.PointerInputDevice touchDevice = new OpenQA.Selenium.Appium.Interactions.PointerInputDevice(PointerKind.Mouse); var longPress = new ActionSequence(touchDevice, 0); - longPress.AddAction(touchDevice.CreatePointerMove(element, 0, 0, TimeSpan.FromMilliseconds(0))); + longPress.AddAction(touchDevice.CreatePointerMove(element, 0, 0, TimeSpan.FromMilliseconds(5))); longPress.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact)); longPress.AddAction(touchDevice.CreatePointerMove(element, 0, 0, TimeSpan.FromMilliseconds(2000))); longPress.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact)); diff --git a/src/TestUtils/src/UITest.Appium/HelperExtensions.cs b/src/TestUtils/src/UITest.Appium/HelperExtensions.cs index 342587ebb272..a7d398461de5 100644 --- a/src/TestUtils/src/UITest.Appium/HelperExtensions.cs +++ b/src/TestUtils/src/UITest.Appium/HelperExtensions.cs @@ -2018,6 +2018,22 @@ public static void TapInShellFlyout(this IApp app, string flyoutItem) public static void TapInFlyoutPageFlyout(this IApp app, string flyoutItem) { app.TapInFlyout(flyoutItem, false); + } + + /// Taps the "More" button in the app, with platform-specific logic for Android and Windows. + /// This method does not currently support iOS and macOS platforms, where the "More" button is not shown. + /// + /// Represents the main gateway to interact with an app. + public static void TapMoreButton(this IApp app) + { + if (app is AppiumAndroidApp) + { + app.Tap(AppiumQuery.ByXPath("//android.widget.ImageView[@content-desc=\"More options\"]")); + } + else if (app is AppiumWindowsApp) + { + app.Tap(AppiumQuery.ByAccessibilityId("MoreButton")); + } } static IUIElement Wait(Func query,