Skip to content

Commit

Permalink
feat: look for critical notification in respectSystemAlerts (#962)
Browse files Browse the repository at this point in the history
* feat: look for critical notification in respectSystemAlerts

* use IN

* Update FBSession.m

* Use NotificationShortLookView instead as identifier
  • Loading branch information
KazuCocoa authored Dec 13, 2024
1 parent deb8eca commit 916c8c5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions WebDriverAgentLib/Routing/FBSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,13 @@ - (XCUIApplication *)activeApplication
if (nil != self.testedApplication) {
XCUIApplicationState testedAppState = self.testedApplication.state;
if (testedAppState >= XCUIApplicationStateRunningForeground) {
// We look for `SBTransientOverlayWindow` elements for half modals. See https://github.com/appium/WebDriverAgent/pull/946
NSPredicate *searchPredicate = [NSPredicate predicateWithFormat:@"%K == %@ OR %K == %@",
NSPredicate *searchPredicate = [NSPredicate predicateWithFormat:@"%K == %@ OR %K IN {%@, %@}",
@"elementType", @(XCUIElementTypeAlert),
@"identifier", @"SBTransientOverlayWindow"];
// To look for `SBTransientOverlayWindow` elements. See https://github.com/appium/WebDriverAgent/pull/946
@"identifier", @"SBTransientOverlayWindow",
// To look for 'criticalAlertSetting' elements https://developer.apple.com/documentation/usernotifications/unnotificationsettings/criticalalertsetting
// See https://github.com/appium/appium/issues/20835
@"NotificationShortLookView"];
if ([FBConfiguration shouldRespectSystemAlerts]
&& [[XCUIApplication.fb_systemApplication descendantsMatchingType:XCUIElementTypeAny]
matchingPredicate:searchPredicate].count > 0) {
Expand Down

0 comments on commit 916c8c5

Please sign in to comment.