diff --git a/Scripts/bootstrap.sh b/Scripts/bootstrap.sh index fadac72a..e8b3b842 100755 --- a/Scripts/bootstrap.sh +++ b/Scripts/bootstrap.sh @@ -54,6 +54,7 @@ function fetch_and_build_dependencies() { function build_inspector() { echo -e "${BOLD}Building Inspector" + assert_has_npm CURRENT_DIR=$(pwd) RESOURCE_BUNDLE_DIR="$CURRENT_DIR/Resources/WebDriverAgent.bundle" INSPECTOR_DIR="$CURRENT_DIR/Inspector" diff --git a/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m b/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m index 253e55b7..1528fa8b 100644 --- a/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +++ b/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m @@ -12,6 +12,7 @@ #import #import #include +#import #import "FBSpringboardApplication.h" #import "FBErrorBuilder.h" diff --git a/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.h b/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.h index c0739e97..1526f901 100644 --- a/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.h +++ b/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.h @@ -34,16 +34,16 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)fb_obstructsElement:(XCUIElement *)element; /** - Gets the most recent snapshot of the current element. The element will be + Gets the most recent snapshot of the current element. The element will be automatically resolved if the snapshot is not available yet - + @return The recent snapshot of the element */ - (XCElementSnapshot *)fb_lastSnapshot; /** Filters elements by matching them to snapshots from the corresponding array - + @param snapshots Array of snapshots to be matched with @return Array of filtered elements, which have matches in snapshots array diff --git a/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m b/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m index 2f24679c..9fde69dd 100644 --- a/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m +++ b/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m @@ -9,6 +9,8 @@ #import "XCUIElement+FBUtilities.h" +#import + #import "FBAlert.h" #import "FBLogger.h" #import "FBMacros.h" @@ -19,6 +21,7 @@ #import "XCAXClient_iOS.h" #import "XCUIElement+FBWebDriverAttributes.h" + @implementation XCUIElement (FBUtilities) static const NSTimeInterval FBANIMATION_TIMEOUT = 5.0; @@ -124,7 +127,7 @@ - (BOOL)fb_waitUntilSnapshotIsStable return result; } -- (NSData *)fb_screenshotWithError:(NSError**)error +- (NSData *)fb_screenshotWithError:(NSError **)error { if (CGRectIsEmpty(self.frame)) { if (error) { @@ -132,7 +135,7 @@ - (NSData *)fb_screenshotWithError:(NSError**)error } return nil; } - + Class xcScreenClass = NSClassFromString(@"XCUIScreen"); if (nil == xcScreenClass) { if (error) { @@ -140,7 +143,7 @@ - (NSData *)fb_screenshotWithError:(NSError**)error } return nil; } - + id mainScreen = [xcScreenClass valueForKey:@"mainScreen"]; SEL mSelector = NSSelectorFromString(@"screenshotDataForQuality:rect:error:"); NSMethodSignature *mSignature = [mainScreen methodSignatureForSelector:mSelector]; @@ -158,7 +161,7 @@ - (NSData *)fb_screenshotWithError:(NSError**)error if (nil == imageData) { return nil; } - + UIImage *image = [UIImage imageWithData:imageData]; UIInterfaceOrientation orientation = self.application.interfaceOrientation; UIImageOrientation imageOrientation = UIImageOrientationUp; @@ -173,9 +176,9 @@ - (NSData *)fb_screenshotWithError:(NSError**)error CGSize size = image.size; UIGraphicsBeginImageContext(CGSizeMake(size.width, size.height)); [[UIImage imageWithCGImage:(CGImageRef)[image CGImage] scale:1.0 orientation:imageOrientation] drawInRect:CGRectMake(0, 0, size.width, size.height)]; - UIImage* fixedImage = UIGraphicsGetImageFromCurrentImageContext(); + UIImage *fixedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); - + // The resulting data is a JPEG image, so we need to convert it to PNG representation return (NSData *)UIImagePNGRepresentation(fixedImage); } diff --git a/WebDriverAgentLib/Utilities/FBXCodeCompatibility.m b/WebDriverAgentLib/Utilities/FBXCodeCompatibility.m index 1d453565..fa012281 100644 --- a/WebDriverAgentLib/Utilities/FBXCodeCompatibility.m +++ b/WebDriverAgentLib/Utilities/FBXCodeCompatibility.m @@ -71,6 +71,7 @@ - (BOOL)fb_isActivateSupported @end + static BOOL FBShouldUseFirstMatchSelector = NO; static dispatch_once_t onceFirstMatchToken; @implementation XCUIElementQuery (FBCompatibility) diff --git a/WebDriverAgentLib/Utilities/XCTestPrivateSymbols.m b/WebDriverAgentLib/Utilities/XCTestPrivateSymbols.m index d14b20a8..508fc0f1 100644 --- a/WebDriverAgentLib/Utilities/XCTestPrivateSymbols.m +++ b/WebDriverAgentLib/Utilities/XCTestPrivateSymbols.m @@ -9,6 +9,8 @@ #import "XCTestPrivateSymbols.h" +#import + #import "FBRuntimeUtils.h" NSNumber *FB_XCAXAIsVisibleAttribute; @@ -38,7 +40,7 @@ void *FBRetrieveXCTestSymbol(const char *name) { - Class XCTestClass = NSClassFromString(@"XCTestCase"); + Class XCTestClass = objc_lookUpClass("XCTestCase"); NSCAssert(XCTestClass != nil, @"XCTest should be already linked", XCTestClass); NSString *XCTestBinary = [NSBundle bundleForClass:XCTestClass].executablePath; const char *binaryPath = XCTestBinary.UTF8String;