From 99954078350f398aa308fcd6240db88d824bbf62 Mon Sep 17 00:00:00 2001 From: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com> Date: Wed, 24 Dec 2025 11:42:12 +0530 Subject: [PATCH 1/6] fix added --- src/Core/src/Handlers/Picker/PickerHandler.Android.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Core/src/Handlers/Picker/PickerHandler.Android.cs b/src/Core/src/Handlers/Picker/PickerHandler.Android.cs index 66a54812a6d0c..bdb4d1bdad84e 100644 --- a/src/Core/src/Handlers/Picker/PickerHandler.Android.cs +++ b/src/Core/src/Handlers/Picker/PickerHandler.Android.cs @@ -203,6 +203,7 @@ void OnDialogDismiss(object? sender, EventArgs e) _dialog.DismissEvent -= OnDialogDismiss; VirtualView.IsFocused = false; + VirtualView.IsOpen = false; _dialog = null; } From 9f8c1d844036f039baf5a2bf7df27d037466d0f6 Mon Sep 17 00:00:00 2001 From: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com> Date: Mon, 29 Dec 2025 13:03:30 +0530 Subject: [PATCH 2/6] test case added --- .../TestCases.HostApp/Issues/Issue99999.cs | 62 +++++++++++++++++++ .../Tests/Issues/Issue99999.cs | 40 ++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue99999.cs create mode 100644 src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue99999.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue99999.cs new file mode 100644 index 0000000000000..4ed809ec58885 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue99999.cs @@ -0,0 +1,62 @@ +using Microsoft.Maui.Controls; + +namespace Maui.Controls.Sample.Issues; + +[Issue(IssueTracker.Github, 99999, "Picker IsOpen property can be programmatically opened and closed", PlatformAffected.Android)] +public class Issue99999 : ContentPage +{ + readonly List _fruits = new() { "Apple", "Banana", "Mango", "Orange", "Pineapple" }; + readonly Picker _testPicker; + readonly Label _isOpenLabel; + + public Issue99999() + { + _testPicker = new Picker + { + AutomationId = "TestPicker", + Title = "Pick a fruit" + }; + _testPicker.ItemsSource = _fruits; + + var openButton = new Button + { + AutomationId = "OpenPickerButton", + Text = "Open Programmatically" + }; + openButton.Clicked += OnOpenPicker; + + _isOpenLabel = new Label + { + AutomationId = "IsOpenLabel", + Text = "IsOpen: False", + FontAttributes = FontAttributes.Bold + }; + + _testPicker.PropertyChanged += OnPickerPropertyChanged; + + Content = new VerticalStackLayout + { + Padding = new Thickness(16), + Spacing = 12, + Children = + { + _testPicker, + openButton, + _isOpenLabel + } + }; + } + + void OnPickerPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + if (e.PropertyName == nameof(Picker.IsOpen)) + { + _isOpenLabel.Text = $"IsOpen: {_testPicker.IsOpen}"; + } + } + + void OnOpenPicker(object sender, EventArgs e) + { + _testPicker.IsOpen = true; + } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs new file mode 100644 index 0000000000000..6cb3b21b73cc1 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs @@ -0,0 +1,40 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue99999 : _IssuesUITest +{ + public override string Issue => "Picker IsOpen property can be programmatically opened and closed"; + + public Issue99999(TestDevice device) : base(device) { } + + [Test] + [Category(UITestCategories.Picker)] + public void PickerCanBeOpenedProgrammatically() + { + App.WaitForElement("TestPicker"); + App.WaitForElement("OpenPickerButton"); + App.WaitForElement("IsOpenLabel"); + + var initialLabel = App.FindElement("IsOpenLabel").GetText(); + Assert.That(initialLabel, Is.EqualTo("IsOpen: False")); + + App.Tap("OpenPickerButton"); + +#if ANDROID + // On Android, picker is not dismissed by a single tap coordinate, so using two taps to dismiss + App.TapCoordinates(250, 250); + App.TapCoordinates(250, 250); +#elif IOS || MACCATALYST + // On iOS, tap Done button + App.Tap("Done"); +#endif + + // Verify IsOpen changed back to false + App.WaitForElement("IsOpenLabel"); + var closedLabel = App.FindElement("IsOpenLabel").GetText(); + Assert.That(closedLabel, Is.EqualTo("IsOpen: False")); + } +} From fbc5150068693c77d1ad30bdd5b893907922fb35 Mon Sep 17 00:00:00 2001 From: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com> Date: Mon, 29 Dec 2025 13:22:38 +0530 Subject: [PATCH 3/6] Update Issue99999.cs --- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs index 6cb3b21b73cc1..b3f317ad3965c 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs @@ -1,3 +1,4 @@ +# if TEST_FAILS_ON_WINDOWS // This is Android Specific issues using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -38,3 +39,4 @@ public void PickerCanBeOpenedProgrammatically() Assert.That(closedLabel, Is.EqualTo("IsOpen: False")); } } +#endif \ No newline at end of file From f4598cd6db9e1a50f32b8909350af0cd90a8515b Mon Sep 17 00:00:00 2001 From: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com> Date: Tue, 30 Dec 2025 11:39:16 +0530 Subject: [PATCH 4/6] test case renamed --- .../Issues/{Issue99999.cs => Issue33331.cs} | 6 +++--- .../Tests/Issues/{Issue99999.cs => Issue33331.cs} | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) rename src/Controls/tests/TestCases.HostApp/Issues/{Issue99999.cs => Issue33331.cs} (88%) rename src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/{Issue99999.cs => Issue33331.cs} (70%) diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue99999.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue33331.cs similarity index 88% rename from src/Controls/tests/TestCases.HostApp/Issues/Issue99999.cs rename to src/Controls/tests/TestCases.HostApp/Issues/Issue33331.cs index 4ed809ec58885..f7b7cb85b8a5e 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue99999.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue33331.cs @@ -2,14 +2,14 @@ namespace Maui.Controls.Sample.Issues; -[Issue(IssueTracker.Github, 99999, "Picker IsOpen property can be programmatically opened and closed", PlatformAffected.Android)] -public class Issue99999 : ContentPage +[Issue(IssueTracker.Github, 33331, "[Android] Picker IsOpen not reset when picker is dismissed", PlatformAffected.Android)] +public class Issue33331 : ContentPage { readonly List _fruits = new() { "Apple", "Banana", "Mango", "Orange", "Pineapple" }; readonly Picker _testPicker; readonly Label _isOpenLabel; - public Issue99999() + public Issue33331() { _testPicker = new Picker { diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs similarity index 70% rename from src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs rename to src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs index b3f317ad3965c..4269c12ee87ed 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue99999.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs @@ -5,11 +5,11 @@ namespace Microsoft.Maui.TestCases.Tests.Issues; -public class Issue99999 : _IssuesUITest +public class Issue33331 : _IssuesUITest { - public override string Issue => "Picker IsOpen property can be programmatically opened and closed"; + public override string Issue => "[Android] Picker IsOpen not reset when picker is dismissed"; - public Issue99999(TestDevice device) : base(device) { } + public Issue33331(TestDevice device) : base(device) { } [Test] [Category(UITestCategories.Picker)] @@ -25,9 +25,7 @@ public void PickerCanBeOpenedProgrammatically() App.Tap("OpenPickerButton"); #if ANDROID - // On Android, picker is not dismissed by a single tap coordinate, so using two taps to dismiss - App.TapCoordinates(250, 250); - App.TapCoordinates(250, 250); + App.Tap("Cancel"); #elif IOS || MACCATALYST // On iOS, tap Done button App.Tap("Done"); From 8f7a7bb52fcbcc465eb008024bc483cab29312c2 Mon Sep 17 00:00:00 2001 From: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com> Date: Mon, 5 Jan 2026 12:08:34 +0530 Subject: [PATCH 5/6] helper method added --- .../TestCases.HostApp/Issues/Issue33331.cs | 1 + .../Tests/Issues/Issue33331.cs | 10 +------ .../src/UITest.Appium/HelperExtensions.cs | 28 +++++++++++++++++++ 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue33331.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue33331.cs index f7b7cb85b8a5e..adec73688ab75 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue33331.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue33331.cs @@ -38,6 +38,7 @@ public Issue33331() { Padding = new Thickness(16), Spacing = 12, + VerticalOptions = LayoutOptions.Center, Children = { _testPicker, diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs index 4269c12ee87ed..6a07ea56c814d 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs @@ -23,15 +23,7 @@ public void PickerCanBeOpenedProgrammatically() Assert.That(initialLabel, Is.EqualTo("IsOpen: False")); App.Tap("OpenPickerButton"); - -#if ANDROID - App.Tap("Cancel"); -#elif IOS || MACCATALYST - // On iOS, tap Done button - App.Tap("Done"); -#endif - - // Verify IsOpen changed back to false + App.ClosePicker(windowsTapx: 250, windowsTapy: 250); App.WaitForElement("IsOpenLabel"); var closedLabel = App.FindElement("IsOpenLabel").GetText(); Assert.That(closedLabel, Is.EqualTo("IsOpen: False")); diff --git a/src/TestUtils/src/UITest.Appium/HelperExtensions.cs b/src/TestUtils/src/UITest.Appium/HelperExtensions.cs index 2f5c62d15e598..6c86889be939d 100644 --- a/src/TestUtils/src/UITest.Appium/HelperExtensions.cs +++ b/src/TestUtils/src/UITest.Appium/HelperExtensions.cs @@ -67,6 +67,34 @@ public static void RightClick(this IApp app, string element) }); } + /// + /// Closes a picker dialog using platform-specific dismiss actions. + /// For Android, taps the "Cancel" button. + /// For iOS/MacCatalyst, taps the "Done" button. + /// For Windows, either taps coordinates (if provided) or the "Cancel" button. + /// + /// Represents the main gateway to interact with an app. + /// Optional X coordinate for Windows tap. Default is 0. + /// Optional Y coordinate for Windows tap. Default is 0. + public static void ClosePicker(this IApp app, int windowsTapx = 0, int windowsTapy = 0) + { + if (app is AppiumAndroidApp) + { + app.Tap("Cancel"); + } + else if (app is AppiumIOSApp || app is AppiumCatalystApp) + { + app.Tap("Done"); + } + else if (app is AppiumWindowsApp) + { + if (windowsTapx != 0 || windowsTapy != 0) + { + app.TapCoordinates(windowsTapx, windowsTapy); + } + } + } + /// /// Performs a down/press on the matched element, without a matching release /// From 6febd48f443e3770ea5d074502a7b888e99183ad Mon Sep 17 00:00:00 2001 From: devanathan-vaithiyanathan <114395405+devanathan-vaithiyanathan@users.noreply.github.com> Date: Mon, 5 Jan 2026 12:46:19 +0530 Subject: [PATCH 6/6] Update Issue33331.cs --- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs index 6a07ea56c814d..4d4ec0e293152 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33331.cs @@ -1,4 +1,3 @@ -# if TEST_FAILS_ON_WINDOWS // This is Android Specific issues using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -23,10 +22,9 @@ public void PickerCanBeOpenedProgrammatically() Assert.That(initialLabel, Is.EqualTo("IsOpen: False")); App.Tap("OpenPickerButton"); - App.ClosePicker(windowsTapx: 250, windowsTapy: 250); + App.ClosePicker(windowsTapx: 50, windowsTapy: 50); App.WaitForElement("IsOpenLabel"); var closedLabel = App.FindElement("IsOpenLabel").GetText(); Assert.That(closedLabel, Is.EqualTo("IsOpen: False")); } -} -#endif \ No newline at end of file +} \ No newline at end of file