Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Tune alert detection if system app is active #854

Merged
merged 1 commit into from
Feb 28, 2024
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
2 changes: 1 addition & 1 deletion WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ - (BOOL)fb_isSameAppAs:(nullable XCUIApplication *)otherApp
if (nil == otherApp) {
return NO;
}
return [self.bundleID isEqualToString:(NSString *)otherApp.bundleID];
return self == otherApp || [self.bundleID isEqualToString:(NSString *)otherApp.bundleID];
}

@end
7 changes: 6 additions & 1 deletion WebDriverAgentLib/FBAlert.m
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ - (BOOL)clickAlertButton:(NSString *)label error:(NSError **)error
- (XCUIElement *)alertElement
{
if (nil == self.element) {
self.element = XCUIApplication.fb_systemApplication.fb_alertElement ?: self.application.fb_alertElement;
XCUIApplication *systemApp = XCUIApplication.fb_systemApplication;
if ([systemApp fb_isSameAppAs:self.application]) {
self.element = systemApp.fb_alertElement;
} else {
self.element = systemApp.fb_alertElement ?: self.application.fb_alertElement;
}
}
return self.element;
}
Expand Down
Loading