Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Microsoft.Maui.TestCases.Tests
{
public class PickerFeatureTests : _GalleryUITest
{
string doneButton => App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp) ? "selected" : "Done";
public const string PickerFeatureMatrix = "Picker Feature Matrix";
public override string GalleryPageName => PickerFeatureMatrix;

Expand Down Expand Up @@ -42,8 +43,8 @@ public void Picker_TapPicker_TakeScreenshot()
VerifyPickerScreenshot();

#if IOS
App.WaitForElement("Done");
App.Tap("Done");
App.WaitForElement(doneButton);
App.Tap(doneButton);
#elif WINDOWS
App.Tap("Option 2 - Second option");
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Bugzilla41424 : _IssuesUITest
#if ANDROID // Action button on TimePicker dialog is vary on different platforms.
const string DatePickerActionButton = "Cancel";
#elif IOS
const string DatePickerActionButton = "Done";
string DatePickerActionButton => App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp) ? "selected" : "Done";
#elif WINDOWS // No Action button for Windows DatePicker, so picking any date will close the dialog on windows.
const string DatePickerActionButton = "1";
#elif MACCATALYST // Appium cannot locate the dialog elements on a Mac, so tapping outside the dialog closes it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Bugzilla42074 : _IssuesUITest
#if ANDROID // Action button on TimePicker dialog is vary on different platforms
const string TimePickerActionButton = "Cancel";
#elif IOS
const string TimePickerActionButton = "Done";
string TimePickerActionButton => App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp) ? "selected" : "Done";
#elif WINDOWS
const string TimePickerActionButton = "Accept";
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue31167 : _IssuesUITest
{
string doneButton => App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp) ? "selected" : "Done";
public Issue31167(TestDevice testDevice) : base(testDevice)
{
}
Expand Down Expand Up @@ -36,9 +37,9 @@ public void DatePickerYearFormat_UserInteraction_MaintainsFourDigitYear()
// Simulate user interaction by opening and closing the DatePicker
App.Tap("MyDatePicker");

// On iOS, tap Done to close the picker
App.WaitForElement("Done");
App.Tap("Done");
// On iOS, tap Done (or "selected" on iOS 26+) to close the picker
App.WaitForElement(doneButton);
App.Tap(doneButton);
Comment thread
SubhikshaSf4851 marked this conversation as resolved.

// Verify text still shows 4-digit year after interaction
var afterInteractionText = App.WaitForElement("MyDatePicker").GetText();
Expand Down Expand Up @@ -109,10 +110,10 @@ public void DatePickerYearFormat_iOS_ConsistentAfterMultipleInteractions()
{
// Open picker
App.Tap("MyDatePicker");
App.WaitForElement("Done");
App.WaitForElement(doneButton);

// Close picker
App.Tap("Done");
App.Tap(doneButton);

// Verify format is still consistent
var currentText = App.WaitForElement("MyDatePicker").GetText();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public Issue31889(TestDevice testDevice) : base(testDevice) { }
private const string TestEditorId = "TestEditor";
private const string DarkThemeButtonId = "DarkThemeButton";
private const string LightThemeButtonId = "LightThemeButton";
private const string DoneButtonId = "Done";
string DoneButtonId => App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp) ? "selected" : "Done";
private const string TextColorDarkTheme = "EntryAndEditorTextColorAppThemeBindingUpdatesOnDarkTheme";
private const string TextColorLightTheme = "EntryAndEditorTextColorAppThemeBindingUpdatesOnLightTheme";
private const string PlaceholderColorDarkTheme = "EntryAndEditorPlaceholderTextColorAppThemeBindingUpdatesOnDarkTheme";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue32984 : _IssuesUITest
{
string doneButton => App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp) ? "selected" : "Done";
public Issue32984(TestDevice device)
: base(device)
{
Expand All @@ -23,8 +24,8 @@ public void Issue32984PickerShouldResize()
App.WaitForElement("Cancel");
App.Tap("Cancel");
#elif IOS || MACCATALYST
App.WaitForElement("Done");
App.Tap("Done");
App.WaitForElement(doneButton);
App.Tap(doneButton);
#elif WINDOWS
App.TapCoordinates(10, 10);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue34848 : _IssuesUITest
{
string doneButton => App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp) ? "selected" : "Done";
public Issue34848(TestDevice testDevice) : base(testDevice) { }

public override string Issue => "DatePicker Opened and Closed events are not raised on MacCatalyst";
Expand All @@ -22,8 +23,8 @@ public void DatePickerOpenedAndClosedEventsAreRaised()
App.Tap("Issue34848TestDatePicker");

#if IOS
// iOS DatePicker uses a wheel picker, so we can just tap the "Done" button to close it
App.Tap("Done");
// iOS DatePicker uses a wheel picker, so we can just tap the "Done" button (or "selected" on iOS 26+) to close it
App.Tap(doneButton);
Comment thread
SubhikshaSf4851 marked this conversation as resolved.
#elif WINDOWS
// On Windows, we can tap a date to close the DatePicker
App.Tap("16");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Issue1614 : _IssuesUITest
#if ANDROID
const string Done = "Cancel";
#else
const string Done = "Done";
string Done => App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp) ? "selected" : "Done";
#endif

