Skip to content

Commit

Permalink
macOS 13 things
Browse files Browse the repository at this point in the history
  • Loading branch information
mattleibow committed Jun 10, 2024
1 parent e3e48e4 commit 3dc6b4d
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@ namespace UITest.Appium;

public class AppiumCatalystAlertActions : AppiumAppleAlertActions
{
// Selects the inner "popover contents" of a popover window.
const string PossibleActionSheetXPath =
"//XCUIElementTypeWindow/XCUIElementTypePopover/XCUIElementTypeWindow/XCUIElementTypePopover";

public AppiumCatalystAlertActions(AppiumApp appiumApp)
: base(appiumApp)
{
}

protected override IReadOnlyCollection<IUIElement> OnGetAlerts(AppiumApp appiumApp, IDictionary<string, object> parameters)
{
// Catalyst always uses action sheets.
// Catalyst uses action sheets for alerts and macOS 14
var alerts = appiumApp.FindElements(AppiumQuery.ByClass("XCUIElementTypeSheet"));

// But it also uses popovers for action sheets on macOS 13
if (alerts is null || alerts.Count == 0)
alerts = appiumApp.FindElements(AppiumQuery.ByXPath(PossibleActionSheetXPath));

return alerts;
}
}

0 comments on commit 3dc6b4d

Please sign in to comment.