appium-webdriveragent 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/PrivateHeaders/XCTest/XCAXClient_iOS.h +2 -4
- package/PrivateHeaders/XCTest/XCActivityRecord.h +3 -3
- package/PrivateHeaders/XCTest/XCApplicationQuery.h +3 -3
- package/PrivateHeaders/XCTest/XCTElementSetTransformer-Protocol.h +2 -2
- package/PrivateHeaders/XCTest/XCTRunnerDaemonSession.h +1 -1
- package/PrivateHeaders/XCTest/XCTestManager_IDEInterface-Protocol.h +5 -5
- package/PrivateHeaders/XCTest/XCTestManager_ManagerInterface-Protocol.h +8 -8
- package/PrivateHeaders/XCTest/XCUIApplication.h +2 -2
- package/PrivateHeaders/XCTest/XCUIApplicationImpl.h +2 -2
- package/PrivateHeaders/XCTest/XCUIApplicationProcess.h +3 -5
- package/PrivateHeaders/XCTest/XCUIElement.h +3 -3
- package/PrivateHeaders/XCTest/XCUIElementQuery.h +4 -4
- package/PrivateHeaders/XCTest/XCUIRecorderNodeFinder.h +3 -3
- package/PrivateHeaders/XCTest/XCUIRecorderUtilities.h +3 -3
- package/Scripts/build.sh +3 -6
- package/WebDriverAgent.xcodeproj/project.pbxproj +66 -70
- package/WebDriverAgent.xcodeproj/project.xcworkspace/xcuserdata/elf.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/WebDriverAgent.xcodeproj/xcuserdata/elf.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +91 -0
- package/WebDriverAgent.xcodeproj/xcuserdata/elf.xcuserdatad/xcschemes/xcschememanagement.plist +59 -0
- package/WebDriverAgentLib/Categories/{XCElementSnapshot+FBHelpers.h → FBXCElementSnapshotWrapper+Helpers.h} +18 -11
- package/WebDriverAgentLib/Categories/{XCElementSnapshot+FBHelpers.m → FBXCElementSnapshotWrapper+Helpers.m} +57 -39
- package/WebDriverAgentLib/Categories/NSExpression+FBFormat.m +8 -3
- package/WebDriverAgentLib/Categories/XCUIApplication+FBAlert.m +8 -7
- package/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.h +2 -2
- package/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +29 -28
- package/WebDriverAgentLib/Categories/XCUIApplicationProcess+FBQuiescence.m +5 -0
- package/WebDriverAgentLib/Categories/XCUICoordinate+FBFix.m +0 -1
- package/WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.m +8 -5
- package/WebDriverAgentLib/Categories/XCUIElement+FBAccessibility.h +2 -2
- package/WebDriverAgentLib/Categories/XCUIElement+FBAccessibility.m +5 -4
- package/WebDriverAgentLib/Categories/XCUIElement+FBCaching.m +3 -2
- package/WebDriverAgentLib/Categories/XCUIElement+FBFind.m +22 -18
- package/WebDriverAgentLib/Categories/XCUIElement+FBIsVisible.h +2 -3
- package/WebDriverAgentLib/Categories/XCUIElement+FBIsVisible.m +28 -26
- package/WebDriverAgentLib/Categories/XCUIElement+FBPickerWheel.m +2 -1
- package/WebDriverAgentLib/Categories/XCUIElement+FBResolve.m +8 -4
- package/WebDriverAgentLib/Categories/XCUIElement+FBScrolling.m +73 -51
- package/WebDriverAgentLib/Categories/XCUIElement+FBTyping.m +11 -10
- package/WebDriverAgentLib/Categories/XCUIElement+FBUID.h +10 -5
- package/WebDriverAgentLib/Categories/XCUIElement+FBUID.m +15 -3
- package/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.h +7 -7
- package/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m +29 -20
- package/WebDriverAgentLib/Categories/XCUIElement+FBWebDriverAttributes.h +2 -2
- package/WebDriverAgentLib/Categories/XCUIElement+FBWebDriverAttributes.m +16 -13
- package/WebDriverAgentLib/Categories/XCUIElementQuery+FBHelpers.h +2 -3
- package/WebDriverAgentLib/Categories/XCUIElementQuery+FBHelpers.m +3 -3
- package/WebDriverAgentLib/Commands/FBElementCommands.m +15 -14
- package/WebDriverAgentLib/Commands/FBFindElementCommands.m +5 -6
- package/WebDriverAgentLib/FBAlert.m +16 -13
- package/WebDriverAgentLib/FBApplication.m +8 -8
- package/WebDriverAgentLib/Routing/FBElementUtils.h +11 -2
- package/WebDriverAgentLib/Routing/FBElementUtils.m +15 -12
- package/WebDriverAgentLib/Routing/FBResponsePayload.m +11 -10
- package/WebDriverAgentLib/Routing/FBSession.m +1 -1
- package/{PrivateHeaders/XCTest/XCAccessibilityElement.h → WebDriverAgentLib/Routing/FBXCAccessibilityElement.h} +19 -18
- package/WebDriverAgentLib/{Categories/XCAccessibilityElement+FBComparison.m → Routing/FBXCAccessibilityElement.m} +5 -11
- package/WebDriverAgentLib/Routing/FBXCDeviceEvent.h +35 -0
- package/WebDriverAgentLib/Routing/FBXCDeviceEvent.m +43 -0
- package/{PrivateHeaders/XCTest/XCElementSnapshot.h → WebDriverAgentLib/Routing/FBXCElementSnapshot.h} +25 -44
- package/WebDriverAgentLib/Routing/FBXCElementSnapshot.m +10 -0
- package/WebDriverAgentLib/Routing/FBXCElementSnapshotWrapper.h +30 -0
- package/WebDriverAgentLib/Routing/FBXCElementSnapshotWrapper.m +45 -0
- package/WebDriverAgentLib/Utilities/FBActiveAppDetectionPoint.h +3 -4
- package/WebDriverAgentLib/Utilities/FBActiveAppDetectionPoint.m +4 -4
- package/WebDriverAgentLib/Utilities/FBBaseActionsSynthesizer.h +2 -2
- package/WebDriverAgentLib/Utilities/FBBaseActionsSynthesizer.m +7 -8
- package/WebDriverAgentLib/Utilities/FBClassChainQueryParser.m +1 -2
- package/WebDriverAgentLib/Utilities/FBConfiguration.m +0 -1
- package/WebDriverAgentLib/Utilities/FBImageIOScaler.m +3 -0
- package/WebDriverAgentLib/Utilities/FBKeyboard.m +1 -2
- package/WebDriverAgentLib/Utilities/FBTVNavigationTracker.m +1 -1
- package/WebDriverAgentLib/Utilities/FBW3CActionsSynthesizer.m +3 -3
- package/WebDriverAgentLib/Utilities/FBXCAXClientProxy.h +10 -9
- package/WebDriverAgentLib/Utilities/FBXCAXClientProxy.m +14 -8
- package/WebDriverAgentLib/Utilities/FBXCTestDaemonsProxy.h +0 -1
- package/WebDriverAgentLib/Utilities/FBXCTestDaemonsProxy.m +6 -0
- package/WebDriverAgentLib/Utilities/FBXCodeCompatibility.h +0 -10
- package/WebDriverAgentLib/Utilities/FBXCodeCompatibility.m +0 -24
- package/WebDriverAgentLib/Utilities/FBXPath-Private.h +1 -1
- package/WebDriverAgentLib/Utilities/FBXPath.h +3 -3
- package/WebDriverAgentLib/Utilities/FBXPath.m +15 -13
- package/WebDriverAgentLib/Utilities/NSPredicate+FBFormat.h +14 -1
- package/WebDriverAgentLib/Utilities/NSPredicate+FBFormat.m +18 -9
- package/WebDriverAgentLib/Utilities/XCTestPrivateSymbols.m +9 -3
- package/WebDriverAgentLib/Utilities/XCUIApplicationProcessDelay.m +7 -1
- package/WebDriverAgentLib/Vendor/CocoaAsyncSocket/GCDAsyncSocket.m +7 -1
- package/WebDriverAgentLib/WebDriverAgentLib.h +0 -1
- package/WebDriverAgentRunner-Runner.app.zip +0 -0
- package/WebDriverAgentTests/IntegrationTests/FBXPathIntegrationTests.m +26 -19
- package/WebDriverAgentTests/IntegrationTests/XCElementSnapshotHelperTests.m +24 -29
- package/WebDriverAgentTests/IntegrationTests/XCElementSnapshotHitPointTests.m +2 -2
- package/WebDriverAgentTests/IntegrationTests/XCUIElementFBFindTests.m +5 -3
- package/WebDriverAgentTests/IntegrationTests/XCUIElementHelperIntegrationTests.m +2 -1
- package/{WebDriverAgentLib/Categories/XCElementSnapshot+FBHitPoint.h → WebDriverAgentTests/UnitTests/Doubles/XCElementSnapshotDouble.h} +3 -14
- package/WebDriverAgentTests/UnitTests/Doubles/XCElementSnapshotDouble.m +99 -0
- package/WebDriverAgentTests/UnitTests/FBXPathTests.m +21 -13
- package/WebDriverAgentTests/UnitTests/NSPredicateFBFormatTests.m +4 -5
- package/package.json +1 -1
- package/WebDriverAgentLib/Categories/XCAccessibilityElement+FBComparison.h +0 -27
- package/WebDriverAgentLib/Categories/XCElementSnapshot+FBHitPoint.m +0 -29
- package/WebDriverAgentLib/Utilities/FBPredicate.h +0 -28
- package/WebDriverAgentLib/Utilities/FBPredicate.m +0 -29
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#import <XCTest/XCTest.h>
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
+
|
|
14
|
+
@protocol FBXCDeviceEvent
|
|
15
|
+
|
|
16
|
+
@property unsigned long long type; // @synthesize type=_type;
|
|
17
|
+
@property double rotation; // @synthesize rotation=_rotation;
|
|
18
|
+
@property double duration; // @synthesize duration=_duration;
|
|
19
|
+
@property unsigned int usage; // @synthesize usage=_usage;
|
|
20
|
+
@property unsigned int eventPage; // @synthesize eventPage=_eventPage;
|
|
21
|
+
@property(readonly) BOOL isButtonHoldEvent;
|
|
22
|
+
|
|
23
|
+
+ (id)deviceEventForDigitalCrownRotation:(double)arg1 velocity:(double)arg2;
|
|
24
|
+
+ (id)deviceEventWithPage:(unsigned int)arg1 usage:(unsigned int)arg2 duration:(double)arg3;
|
|
25
|
+
|
|
26
|
+
- (void)dispatch;
|
|
27
|
+
|
|
28
|
+
@end
|
|
29
|
+
|
|
30
|
+
_Nullable id<FBXCDeviceEvent> FBCreateXCDeviceEvent(unsigned int page,
|
|
31
|
+
unsigned int usage,
|
|
32
|
+
double duration,
|
|
33
|
+
NSError **error);
|
|
34
|
+
|
|
35
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#import "FBXCDeviceEvent.h"
|
|
11
|
+
|
|
12
|
+
#import "FBErrorBuilder.h"
|
|
13
|
+
|
|
14
|
+
id<FBXCDeviceEvent> FBCreateXCDeviceEvent(unsigned int page,
|
|
15
|
+
unsigned int usage,
|
|
16
|
+
double duration,
|
|
17
|
+
NSError **error)
|
|
18
|
+
{
|
|
19
|
+
Class xcDeviceEventClass = NSClassFromString(@"XCDeviceEvent");
|
|
20
|
+
if (nil == xcDeviceEventClass) {
|
|
21
|
+
[[[FBErrorBuilder builder]
|
|
22
|
+
withDescription:@"Cannot find XCDeviceEvent class"]
|
|
23
|
+
buildError:error];
|
|
24
|
+
return nil;
|
|
25
|
+
}
|
|
26
|
+
SEL deviceEventFactorySelector = NSSelectorFromString(@"deviceEventWithPage:usage:duration:");
|
|
27
|
+
if (![xcDeviceEventClass respondsToSelector:deviceEventFactorySelector]) {
|
|
28
|
+
[[[FBErrorBuilder builder]
|
|
29
|
+
withDescription:@"'deviceEventWithPage:usage:duration:' factory method is not found on XCDeviceEvent class"]
|
|
30
|
+
buildError:error];
|
|
31
|
+
return nil;
|
|
32
|
+
}
|
|
33
|
+
NSMethodSignature *deviceEventFactorySignature = [xcDeviceEventClass methodSignatureForSelector:deviceEventFactorySelector];
|
|
34
|
+
NSInvocation *deviceEventFactoryInvocation = [NSInvocation invocationWithMethodSignature:deviceEventFactorySignature];
|
|
35
|
+
[deviceEventFactoryInvocation setSelector:deviceEventFactorySelector];
|
|
36
|
+
[deviceEventFactoryInvocation setArgument:&page atIndex:2];
|
|
37
|
+
[deviceEventFactoryInvocation setArgument:&usage atIndex:3];
|
|
38
|
+
[deviceEventFactoryInvocation setArgument:&duration atIndex:4];
|
|
39
|
+
[deviceEventFactoryInvocation invokeWithTarget:xcDeviceEventClass];
|
|
40
|
+
id<FBXCDeviceEvent> __unsafe_unretained instance;
|
|
41
|
+
[deviceEventFactoryInvocation getReturnValue:&instance];
|
|
42
|
+
return instance;
|
|
43
|
+
}
|
|
@@ -1,41 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*/
|
|
6
9
|
|
|
10
|
+
#import <XCTest/XCTest.h>
|
|
7
11
|
#import <WebDriverAgentLib/CDStructures.h>
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
@protocol FBXCAccessibilityElement;
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
16
|
+
|
|
17
|
+
@protocol FBXCElementSnapshot <NSObject, XCUIElementAttributes>
|
|
12
18
|
|
|
13
|
-
@interface XCElementSnapshot : NSObject <XCUIElementAttributes, NSSecureCoding>
|
|
14
|
-
{
|
|
15
|
-
NSString *_identifier;
|
|
16
|
-
id _value;
|
|
17
|
-
NSString *_placeholderValue;
|
|
18
|
-
BOOL _enabled;
|
|
19
|
-
BOOL _selected;
|
|
20
|
-
BOOL _isMainWindow;
|
|
21
|
-
BOOL _hasKeyboardFocus;
|
|
22
|
-
BOOL _hasFocus;
|
|
23
|
-
XCUIApplication *_application;
|
|
24
|
-
unsigned long long _generation;
|
|
25
|
-
NSString *_title;
|
|
26
|
-
NSString *_label;
|
|
27
|
-
unsigned long long _elementType;
|
|
28
|
-
long long _horizontalSizeClass;
|
|
29
|
-
long long _verticalSizeClass;
|
|
30
|
-
XCAccessibilityElement *_accessibilityElement;
|
|
31
|
-
XCAccessibilityElement *_parentAccessibilityElement;
|
|
32
|
-
XCElementSnapshot *_parent;
|
|
33
|
-
NSArray *_children;
|
|
34
|
-
unsigned long long _traits;
|
|
35
|
-
NSArray *_userTestingAttributes;
|
|
36
|
-
NSDictionary *_additionalAttributes;
|
|
37
|
-
struct CGRect _frame;
|
|
38
|
-
}
|
|
39
19
|
@property BOOL hasFocus; // @synthesize hasFocus=_hasFocus;
|
|
40
20
|
@property BOOL hasKeyboardFocus; // @synthesize hasKeyboardFocus=_hasKeyboardFocus;
|
|
41
21
|
@property(copy) NSDictionary *additionalAttributes; // @synthesize additionalAttributes=_additionalAttributes;
|
|
@@ -43,15 +23,15 @@
|
|
|
43
23
|
@property unsigned long long traits; // @synthesize traits=_traits;
|
|
44
24
|
@property BOOL isMainWindow; // @synthesize isMainWindow=_isMainWindow;
|
|
45
25
|
@property(copy) NSArray *children; // @synthesize children=_children;
|
|
46
|
-
@property
|
|
47
|
-
@property(retain)
|
|
48
|
-
@property(retain)
|
|
26
|
+
@property id<FBXCElementSnapshot> parent; // @synthesize parent=_parent;
|
|
27
|
+
@property(retain) id<FBXCAccessibilityElement> parentAccessibilityElement; // @synthesize parentAccessibilityElement=_parentAccessibilityElement;
|
|
28
|
+
@property(retain) id<FBXCAccessibilityElement> accessibilityElement; // @synthesize accessibilityElement=_accessibilityElement;
|
|
49
29
|
@property(readonly) NSArray *suggestedHitpoints;
|
|
50
30
|
@property(readonly) struct CGRect visibleFrame;
|
|
51
|
-
@property(readonly)
|
|
31
|
+
@property(readonly) id<FBXCElementSnapshot> scrollView;
|
|
52
32
|
@property(readonly, copy) NSString *truncatedValueString;
|
|
53
33
|
@property(readonly) long long depth;
|
|
54
|
-
@property(readonly, copy)
|
|
34
|
+
@property(readonly, copy) id<FBXCElementSnapshot> pathFromRoot;
|
|
55
35
|
@property(readonly) BOOL isTopLevelTouchBarElement;
|
|
56
36
|
@property(readonly) BOOL isTouchBarElement;
|
|
57
37
|
@property(readonly, copy) NSString *sparseTreeDescription;
|
|
@@ -78,11 +58,11 @@
|
|
|
78
58
|
- (BOOL)matchesTreeWithRoot:(id)arg1;
|
|
79
59
|
- (void)mergeTreeWithSnapshot:(id)arg1;
|
|
80
60
|
- (id)_childMatchingElement:(id)arg1;
|
|
81
|
-
- (NSArray<
|
|
61
|
+
- (NSArray<id<FBXCElementSnapshot>> *)_allDescendants;
|
|
82
62
|
- (BOOL)hasDescendantMatchingFilter:(CDUnknownBlockType)arg1;
|
|
83
|
-
- (NSArray<
|
|
63
|
+
- (NSArray<id<FBXCElementSnapshot>> *)descendantsByFilteringWithBlock:(BOOL(^)(id<FBXCElementSnapshot> snapshot))block;
|
|
84
64
|
- (id)elementSnapshotMatchingAccessibilityElement:(id)arg1;
|
|
85
|
-
- (void)enumerateDescendantsUsingBlock:(void(^)(
|
|
65
|
+
- (void)enumerateDescendantsUsingBlock:(void(^)(id<FBXCElementSnapshot> snapshot))block;
|
|
86
66
|
- (id)recursiveDescriptionWithIndent:(id)arg1 includeAccessibilityElement:(BOOL)arg2;
|
|
87
67
|
- (id)init;
|
|
88
68
|
- (struct CGPoint)hostingAndOrientationTransformedPoint:(struct CGPoint)arg1;
|
|
@@ -92,11 +72,12 @@
|
|
|
92
72
|
// Available since Xcode 10
|
|
93
73
|
- (id)hitPoint:(NSError **)error;
|
|
94
74
|
|
|
95
|
-
// Available since Xcode 10.0-beta4 on
|
|
96
|
-
+ (id)axAttributesForElementSnapshotKeyPaths:(id)arg1;
|
|
97
75
|
// Since Xcode 10.2
|
|
98
76
|
+ (id)axAttributesForElementSnapshotKeyPaths:(id)arg1 isMacOS:(_Bool)arg2;
|
|
99
77
|
// Since Xcode 10.0
|
|
100
|
-
+ (NSArray<NSString *> *)sanitizedElementSnapshotHierarchyAttributesForAttributes:(NSArray<NSString *> *)arg1
|
|
78
|
+
+ (NSArray<NSString *> *)sanitizedElementSnapshotHierarchyAttributesForAttributes:(nullable NSArray<NSString *> *)arg1
|
|
79
|
+
isMacOS:(_Bool)arg2;
|
|
101
80
|
|
|
102
81
|
@end
|
|
82
|
+
|
|
83
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#import "FBXCElementSnapshot.h"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#import "FBXCElementSnapshot.h"
|
|
11
|
+
#import "FBElement.h"
|
|
12
|
+
|
|
13
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
14
|
+
|
|
15
|
+
@interface FBXCElementSnapshotWrapper : NSObject<FBXCElementSnapshot>
|
|
16
|
+
|
|
17
|
+
/*!Wrapped snapshot instance */
|
|
18
|
+
@property (nonatomic, readonly) id<FBXCElementSnapshot> snapshot;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
Wraps the given snapshot.. If the given snapshot is already wrapped then the result remains unchanged.
|
|
22
|
+
|
|
23
|
+
@param snapshot snapshot instance to wrap
|
|
24
|
+
@returns wrapper instance
|
|
25
|
+
*/
|
|
26
|
+
+ (nullable instancetype)ensureWrapped:(nullable id<FBXCElementSnapshot>)snapshot;
|
|
27
|
+
|
|
28
|
+
@end
|
|
29
|
+
|
|
30
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#import "FBXCElementSnapshotWrapper.h"
|
|
11
|
+
|
|
12
|
+
#import <objc/runtime.h>
|
|
13
|
+
|
|
14
|
+
#pragma clang diagnostic push
|
|
15
|
+
#pragma clang diagnostic ignored "-Wobjc-protocol-property-synthesis"
|
|
16
|
+
#pragma clang diagnostic ignored "-Wprotocol"
|
|
17
|
+
|
|
18
|
+
@implementation FBXCElementSnapshotWrapper
|
|
19
|
+
|
|
20
|
+
- (instancetype)initWithSnapshot:(id<FBXCElementSnapshot>)snapshot;
|
|
21
|
+
{
|
|
22
|
+
self->_snapshot = snapshot;
|
|
23
|
+
return self;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
+ (instancetype)ensureWrapped:(id<FBXCElementSnapshot>)snapshot
|
|
27
|
+
{
|
|
28
|
+
if (nil == snapshot) {
|
|
29
|
+
return nil;
|
|
30
|
+
}
|
|
31
|
+
return [(NSObject *)snapshot isKindOfClass:self.class]
|
|
32
|
+
? (FBXCElementSnapshotWrapper *)snapshot
|
|
33
|
+
: [[FBXCElementSnapshotWrapper alloc] initWithSnapshot:snapshot];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
- (id)forwardingTargetForSelector:(SEL)aSelector
|
|
37
|
+
{
|
|
38
|
+
struct objc_method_description descr = protocol_getMethodDescription(@protocol(FBXCElementSnapshot), aSelector, YES, YES);
|
|
39
|
+
SEL selector = descr.name;
|
|
40
|
+
return nil == selector ? nil : self.snapshot;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@end
|
|
44
|
+
|
|
45
|
+
#pragma clang diagnostic pop
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
#import <XCTest/XCTest.h>
|
|
11
|
-
|
|
12
|
-
@class XCAccessibilityElement;
|
|
11
|
+
@protocol FBXCAccessibilityElement;
|
|
13
12
|
|
|
14
13
|
NS_ASSUME_NONNULL_BEGIN
|
|
15
14
|
|
|
@@ -28,14 +27,14 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
28
27
|
* @param point The screen coordinates
|
|
29
28
|
* @returns The retrieved accessbility element or nil if it cannot be detected
|
|
30
29
|
*/
|
|
31
|
-
+ (nullable
|
|
30
|
+
+ (nullable id<FBXCAccessibilityElement>)axElementWithPoint:(CGPoint)point;
|
|
32
31
|
|
|
33
32
|
/**
|
|
34
33
|
* Retrieves the accessbility element for the current screen point
|
|
35
34
|
*
|
|
36
35
|
* @returns The retrieved accessbility element or nil if it cannot be detected
|
|
37
36
|
*/
|
|
38
|
-
- (nullable
|
|
37
|
+
- (nullable id<FBXCAccessibilityElement>)axElement;
|
|
39
38
|
|
|
40
39
|
/**
|
|
41
40
|
* Sets the coordinates for the current screen point
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
return instance;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
+ (
|
|
39
|
+
+ (id<FBXCAccessibilityElement>)axElementWithPoint:(CGPoint)point
|
|
40
40
|
{
|
|
41
|
-
__block
|
|
41
|
+
__block id<FBXCAccessibilityElement> onScreenElement = nil;
|
|
42
42
|
id<XCTestManager_ManagerInterface> proxy = [FBXCTestDaemonsProxy testRunnerProxy];
|
|
43
43
|
dispatch_semaphore_t sem = dispatch_semaphore_create(0);
|
|
44
44
|
[proxy _XCT_requestElementAtPoint:point
|
|
45
|
-
reply:^(
|
|
45
|
+
reply:^(id element, NSError *error) {
|
|
46
46
|
if (nil == error) {
|
|
47
47
|
onScreenElement = element;
|
|
48
48
|
} else {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
return onScreenElement;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
- (
|
|
57
|
+
- (id<FBXCAccessibilityElement>)axElement
|
|
58
58
|
{
|
|
59
59
|
return [self.class axElementWithPoint:self.coordinates];
|
|
60
60
|
}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
#import "FBElementCache.h"
|
|
11
|
+
#import "FBXCElementSnapshot.h"
|
|
11
12
|
#import "XCUIApplication.h"
|
|
12
|
-
#import "XCElementSnapshot.h"
|
|
13
13
|
#import "XCSynthesizedEventRecord.h"
|
|
14
14
|
|
|
15
15
|
NS_ASSUME_NONNULL_BEGIN
|
|
@@ -62,7 +62,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
62
62
|
@param snapshot Element's snapshot instance
|
|
63
63
|
@return The fixed hit point coordinates, if there is a need to fix them, or the unchanged hit point value
|
|
64
64
|
*/
|
|
65
|
-
- (CGPoint)fixedHitPointWith:(CGPoint)hitPoint forSnapshot:(
|
|
65
|
+
- (CGPoint)fixedHitPointWith:(CGPoint)hitPoint forSnapshot:(id<FBXCElementSnapshot>)snapshot;
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
Calculate absolute gesture position on the screen based on provided element and positionOffset values.
|
|
@@ -13,12 +13,11 @@
|
|
|
13
13
|
#import "FBLogger.h"
|
|
14
14
|
#import "FBMacros.h"
|
|
15
15
|
#import "FBMathUtils.h"
|
|
16
|
+
#import "FBXCElementSnapshotWrapper+Helpers.h"
|
|
16
17
|
#import "XCUIApplication+FBHelpers.h"
|
|
18
|
+
#import "XCUIElement.h"
|
|
17
19
|
#import "XCUIElement+FBIsVisible.h"
|
|
18
|
-
#import "XCElementSnapshot.h"
|
|
19
20
|
#import "XCUIElement+FBCaching.h"
|
|
20
|
-
#import "XCElementSnapshot+FBHitPoint.h"
|
|
21
|
-
#import "XCElementSnapshot+FBHelpers.h"
|
|
22
21
|
#import "XCPointerEventPath.h"
|
|
23
22
|
#import "XCSynthesizedEventRecord.h"
|
|
24
23
|
#import "XCUIElement+FBUtilities.h"
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
|
|
43
42
|
@implementation FBBaseGestureItem
|
|
44
43
|
|
|
45
|
-
- (CGPoint)fixedHitPointWith:(CGPoint)hitPoint forSnapshot:(
|
|
44
|
+
- (CGPoint)fixedHitPointWith:(CGPoint)hitPoint forSnapshot:(id<FBXCElementSnapshot>)snapshot
|
|
46
45
|
{
|
|
47
46
|
UIInterfaceOrientation interfaceOrientation = self.application.interfaceOrientation;
|
|
48
47
|
if (interfaceOrientation == UIInterfaceOrientationPortrait) {
|
|
@@ -54,8 +53,8 @@
|
|
|
54
53
|
// For Xcode11 it is always necessary to adjust the tap point coordinates
|
|
55
54
|
return FBInvertPointForApplication(hitPoint, appFrame.size, interfaceOrientation);
|
|
56
55
|
}
|
|
57
|
-
NSArray<
|
|
58
|
-
|
|
56
|
+
NSArray<id<FBXCElementSnapshot>> *ancestors = [FBXCElementSnapshotWrapper ensureWrapped:snapshot].fb_ancestors;
|
|
57
|
+
id<FBXCElementSnapshot> parentWindow = ancestors.count > 1 ? [ancestors objectAtIndex:ancestors.count - 2] : nil;
|
|
59
58
|
CGRect parentWindowFrame = nil == parentWindow ? snapshot.frame : parentWindow.frame;
|
|
60
59
|
if ((appFrame.size.height > appFrame.size.width && parentWindowFrame.size.height < parentWindowFrame.size.width) ||
|
|
61
60
|
(appFrame.size.height < appFrame.size.width && parentWindowFrame.size.height > parentWindowFrame.size.width)) {
|
|
@@ -86,11 +85,11 @@
|
|
|
86
85
|
} else {
|
|
87
86
|
// The offset relative to the element is defined
|
|
88
87
|
|
|
89
|
-
|
|
88
|
+
id<FBXCElementSnapshot> snapshot = element.fb_isResolvedFromCache.boolValue
|
|
90
89
|
? element.lastSnapshot
|
|
91
90
|
: element.fb_takeSnapshot;
|
|
92
91
|
if (nil == positionOffset) {
|
|
93
|
-
NSValue *hitPointValue = snapshot.fb_hitPoint;
|
|
92
|
+
NSValue *hitPointValue = [FBXCElementSnapshotWrapper ensureWrapped:snapshot].fb_hitPoint;
|
|
94
93
|
if (nil != hitPointValue) {
|
|
95
94
|
// short circuit element hitpoint
|
|
96
95
|
return hitPointValue;
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
#import "FBErrorBuilder.h"
|
|
12
12
|
#import "FBElementTypeTransformer.h"
|
|
13
13
|
#import "FBExceptions.h"
|
|
14
|
-
#import "FBPredicate.h"
|
|
15
14
|
#import "NSPredicate+FBFormat.h"
|
|
16
15
|
|
|
17
16
|
NS_ASSUME_NONNULL_BEGIN
|
|
@@ -559,7 +558,7 @@ static NSNumberFormatter *numberFormatter = nil;
|
|
|
559
558
|
*error = [self.class compilationErrorWithQuery:originalQuery description:description];
|
|
560
559
|
return nil;
|
|
561
560
|
}
|
|
562
|
-
NSPredicate *value = [NSPredicate
|
|
561
|
+
NSPredicate *value = [NSPredicate fb_snapshotBlockPredicateWithPredicate:[NSPredicate predicateWithFormat:token.asString]];
|
|
563
562
|
if ([token isKindOfClass:FBSelfPredicateToken.class]) {
|
|
564
563
|
[predicates addObject:[[FBSelfPredicateItem alloc] initWithValue:value]];
|
|
565
564
|
} else if ([token isKindOfClass:FBDescendantPredicateToken.class]) {
|
|
@@ -57,6 +57,8 @@ const CGFloat FBMaxCompressionQuality = 1.0f;
|
|
|
57
57
|
self.nextImage = image;
|
|
58
58
|
[self.nextImageLock unlock];
|
|
59
59
|
|
|
60
|
+
#pragma clang diagnostic push
|
|
61
|
+
#pragma clang diagnostic ignored "-Wcompletion-handler"
|
|
60
62
|
dispatch_async(self.scalingQueue, ^{
|
|
61
63
|
[self.nextImageLock lock];
|
|
62
64
|
NSData *next = self.nextImage;
|
|
@@ -77,6 +79,7 @@ const CGFloat FBMaxCompressionQuality = 1.0f;
|
|
|
77
79
|
}
|
|
78
80
|
completionHandler(scaled);
|
|
79
81
|
});
|
|
82
|
+
#pragma clang diagnostic pop
|
|
80
83
|
}
|
|
81
84
|
|
|
82
85
|
// This method is more optimized for JPEG scaling
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
#import "FBRunLoopSpinner.h"
|
|
18
18
|
#import "FBMacros.h"
|
|
19
19
|
#import "FBXCodeCompatibility.h"
|
|
20
|
-
#import "XCElementSnapshot.h"
|
|
21
20
|
#import "XCUIElement+FBUtilities.h"
|
|
22
21
|
#import "XCUIElement+FBIsVisible.h"
|
|
23
22
|
#import "XCTestDriver.h"
|
|
@@ -58,7 +57,7 @@
|
|
|
58
57
|
return NO;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
NSPredicate *keySearchPredicate = [NSPredicate predicateWithBlock:^BOOL(
|
|
60
|
+
NSPredicate *keySearchPredicate = [NSPredicate predicateWithBlock:^BOOL(id<FBXCElementSnapshot> snapshot,
|
|
62
61
|
NSDictionary *bindings) {
|
|
63
62
|
return snapshot.label.length > 0;
|
|
64
63
|
}];
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
if (self) {
|
|
60
60
|
_targetElement = targetElement;
|
|
61
61
|
CGRect frame = targetElement.fb_isResolvedFromCache.boolValue
|
|
62
|
-
? targetElement.lastSnapshot.wdFrame
|
|
62
|
+
? [FBXCElementSnapshotWrapper ensureWrapped:targetElement.lastSnapshot].wdFrame
|
|
63
63
|
: targetElement.wdFrame;
|
|
64
64
|
_targetCenter = FBRectGetCenter(frame);
|
|
65
65
|
_navigationItems = [NSMutableDictionary dictionary];
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
#import "FBW3CActionsHelpers.h"
|
|
20
20
|
#import "FBXCodeCompatibility.h"
|
|
21
21
|
#import "FBXCTestDaemonsProxy.h"
|
|
22
|
-
#import "
|
|
22
|
+
#import "FBXCElementSnapshotWrapper+Helpers.h"
|
|
23
23
|
#import "XCUIApplication+FBHelpers.h"
|
|
24
24
|
#import "XCUIDevice.h"
|
|
25
25
|
#import "XCUIElement+FBCaching.h"
|
|
@@ -163,13 +163,13 @@ static NSString *const FB_KEY_ACTIONS = @"actions";
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
// An offset relative to the element is defined
|
|
166
|
-
|
|
166
|
+
id<FBXCElementSnapshot> snapshot = element.fb_isResolvedFromCache.boolValue
|
|
167
167
|
? element.lastSnapshot
|
|
168
168
|
: element.fb_takeSnapshot;
|
|
169
169
|
CGRect frame = snapshot.frame;
|
|
170
170
|
if (CGRectIsEmpty(frame)) {
|
|
171
171
|
[FBLogger log:self.application.fb_descriptionRepresentation];
|
|
172
|
-
NSString *description = [NSString stringWithFormat:@"The element '%@' is not visible on the screen and thus is not interactable", snapshot.fb_description];
|
|
172
|
+
NSString *description = [NSString stringWithFormat:@"The element '%@' is not visible on the screen and thus is not interactable", [FBXCElementSnapshotWrapper ensureWrapped:snapshot].fb_description];
|
|
173
173
|
if (error) {
|
|
174
174
|
*error = [[FBErrorBuilder.builder withDescription:description] build];
|
|
175
175
|
}
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
#import <XCTest/XCTest.h>
|
|
11
|
-
#import "
|
|
12
|
-
|
|
11
|
+
#import "FBXCElementSnapshot.h"
|
|
12
|
+
|
|
13
|
+
@protocol FBXCAccessibilityElement;
|
|
13
14
|
|
|
14
15
|
NS_ASSUME_NONNULL_BEGIN
|
|
15
16
|
|
|
@@ -24,21 +25,21 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
24
25
|
|
|
25
26
|
- (BOOL)setAXTimeout:(NSTimeInterval)timeout error:(NSError **)error;
|
|
26
27
|
|
|
27
|
-
- (nullable
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
- (nullable id<FBXCElementSnapshot>)snapshotForElement:(id<FBXCAccessibilityElement>)element
|
|
29
|
+
attributes:(nullable NSArray<NSString *> *)attributes
|
|
30
|
+
maxDepth:(nullable NSNumber *)maxDepth
|
|
31
|
+
error:(NSError **)error;
|
|
31
32
|
|
|
32
|
-
- (NSArray<
|
|
33
|
+
- (NSArray<id<FBXCAccessibilityElement>> *)activeApplications;
|
|
33
34
|
|
|
34
|
-
- (
|
|
35
|
+
- (id<FBXCAccessibilityElement>)systemApplication;
|
|
35
36
|
|
|
36
37
|
- (NSDictionary *)defaultParameters;
|
|
37
38
|
|
|
38
39
|
- (void)notifyWhenNoAnimationsAreActiveForApplication:(XCUIApplication *)application
|
|
39
40
|
reply:(void (^)(void))reply;
|
|
40
41
|
|
|
41
|
-
- (NSDictionary *)attributesForElement:(
|
|
42
|
+
- (NSDictionary *)attributesForElement:(id<FBXCAccessibilityElement>)element
|
|
42
43
|
attributes:(NSArray *)attributes;
|
|
43
44
|
|
|
44
45
|
- (XCUIApplication *)monitoredApplicationWithProcessIdentifier:(int)pid;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
#import <objc/runtime.h>
|
|
13
13
|
|
|
14
|
+
#import "FBXCAccessibilityElement.h"
|
|
14
15
|
#import "FBConfiguration.h"
|
|
15
16
|
#import "FBLogger.h"
|
|
16
17
|
#import "FBMacros.h"
|
|
@@ -32,6 +33,9 @@ static id FBAXClient = nil;
|
|
|
32
33
|
return FBConfiguration.snapshotRequestParameters;
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
#pragma clang diagnostic push
|
|
37
|
+
#pragma clang diagnostic ignored "-Wobjc-load-method"
|
|
38
|
+
|
|
35
39
|
+ (void)load
|
|
36
40
|
{
|
|
37
41
|
static dispatch_once_t onceToken;
|
|
@@ -42,6 +46,8 @@ static id FBAXClient = nil;
|
|
|
42
46
|
});
|
|
43
47
|
}
|
|
44
48
|
|
|
49
|
+
#pragma clang diagnostic pop
|
|
50
|
+
|
|
45
51
|
@end
|
|
46
52
|
|
|
47
53
|
@implementation FBXCAXClientProxy
|
|
@@ -62,10 +68,10 @@ static id FBAXClient = nil;
|
|
|
62
68
|
return [FBAXClient _setAXTimeout:timeout error:error];
|
|
63
69
|
}
|
|
64
70
|
|
|
65
|
-
- (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
- (id<FBXCElementSnapshot>)snapshotForElement:(id<FBXCAccessibilityElement>)element
|
|
72
|
+
attributes:(NSArray<NSString *> *)attributes
|
|
73
|
+
maxDepth:(nullable NSNumber *)maxDepth
|
|
74
|
+
error:(NSError **)error
|
|
69
75
|
{
|
|
70
76
|
NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
|
|
71
77
|
// Mimicking XCTest framework behavior (this attribute is added by default unless it is an excludingNonModalElements query)
|
|
@@ -82,16 +88,16 @@ static id FBAXClient = nil;
|
|
|
82
88
|
attributes:attributes
|
|
83
89
|
parameters:[parameters copy]
|
|
84
90
|
error:error];
|
|
85
|
-
|
|
91
|
+
id<FBXCElementSnapshot> snapshot = [result valueForKey:@"_rootElementSnapshot"];
|
|
86
92
|
return nil == snapshot ? result : snapshot;
|
|
87
93
|
}
|
|
88
94
|
|
|
89
|
-
- (NSArray<
|
|
95
|
+
- (NSArray<id<FBXCAccessibilityElement>> *)activeApplications
|
|
90
96
|
{
|
|
91
97
|
return [FBAXClient activeApplications];
|
|
92
98
|
}
|
|
93
99
|
|
|
94
|
-
- (
|
|
100
|
+
- (id<FBXCAccessibilityElement>)systemApplication
|
|
95
101
|
{
|
|
96
102
|
return [FBAXClient systemApplication];
|
|
97
103
|
}
|
|
@@ -107,7 +113,7 @@ static id FBAXClient = nil;
|
|
|
107
113
|
[FBAXClient notifyWhenNoAnimationsAreActiveForApplication:application reply:reply];
|
|
108
114
|
}
|
|
109
115
|
|
|
110
|
-
- (NSDictionary *)attributesForElement:(
|
|
116
|
+
- (NSDictionary *)attributesForElement:(id<FBXCAccessibilityElement>)element
|
|
111
117
|
attributes:(NSArray *)attributes
|
|
112
118
|
{
|
|
113
119
|
NSError *error = nil;
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
static Class FBXCTRunnerDaemonSessionClass = nil;
|
|
25
25
|
static dispatch_once_t onceTestRunnerDaemonClass;
|
|
26
|
+
|
|
27
|
+
#pragma clang diagnostic push
|
|
28
|
+
#pragma clang diagnostic ignored "-Wobjc-load-method"
|
|
29
|
+
|
|
26
30
|
+ (void)load
|
|
27
31
|
{
|
|
28
32
|
// XCTRunnerDaemonSession class is only available since Xcode 8.3
|
|
@@ -31,6 +35,8 @@ static dispatch_once_t onceTestRunnerDaemonClass;
|
|
|
31
35
|
});
|
|
32
36
|
}
|
|
33
37
|
|
|
38
|
+
#pragma clang diagnostic pop
|
|
39
|
+
|
|
34
40
|
+ (id<XCTestManager_ManagerInterface>)testRunnerProxy
|
|
35
41
|
{
|
|
36
42
|
static id<XCTestManager_ManagerInterface> proxy = nil;
|
|
@@ -28,16 +28,6 @@ NSInteger FBTestmanagerdVersion(void);
|
|
|
28
28
|
|
|
29
29
|
NS_ASSUME_NONNULL_BEGIN
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
Set of categories that patches method name differences between Xcode versions,
|
|
33
|
-
so that WDA can be build with different Xcode versions.
|
|
34
|
-
*/
|
|
35
|
-
@interface XCElementSnapshot (FBCompatibility)
|
|
36
|
-
|
|
37
|
-
+ (nullable SEL)fb_attributesForElementSnapshotKeyPathsSelector;
|
|
38
|
-
|
|
39
|
-
@end
|
|
40
|
-
|
|
41
31
|
/**
|
|
42
32
|
The exception happends if one tries to call application method,
|
|
43
33
|
which is not supported in the current iOS version
|