public Issue1614(TestDevice testDevice) : base(testDevice)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Microsoft.Maui.TestCases.Tests.Issues;
[Category(UITestCategories.Picker)]
public class Issue5159 : _IssuesUITest
{
string doneButton => App is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp) ? "selected" : "Done";
const string DatePickerButton = "DatePickerButton";
const string TimePickerButton = "TimePickerButton";
const string PickerButton = "PickerButton";
Expand All @@ -22,7 +23,7 @@ public void InvisibleDatepickerShowsDialogOnFocus()
{
App.WaitForElement("DatePickerButton");
App.Tap(DatePickerButton);
App.WaitForElement("Done");
App.WaitForElement(doneButton);
App.TapCoordinates(5, 100);
}

Expand All @@ -31,7 +32,7 @@ public void InvisibleTimepickerShowsDialogOnFocus()
{
App.WaitForElement(TimePickerButton);
App.Tap(TimePickerButton);
App.WaitForElement("Done");
App.WaitForElement(doneButton);
App.TapCoordinates(5, 100);
}

Expand All @@ -40,7 +41,7 @@ public void InvisiblePickerShowsDialogOnFocus()
{
App.WaitForElement(PickerButton);
App.Tap(PickerButton);
App.WaitForElement("Done");
App.WaitForElement(doneButton);
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ internal static bool CheckIfViewAboveKeyboard(IApp app, string marked, bool isEd
internal static void HideKeyboard(IApp app, AppiumDriver? driver, bool isEditor)
{
if (isEditor)
CloseiOSEditorKeyboard(driver);
CloseiOSEditorKeyboard(app, driver);
else
app.DismissKeyboard();
}
Expand All @@ -118,9 +118,10 @@ internal static void HideKeyboard(IApp app, AppiumDriver? driver, bool isEditor)
return null;
}

internal static void CloseiOSEditorKeyboard(AppiumDriver? driver)
internal static void CloseiOSEditorKeyboard(IApp app, AppiumDriver? driver)
{
var keyboardDoneButton = driver?.FindElement(MobileBy.Name("Done"));
var doneButtonName = app is AppiumIOSApp iosApp && HelperExtensions.IsIOS26OrHigher(iosApp) ? "selected" : "Done";
var keyboardDoneButton = driver?.FindElement(MobileBy.Name(doneButtonName));
keyboardDoneButton?.Click();
}

Expand Down
6 changes: 5 additions & 1 deletion src/TestUtils/src/UITest.Appium/HelperExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public static void RightClick(this IApp app, string element)
/// <summary>
/// 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.
/// For iOS, taps the "selected" button on iOS 26+, otherwise taps the "Done" button. For MacCatalyst, taps the "Done" button.
/// </summary>
/// <param name="app">Represents the main gateway to interact with an app.</param>
/// <param name="x">Optional X coordinate for Windows tap. Default is 0.</param>
Expand All @@ -92,6 +92,10 @@ public static void ClosePicker(this IApp app, int windowsTapx = 0, int windowsTa
{
app.Tap("Cancel");
}
else if (app is AppiumIOSApp iosApp && IsIOS26OrHigher(iosApp))
{
app.Tap("selected");
}
else if (app is AppiumIOSApp || app is AppiumCatalystApp)
Comment thread
SubhikshaSf4851 marked this conversation as resolved.
{
app.Tap("Done");
Expand Down
Loading