Skip to content

Commit

Permalink
fix: Consider transient overlay windows when respectSystemAlerts is e…
Browse files Browse the repository at this point in the history
…nabled
  • Loading branch information
mwakizaka committed Oct 16, 2024
1 parent eb5e7cb commit dc629c3
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 25 deletions.
4 changes: 0 additions & 4 deletions WebDriverAgentLib/Commands/FBSessionCommands.m
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ + (NSArray *)routes
FB_SETTING_DEFAULT_ALERT_ACTION: request.session.defaultAlertAction ?: @"",
FB_SETTING_MAX_TYPING_FREQUENCY: @([FBConfiguration maxTypingFrequency]),
FB_SETTING_RESPECT_SYSTEM_ALERTS: @([FBConfiguration shouldRespectSystemAlerts]),
FB_SETTING_RESPECT_HALF_MODALS: @([FBConfiguration shouldRespectHalfModals]),
#if !TARGET_OS_TV
FB_SETTING_SCREENSHOT_ORIENTATION: [FBConfiguration humanReadableScreenshotOrientation],
#endif
Expand Down Expand Up @@ -395,9 +394,6 @@ + (NSArray *)routes
if (nil != [settings objectForKey:FB_SETTING_RESPECT_SYSTEM_ALERTS]) {
[FBConfiguration setShouldRespectSystemAlerts:[[settings objectForKey:FB_SETTING_RESPECT_SYSTEM_ALERTS] boolValue]];
}
if (nil != [settings objectForKey:FB_SETTING_RESPECT_HALF_MODALS]) {
[FBConfiguration setShouldRespectHalfModals:[[settings objectForKey:FB_SETTING_RESPECT_HALF_MODALS] boolValue]];
}
// SNAPSHOT_TIMEOUT setting is deprecated. Please use CUSTOM_SNAPSHOT_TIMEOUT instead
if (nil != [settings objectForKey:FB_SETTING_SNAPSHOT_TIMEOUT]) {
[FBConfiguration setCustomSnapshotTimeout:[[settings objectForKey:FB_SETTING_SNAPSHOT_TIMEOUT] doubleValue]];
Expand Down
6 changes: 2 additions & 4 deletions WebDriverAgentLib/Routing/FBSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,8 @@ - (XCUIApplication *)activeApplication
XCUIApplicationState testedAppState = self.testedApplication.state;
if (testedAppState >= XCUIApplicationStateRunningForeground) {
if ([FBConfiguration shouldRespectSystemAlerts]
&& [XCUIApplication.fb_systemApplication descendantsMatchingType:XCUIElementTypeAlert].count > 0) {
return XCUIApplication.fb_systemApplication;
} else if ([FBConfiguration shouldRespectHalfModals]
&& [XCUIApplication.fb_systemApplication fb_descendantsMatchingProperty:@"name" value:@"SBTransientOverlayWindow" partialSearch:false].count > 0) {
&& ([XCUIApplication.fb_systemApplication descendantsMatchingType:XCUIElementTypeAlert].count > 0
|| [XCUIApplication.fb_systemApplication fb_descendantsMatchingProperty:@"name" value:@"SBTransientOverlayWindow" partialSearch:false].count > 0)) {
return XCUIApplication.fb_systemApplication;
}
return (XCUIApplication *)self.testedApplication;
Expand Down
4 changes: 0 additions & 4 deletions WebDriverAgentLib/Utilities/FBConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ extern NSString *const FBSnapshotMaxDepthKey;
+ (void)setShouldRespectSystemAlerts:(BOOL)value;
+ (BOOL)shouldRespectSystemAlerts;

/* Enforces WDA to verify the presense of half modals while checking for an active app */
+ (void)setShouldRespectHalfModals:(BOOL)value;
+ (BOOL)shouldRespectHalfModals;

/**
* Extract switch value from arguments
*
Expand Down
11 changes: 0 additions & 11 deletions WebDriverAgentLib/Utilities/FBConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
static BOOL FBShouldUseTestManagerForVisibilityDetection = NO;
static BOOL FBShouldUseSingletonTestManager = YES;
static BOOL FBShouldRespectSystemAlerts = NO;
static BOOL FBShouldRespectHalfModals = NO;

static NSUInteger FBMjpegScalingFactor = 100;
static BOOL FBMjpegShouldFixOrientation = NO;
Expand Down Expand Up @@ -389,16 +388,6 @@ + (BOOL)shouldRespectSystemAlerts
return FBShouldRespectSystemAlerts;
}

+ (void)setShouldRespectHalfModals:(BOOL)value
{
FBShouldRespectHalfModals = value;
}

+ (BOOL)shouldRespectHalfModals
{
return FBShouldRespectHalfModals;
}

+ (void)setUseFirstMatch:(BOOL)enabled
{
FBShouldUseFirstMatch = enabled;
Expand Down
1 change: 0 additions & 1 deletion WebDriverAgentLib/Utilities/FBSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ extern NSString* const FB_SETTING_WAIT_FOR_IDLE_TIMEOUT;
extern NSString* const FB_SETTING_ANIMATION_COOL_OFF_TIMEOUT;
extern NSString* const FB_SETTING_MAX_TYPING_FREQUENCY;
extern NSString* const FB_SETTING_RESPECT_SYSTEM_ALERTS;
extern NSString* const FB_SETTING_RESPECT_HALF_MODALS;


NS_ASSUME_NONNULL_END
1 change: 0 additions & 1 deletion WebDriverAgentLib/Utilities/FBSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@
NSString* const FB_SETTING_ANIMATION_COOL_OFF_TIMEOUT = @"animationCoolOffTimeout";
NSString* const FB_SETTING_MAX_TYPING_FREQUENCY = @"maxTypingFrequency";
NSString* const FB_SETTING_RESPECT_SYSTEM_ALERTS = @"respectSystemAlerts";
NSString* const FB_SETTING_RESPECT_HALF_MODALS = @"respectHalfModals";

0 comments on commit dc629c3

Please sign in to comment.