Skip to content

Commit e7f60db

Browse files
committed
Merge FB master
2 parents 8266342 + 12dbe7c commit e7f60db

File tree

10 files changed

+51
-21
lines changed

10 files changed

+51
-21
lines changed

Inspector/.eslintrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@
251251

252252
"flowtype/define-flow-type": 1,
253253
"flowtype/use-flow-type": 1,
254-
"flowtype/object-type-delimiter": [1, "comma"],
255254

256255
// React Plugin
257256
// The following rules are made available via `eslint-plugin-react`.

Inspector/css/app.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
* LICENSE file in the root directory of this source tree. An additional grant
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
9-
9+
1010
html, body, #app {
11+
font-family: sans-serif;
1112
width: 100%;
1213
height: 100%;
1314
margin: 0px;
@@ -35,7 +36,7 @@ html, body, #app {
3536
}
3637

3738
.section-caption {
38-
display: block;
39+
display: block;
3940
text-align: center;
4041
padding: 20px;
4142
font-size: 200%;

Inspector/css/inspector.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10-
.inspector-field {
10+
.inspector-field {
1111
margin-bottom: 5px;
1212
}
1313

@@ -16,4 +16,5 @@
1616
}
1717

1818
.inspector-field-value {
19+
font-family: monospace;
1920
}

Inspector/css/tree.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
}
2222

2323
.tree-node {
24+
font-family: monospace;
2425
cursor: pointer;
2526
}
2627

PrivateHeaders/XCTest/XCUIScreen.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Nov 29 2017 14:55:25).
3+
//
4+
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
5+
//
6+
7+
@interface XCUIScreen()
8+
{
9+
_Bool _isMainScreen;
10+
int _displayID;
11+
}
12+
@property(readonly) _Bool isMainScreen; // @synthesize isMainScreen=_isMainScreen;
13+
@property(readonly) int displayID; // @synthesize displayID=_displayID;
14+
15+
- (id)_clippedScreenshotData:(id)arg1 quality:(long long)arg2 rect:(struct CGRect)arg3 scale:(double)arg4;
16+
- (id)_screenshotDataForQuality:(long long)arg1 rect:(struct CGRect)arg2 error:(id *)arg3;
17+
- (id)screenshotDataForQuality:(long long)arg1 rect:(struct CGRect)arg2 error:(id *)arg3;
18+
- (id)screenshotDataForQuality:(long long)arg1 rect:(struct CGRect)arg2;
19+
- (id)_modernScreenshotDataForQuality:(long long)arg1 rect:(struct CGRect)arg2 error:(id *)arg3;
20+
- (id)screenshot;
21+
- (id)_imageFromData:(id)arg1;
22+
- (double)scale;
23+
- (id)initWithDisplayID:(int)arg1 isMainScreen:(_Bool)arg2;
24+
25+
@end

WebDriverAgent.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,7 @@
724724
EEC088E71CB56DA400B65968 /* FBExceptionHandler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FBExceptionHandler.m; sourceTree = "<group>"; };
725725
EEC088EA1CB5706D00B65968 /* FBSpringboardApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FBSpringboardApplication.h; path = WebDriverAgentLib/FBSpringboardApplication.h; sourceTree = SOURCE_ROOT; };
726726
EEC088EB1CB5706D00B65968 /* FBSpringboardApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FBSpringboardApplication.m; path = WebDriverAgentLib/FBSpringboardApplication.m; sourceTree = SOURCE_ROOT; };
727+
EED404361FCF02AB00D08020 /* XCUIScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCUIScreen.h; sourceTree = "<group>"; };
727728
EEDBEBBA1CB2681900A790A2 /* WebDriverAgent.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = WebDriverAgent.bundle; sourceTree = "<group>"; };
728729
EEDFE11F1D9C06F800E6FFE5 /* XCUIDevice+FBHealthCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "XCUIDevice+FBHealthCheck.h"; sourceTree = "<group>"; };
729730
EEDFE1201D9C06F800E6FFE5 /* XCUIDevice+FBHealthCheck.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "XCUIDevice+FBHealthCheck.m"; sourceTree = "<group>"; };
@@ -1321,6 +1322,7 @@
13211322
EE35AD051E3B77D600A02D78 /* XCUIRecorderNodeFinderMatch.h */,
13221323
EE35AD061E3B77D600A02D78 /* XCUIRecorderTimingMessage.h */,
13231324
EE35AD071E3B77D600A02D78 /* XCUIRecorderUtilities.h */,
1325+
EED404361FCF02AB00D08020 /* XCUIScreen.h */,
13241326
);
13251327
path = XCTest;
13261328
sourceTree = "<group>";

WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#import "FBMacros.h"
2222
#import "XCAXClient_iOS.h"
23+
#import "XCUIScreen.h"
2324

2425
static const NSTimeInterval FBHomeButtonCoolOffTime = 1.;
2526

@@ -42,8 +43,8 @@ - (BOOL)fb_goToHomescreenWithError:(NSError **)error
4243

4344
- (NSData *)fb_screenshotWithError:(NSError*__autoreleasing*)error
4445
{
45-
id xcScreen = NSClassFromString(@"XCUIScreen");
46-
if (nil == xcScreen) {
46+
Class xcScreenClass = NSClassFromString(@"XCUIScreen");
47+
if (nil == xcScreenClass) {
4748
NSData *result = [[XCAXClient_iOS sharedClient] screenshotData];
4849
if (nil == result) {
4950
if (error) {
@@ -53,29 +54,20 @@ - (NSData *)fb_screenshotWithError:(NSError*__autoreleasing*)error
5354
}
5455
return result;
5556
}
56-
57-
id mainScreen = [xcScreen valueForKey:@"mainScreen"];
58-
XCUIApplication *app = FBApplication.fb_activeApplication;
59-
CGSize screenSize = FBAdjustDimensionsForApplication(app.frame.size, app.interfaceOrientation);
60-
SEL mSelector = NSSelectorFromString(@"screenshotDataForQuality:rect:error:");
61-
NSMethodSignature *mSignature = [mainScreen methodSignatureForSelector:mSelector];
62-
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:mSignature];
63-
[invocation setTarget:mainScreen];
64-
[invocation setSelector:mSelector];
57+
6558
// https://developer.apple.com/documentation/xctest/xctimagequality?language=objc
6659
// Select lower quality, since XCTest crashes randomly if the maximum quality (zero value) is selected
6760
// and the resulting screenshot does not fit the memory buffer preallocated for it by the operating system
61+
CGSize screenSize = FBAdjustDimensionsForApplication(FBApplication.fb_activeApplication.frame.size, (UIInterfaceOrientation)[self.class sharedDevice].orientation);
6862
NSUInteger quality = 1;
69-
[invocation setArgument:&quality atIndex:2];
7063
CGRect screenRect = CGRectMake(0, 0, screenSize.width, screenSize.height);
71-
[invocation setArgument:&screenRect atIndex:3];
72-
[invocation setArgument:&error atIndex:4];
73-
[invocation invoke];
74-
NSData __unsafe_unretained *result;
75-
[invocation getReturnValue:&result];
64+
65+
XCUIScreen *mainScreen = (XCUIScreen *)[xcScreenClass mainScreen];
66+
NSData *result = [mainScreen screenshotDataForQuality:quality rect:screenRect error:error];
7667
if (nil == result) {
7768
return nil;
7869
}
70+
7971
// The resulting data is a JPEG image, so we need to convert it to PNG representation
8072
UIImage *image = [UIImage imageWithData:result];
8173
return (NSData *)UIImagePNGRepresentation(image);

WebDriverAgentLib/Utilities/FBConfiguration.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ NS_ASSUME_NONNULL_BEGIN
2727
/*! Disables remote query evaluation making Xcode 9.x tests behave same as Xcode 8.x test */
2828
+ (void)disableRemoteQueryEvaluation;
2929

30+
/*! Disables attribute key path analysis, which will cause XCTest on Xcode 9.x to ignore some elements */
31+
+ (void)disableAttributeKeyPathAnalysis;
32+
3033
/* The maximum typing frequency for all typing activities */
3134
+ (void)setMaxTypingFrequency:(NSUInteger)value;
3235
+ (NSUInteger)maxTypingFrequency;

WebDriverAgentLib/Utilities/FBConfiguration.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ + (void)disableRemoteQueryEvaluation
3131
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"XCTDisableRemoteQueryEvaluation"];
3232
}
3333

34+
+ (void)disableAttributeKeyPathAnalysis
35+
{
36+
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"XCTDisableAttributeKeyPathAnalysis"];
37+
}
38+
3439
+ (NSRange)bindingPortRange
3540
{
3641
// 'WebDriverAgent --port 8080' can be passed via the arguments to the process

WebDriverAgentTests/IntegrationTests/FBIntegrationTestCase.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ - (void)setUp
3333
{
3434
[super setUp];
3535
[FBConfiguration disableRemoteQueryEvaluation];
36+
[FBConfiguration disableAttributeKeyPathAnalysis];
3637
self.continueAfterFailure = NO;
3738
self.springboard = [FBSpringboardApplication fb_springboard];
3839
self.testedApplication = [XCUIApplication new];

0 commit comments

Comments
 (0)