diff --git a/WebDriverAgent.xcodeproj/project.pbxproj b/WebDriverAgent.xcodeproj/project.pbxproj index 96878d22b..4579803c8 100644 --- a/WebDriverAgent.xcodeproj/project.pbxproj +++ b/WebDriverAgent.xcodeproj/project.pbxproj @@ -4348,7 +4348,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = 7J7278KZZ5; + DEVELOPMENT_TEAM = VDZ6WAVGC2; INFOPLIST_FILE = WebDriverAgentTests/IntegrationApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -4368,7 +4368,7 @@ CLANG_ANALYZER_NONNULL = YES; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 7J7278KZZ5; + DEVELOPMENT_TEAM = VDZ6WAVGC2; INFOPLIST_FILE = WebDriverAgentTests/IntegrationApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -4429,7 +4429,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = 7J7278KZZ5; + DEVELOPMENT_TEAM = VDZ6WAVGC2; ENABLE_TESTING_SEARCH_PATHS = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = WebDriverAgentRunner/Info.plist; @@ -4487,7 +4487,7 @@ CLANG_STATIC_ANALYZER_MODE = deep; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 7J7278KZZ5; + DEVELOPMENT_TEAM = VDZ6WAVGC2; ENABLE_TESTING_SEARCH_PATHS = YES; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; INFOPLIST_FILE = WebDriverAgentRunner/Info.plist; diff --git a/WebDriverAgentLib/Commands/FBScreenshotCommands.m b/WebDriverAgentLib/Commands/FBScreenshotCommands.m index 7457b2b9b..a39d1cc30 100644 --- a/WebDriverAgentLib/Commands/FBScreenshotCommands.m +++ b/WebDriverAgentLib/Commands/FBScreenshotCommands.m @@ -24,9 +24,9 @@ #import "FBLogger.h" #import "FBScreenshot.h" #import "FBMacros.h" -#import "FBImageIOScaler.h" #import "FBConfiguration.h" #import "FBErrorBuilder.h" +#import "FBImageProcessor.h" static const NSTimeInterval SCREENSHOT_TIMEOUT = 0.5; @@ -94,7 +94,7 @@ + (NSArray *)routes rect = CGRectNull; } - if ([FBScreenshot isNewScreenshotAPISupported]) { + if ([FBScreenshotCommands isNewScreenshotAPISupported]) { id proxy = [FBXCTestDaemonsProxy testRunnerProxy]; __block NSError *innerError = nil; dispatch_semaphore_t sem = dispatch_semaphore_create(0); @@ -306,5 +306,15 @@ + (nullable NSData *)jpegDataWithImage:(CGImageRef)imageRef return newImageData; } ++ (BOOL)isNewScreenshotAPISupported +{ + static dispatch_once_t newScreenshotAPISupported; + static BOOL result; + dispatch_once(&newScreenshotAPISupported, ^{ + result = [(NSObject *)[FBXCTestDaemonsProxy testRunnerProxy] respondsToSelector:@selector(_XCT_requestScreenshotOfScreenWithID:withRect:uti:compressionQuality:withReply:)]; + }); + return result; +} + @end diff --git a/WebDriverAgentLib/Commands/UUElementCommands.m b/WebDriverAgentLib/Commands/UUElementCommands.m index 15df64a98..e10ca698f 100644 --- a/WebDriverAgentLib/Commands/UUElementCommands.m +++ b/WebDriverAgentLib/Commands/UUElementCommands.m @@ -31,7 +31,6 @@ #import "XCUIElement+FBIsVisible.h" #import "XCUIElement+FBPickerWheel.h" #import "XCUIElement+FBScrolling.h" -#import "XCUIElement+FBTap.h" #import "XCUIElement+FBTyping.h" #import "XCUIElement+FBUtilities.h" #import "XCUIElement+FBWebDriverAttributes.h" @@ -203,46 +202,6 @@ + (NSArray *)routes { return FBResponseWithOK(); } -+ (id)uuDealAlert:(FBRouteRequest *)request { - FBApplication *application = request.session.activeApplication ?: [FBApplication fb_activeApplication]; - FBAlert *alert = [FBAlert alertWithApplication:application]; - NSError *error; - NSInteger counts = 0; - while (alert.isPresent && counts < 10) { - [alert uuAcceptWithError:&error]; - alert = [FBAlert alertWithApplication:application]; - counts += 1; - } - if (error) { - return FBResponseWithUnknownError(error); - } - return FBResponseWithOK(); -} - -+ (id)uuDealAlertWithParam:(FBRouteRequest *)request { - FBApplication *application = request.session.activeApplication ?: [FBApplication fb_activeApplication]; - BOOL accept = [request.arguments[@"accept"] boolValue]; - FBAlert *alert = [FBAlert alertWithApplication:application]; - if (nil == alert) { - return FBResponseWithOK(); - } - NSError *error; - NSInteger counts = 0; - while (alert.isPresent && counts < 10) { - if (accept) { - [alert uuAcceptWithError:&error]; - } else { - [alert uuDismissWithError:&error]; - } - alert = [FBAlert alertWithApplication:application]; - counts += 1; - } - if (error) { - return FBResponseWithUnknownError(error); - } - return FBResponseWithOK(); -} - + (id)uuGetSysInfo:(FBRouteRequest *)request { [[BatteryInfoManager sharedManager] startBatteryMonitoring]; @@ -581,9 +540,6 @@ screen orientation is different from the default one (which is portrait). */ + (XCUICoordinate *)uuGestureCoordinateWithCoordinate:(CGPoint)coordinate application:(XCUIApplication *)application shouldApplyOrientationWorkaround:(BOOL)shouldApplyOrientationWorkaround { CGPoint point = coordinate; - if (shouldApplyOrientationWorkaround) { - point = FBInvertPointForApplication(coordinate, application.frame.size, application.interfaceOrientation); - } XCUICoordinate *appCoordinate = [[XCUICoordinate alloc] initWithElement:application normalizedOffset:CGVectorMake(0, 0)]; return [[XCUICoordinate alloc] initWithCoordinate:appCoordinate pointsOffset:CGVectorMake(point.x, point.y)]; } diff --git a/WebDriverAgentLib/FBAlert.h b/WebDriverAgentLib/FBAlert.h index 2d9bf48e4..22f28a710 100644 --- a/WebDriverAgentLib/FBAlert.h +++ b/WebDriverAgentLib/FBAlert.h @@ -56,8 +56,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (BOOL)acceptWithError:(NSError **)error; -- (BOOL)uuAcceptWithError:(NSError **)error; - /** Dismisses alert, if present @@ -66,8 +64,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (BOOL)dismissWithError:(NSError **)error; -- (BOOL)uuDismissWithError:(NSError **)error; - /** Clicks on an alert button, if present diff --git a/WebDriverAgentLib/FBAlert.m b/WebDriverAgentLib/FBAlert.m index c4e47c200..ff6b98c74 100644 --- a/WebDriverAgentLib/FBAlert.m +++ b/WebDriverAgentLib/FBAlert.m @@ -276,45 +276,4 @@ - (XCUIElement *)alertElement } -- (BOOL)uuAcceptWithError:(NSError **)error -{ - XCUIElement *alertElement = self.alertElement; - NSArray *buttons = [alertElement descendantsMatchingType:XCUIElementTypeButton].allElementsBoundByIndex; - - XCUIElement *defaultButton; - if (alertElement.elementType == XCUIElementTypeAlert && [buttons count] < 3) { - defaultButton = buttons.lastObject; - } else { - defaultButton = buttons.firstObject; - } - if (!defaultButton) { - return - [[[FBErrorBuilder builder] - withDescriptionFormat:@"Failed to find accept button for alert: %@", alertElement] - buildError:error]; - } - return [defaultButton fb_tapWithError:error]; -} - -- (BOOL)uuDismissWithError:(NSError **)error -{ - XCUIElement *cancelButton; - XCUIElement *alertElement = self.alertElement; - NSArray *buttons = [alertElement descendantsMatchingType:XCUIElementTypeButton].allElementsBoundByIndex; - - if (alertElement.elementType == XCUIElementTypeAlert) { - cancelButton = buttons.firstObject; - } else { - cancelButton = buttons.lastObject; - } - if (!cancelButton) { - return - [[[FBErrorBuilder builder] - withDescriptionFormat:@"Failed to find dismiss button for alert: %@", alertElement] - buildError:error]; - return NO; - } - return [cancelButton fb_tapWithError:error]; -} - @end