appium-webdriveragent 3.15.1 → 4.1.3
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 +0 -7
- package/PrivateHeaders/XCTest/XCAccessibilityElement.h +2 -0
- package/PrivateHeaders/XCTest/XCElementSnapshot.h +0 -7
- package/PrivateHeaders/XCTest/XCPointerEventPath.h +0 -2
- package/PrivateHeaders/XCTest/XCTestCaseRun.h +0 -2
- package/PrivateHeaders/XCTest/XCTestDriver.h +0 -6
- package/PrivateHeaders/XCTest/XCTestManager_ManagerInterface-Protocol.h +0 -2
- package/PrivateHeaders/XCTest/XCUIApplication.h +0 -3
- package/PrivateHeaders/XCTest/XCUIDevice.h +0 -2
- package/PrivateHeaders/XCTest/XCUIElement.h +0 -5
- package/PrivateHeaders/XCTest/XCUIElementQuery.h +0 -2
- package/Scripts/build-webdriveragent.js +1 -1
- package/Scripts/build.sh +7 -2
- package/Scripts/fetch-prebuilt-wda.js +1 -1
- package/WebDriverAgent.xcodeproj/project.pbxproj +22 -33
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationApp.xcscheme +3 -7
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationTests_1.xcscheme +1 -1
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationTests_2.xcscheme +1 -1
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/IntegrationTests_3.xcscheme +1 -1
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentLib.xcscheme +10 -14
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentLib_tvOS.xcscheme +10 -14
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner-nodebug.xcscheme +3 -7
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner.xcscheme +1 -1
- package/WebDriverAgent.xcodeproj/xcshareddata/xcschemes/WebDriverAgentRunner_tvOS.xcscheme +1 -1
- package/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.h +9 -15
- package/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +4 -22
- package/WebDriverAgentLib/Categories/XCUIElement+FBSwiping.h +1 -2
- package/WebDriverAgentLib/Categories/XCUIElement+FBSwiping.m +1 -5
- package/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m +1 -7
- package/WebDriverAgentLib/Commands/FBAlertViewCommands.m +6 -6
- package/WebDriverAgentLib/Commands/FBCustomCommands.m +1 -5
- package/WebDriverAgentLib/Commands/FBDebugCommands.m +6 -3
- package/WebDriverAgentLib/FBAlert.m +1 -0
- package/WebDriverAgentLib/FBApplication.m +1 -12
- package/WebDriverAgentLib/Utilities/FBFailureProofTestCase.m +7 -10
- package/WebDriverAgentLib/Utilities/FBScreen.m +3 -1
- package/WebDriverAgentLib/Utilities/FBW3CActionsSynthesizer.m +4 -16
- package/WebDriverAgentLib/Utilities/FBXCAXClientProxy.h +0 -2
- package/WebDriverAgentLib/Utilities/FBXCAXClientProxy.m +15 -37
- package/WebDriverAgentLib/Utilities/FBXCTestDaemonsProxy.m +4 -15
- package/WebDriverAgentLib/Utilities/FBXCodeCompatibility.h +0 -17
- package/WebDriverAgentLib/Utilities/FBXCodeCompatibility.m +1 -55
- package/WebDriverAgentLib/Utilities/FBXMLGenerationOptions.h +46 -0
- package/WebDriverAgentLib/Utilities/FBXMLGenerationOptions.m +26 -0
- package/WebDriverAgentLib/Utilities/FBXPath.h +4 -3
- package/WebDriverAgentLib/Utilities/FBXPath.m +65 -28
- package/WebDriverAgentRunner-Runner.app.zip +0 -0
- package/WebDriverAgentTests/IntegrationTests/FBAlertTests.m +5 -0
- package/WebDriverAgentTests/IntegrationTests/FBAppiumMultiTouchActionsIntegrationTests.m +7 -0
- package/WebDriverAgentTests/IntegrationTests/FBAppiumTouchActionsIntegrationTests.m +19 -0
- package/WebDriverAgentTests/IntegrationTests/FBElementScreenshotTests.m +4 -0
- package/WebDriverAgentTests/IntegrationTests/FBElementSwipingTests.m +71 -6
- package/WebDriverAgentTests/IntegrationTests/FBElementVisibilityTests.m +3 -1
- package/WebDriverAgentTests/IntegrationTests/FBForceTouchTests.m +6 -0
- package/WebDriverAgentTests/IntegrationTests/FBIntegrationTestCase.m +2 -1
- package/WebDriverAgentTests/IntegrationTests/FBKeyboardTests.m +19 -0
- package/WebDriverAgentTests/IntegrationTests/FBW3CTouchActionsIntegrationTests.m +15 -0
- package/WebDriverAgentTests/IntegrationTests/FBXPathIntegrationTests.m +16 -2
- package/WebDriverAgentTests/IntegrationTests/XCUIApplicationHelperTests.m +1 -1
- package/WebDriverAgentTests/IntegrationTests/XCUIElementFBFindTests.m +1 -1
- package/WebDriverAgentTests/UnitTests/FBXPathTests.m +28 -15
- package/build/index.js +6 -6
- package/build/lib/check-dependencies.js +4 -4
- package/build/lib/constants.js +2 -4
- package/build/lib/logger.js +3 -3
- package/build/lib/no-session-proxy.js +3 -3
- package/build/lib/utils.js +25 -25
- package/build/lib/webdriveragent.js +17 -17
- package/build/lib/xcodebuild.js +5 -5
- package/index.js +2 -2
- package/lib/check-dependencies.js +1 -1
- package/lib/constants.js +1 -2
- package/lib/logger.js +1 -1
- package/lib/no-session-proxy.js +1 -1
- package/lib/utils.js +1 -1
- package/lib/webdriveragent.js +2 -2
- package/lib/xcodebuild.js +1 -1
- package/npm-shrinkwrap.json +2208 -0
- package/package.json +13 -12
- package/PrivateHeaders/.DS_Store +0 -0
- package/WebDriverAgent.xcodeproj/project.xcworkspace/xcuserdata/elf.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/WebDriverAgent.xcodeproj/xcuserdata/elf.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -91
- package/WebDriverAgent.xcodeproj/xcuserdata/elf.xcuserdatad/xcschemes/xcschememanagement.plist +0 -59
- package/WebDriverAgentLib/.DS_Store +0 -0
- package/WebDriverAgentLib/Utilities/LRUCache/.DS_Store +0 -0
- package/WebDriverAgentLib/Vendor/.DS_Store +0 -0
- package/WebDriverAgentRunner/.DS_Store +0 -0
- package/WebDriverAgentTests/IntegrationApp/Resources/.DS_Store +0 -0
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
@class XCElementSnapshot;
|
|
13
13
|
@class XCAccessibilityElement;
|
|
14
|
+
@class FBXMLGenerationOptions;
|
|
14
15
|
|
|
15
16
|
NS_ASSUME_NONNULL_BEGIN
|
|
16
17
|
|
|
@@ -25,15 +26,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
25
26
|
*/
|
|
26
27
|
- (BOOL)fb_deactivateWithDuration:(NSTimeInterval)duration error:(NSError **)error;
|
|
27
28
|
|
|
28
|
-
/**
|
|
29
|
-
Resets the authorization status for a protected resource. Available since Xcode 11.4
|
|
30
|
-
|
|
31
|
-
@param resourceId A valid resource id to reset the auth status for. See https://developer.apple.com/documentation/xctest/xcuiprotectedresource?language=objc
|
|
32
|
-
@param error If there is an error, upon return contains an NSError object that describes the problem.
|
|
33
|
-
@return YES if the operation succeeds, otherwise NO.
|
|
34
|
-
*/
|
|
35
|
-
- (BOOL)fb_resetAuthorizationStatusForResource:(long long)resourceId error:(NSError **)error;
|
|
36
|
-
|
|
37
29
|
/**
|
|
38
30
|
Return application elements tree in form of nested dictionaries
|
|
39
31
|
*/
|
|
@@ -45,18 +37,20 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
45
37
|
- (NSDictionary *)fb_accessibilityTree;
|
|
46
38
|
|
|
47
39
|
/**
|
|
48
|
-
Return application elements tree in form of xml string
|
|
40
|
+
Return application elements tree in a form of xml string
|
|
41
|
+
with default options.
|
|
42
|
+
|
|
43
|
+
@return nil if there was a failure while retriveing the page source.
|
|
49
44
|
*/
|
|
50
45
|
- (nullable NSString *)fb_xmlRepresentation;
|
|
51
46
|
|
|
52
47
|
/**
|
|
53
|
-
Return application elements tree in form of xml string
|
|
48
|
+
Return application elements tree in a form of xml string
|
|
54
49
|
|
|
55
|
-
@param
|
|
56
|
-
|
|
57
|
-
@returns The XML representation of the current element as a string
|
|
50
|
+
@param options Optional values that affect the resulting XML generation process.
|
|
51
|
+
@return nil if there was a failure while retriveing the page source.
|
|
58
52
|
*/
|
|
59
|
-
- (NSString *)
|
|
53
|
+
- (nullable NSString *)fb_xmlRepresentationWithOptions:(nullable FBXMLGenerationOptions *)options;
|
|
60
54
|
|
|
61
55
|
/**
|
|
62
56
|
Return application elements tree in form of internal XCTest debugDescription string
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
#import "FBXPath.h"
|
|
21
21
|
#import "FBXCTestDaemonsProxy.h"
|
|
22
22
|
#import "FBXCAXClientProxy.h"
|
|
23
|
+
#import "FBXMLGenerationOptions.h"
|
|
23
24
|
#import "XCAccessibilityElement.h"
|
|
24
25
|
#import "XCElementSnapshot+FBHelpers.h"
|
|
25
26
|
#import "XCUIDevice+FBHelpers.h"
|
|
@@ -180,15 +181,12 @@ static NSString* const FBUnknownBundleId = @"unknown";
|
|
|
180
181
|
|
|
181
182
|
- (NSString *)fb_xmlRepresentation
|
|
182
183
|
{
|
|
183
|
-
return [
|
|
184
|
+
return [self fb_xmlRepresentationWithOptions:nil];
|
|
184
185
|
}
|
|
185
186
|
|
|
186
|
-
- (NSString *)
|
|
187
|
+
- (NSString *)fb_xmlRepresentationWithOptions:(FBXMLGenerationOptions *)options
|
|
187
188
|
{
|
|
188
|
-
|
|
189
|
-
#pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion"
|
|
190
|
-
return [FBXPath xmlStringWithRootElement:self excludingAttributes:excludedAttributes];
|
|
191
|
-
#pragma clang diagnostic pop
|
|
189
|
+
return [FBXPath xmlStringWithRootElement:self options:options];
|
|
192
190
|
}
|
|
193
191
|
|
|
194
192
|
- (NSString *)fb_descriptionRepresentation
|
|
@@ -219,22 +217,6 @@ static NSString* const FBUnknownBundleId = @"unknown";
|
|
|
219
217
|
}
|
|
220
218
|
#endif
|
|
221
219
|
|
|
222
|
-
- (BOOL)fb_resetAuthorizationStatusForResource:(long long)resourceId error:(NSError **)error
|
|
223
|
-
{
|
|
224
|
-
SEL selector = NSSelectorFromString(@"resetAuthorizationStatusForResource:");
|
|
225
|
-
if (![self respondsToSelector:selector]) {
|
|
226
|
-
return [[[FBErrorBuilder builder]
|
|
227
|
-
withDescription:@"'resetAuthorizationStatusForResource' API is only supported for Xcode SDK 11.4 and later"]
|
|
228
|
-
buildError:error];
|
|
229
|
-
}
|
|
230
|
-
NSMethodSignature *signature = [self methodSignatureForSelector:selector];
|
|
231
|
-
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
|
|
232
|
-
[invocation setSelector:selector];
|
|
233
|
-
[invocation setArgument:&resourceId atIndex:2]; // 0 and 1 are reserved
|
|
234
|
-
[invocation invokeWithTarget:self];
|
|
235
|
-
return YES;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
220
|
- (BOOL)fb_dismissKeyboardWithKeyNames:(nullable NSArray<NSString *> *)keyNames
|
|
239
221
|
error:(NSError **)error
|
|
240
222
|
{
|
|
@@ -16,8 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
16
16
|
* Performs swipe gesture on the element
|
|
17
17
|
*
|
|
18
18
|
* @param direction Swipe direction. The following values are supported: up, down, left and right
|
|
19
|
-
* @param velocity Swipe speed in pixels per second
|
|
20
|
-
* nil value means that the default velocity is going to be used.
|
|
19
|
+
* @param velocity Swipe speed in pixels per second
|
|
21
20
|
*/
|
|
22
21
|
- (void)fb_swipeWithDirection:(NSString *)direction velocity:(nullable NSNumber*)velocity;
|
|
23
22
|
|
|
@@ -18,11 +18,7 @@
|
|
|
18
18
|
{
|
|
19
19
|
double velocityValue = .0;
|
|
20
20
|
if (nil != velocity) {
|
|
21
|
-
|
|
22
|
-
velocityValue = [velocity doubleValue];
|
|
23
|
-
} else {
|
|
24
|
-
[FBLogger log:@"Custom velocity values are only supported since Xcode SDK 11.4. The default velocity will be used instead"];
|
|
25
|
-
}
|
|
21
|
+
velocityValue = [velocity doubleValue];
|
|
26
22
|
}
|
|
27
23
|
|
|
28
24
|
if (velocityValue > 0) {
|
|
@@ -45,13 +45,7 @@
|
|
|
45
45
|
{
|
|
46
46
|
NSError *error = nil;
|
|
47
47
|
self.fb_isResolvedFromCache = @(NO);
|
|
48
|
-
|
|
49
|
-
self.lastSnapshot = [self.fb_query fb_uniqueSnapshotWithError:&error];
|
|
50
|
-
} else {
|
|
51
|
-
self.lastSnapshot = nil;
|
|
52
|
-
// TODO: Remove this branch after Xcode10 support is dropped
|
|
53
|
-
[self fb_resolveWithError:&error];
|
|
54
|
-
}
|
|
48
|
+
self.lastSnapshot = [self.fb_query fb_uniqueSnapshotWithError:&error];
|
|
55
49
|
if (nil == self.lastSnapshot) {
|
|
56
50
|
NSString *hintText = @"Make sure the application UI has the expected state";
|
|
57
51
|
if (nil != error
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
|
|
39
39
|
+ (id<FBResponsePayload>)handleAlertGetTextCommand:(FBRouteRequest *)request
|
|
40
40
|
{
|
|
41
|
-
|
|
42
|
-
NSString *alertText = [FBAlert alertWithApplication:
|
|
41
|
+
FBApplication *application = request.session.activeApplication ?: FBApplication.fb_activeApplication;
|
|
42
|
+
NSString *alertText = [FBAlert alertWithApplication:application].text;
|
|
43
43
|
if (!alertText) {
|
|
44
44
|
return FBResponseWithStatus([FBCommandStatus noAlertOpenErrorWithMessage:nil
|
|
45
45
|
traceback:nil]);
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
|
|
74
74
|
+ (id<FBResponsePayload>)handleAlertAcceptCommand:(FBRouteRequest *)request
|
|
75
75
|
{
|
|
76
|
-
|
|
76
|
+
FBApplication *application = request.session.activeApplication ?: FBApplication.fb_activeApplication;
|
|
77
77
|
NSString *name = request.arguments[@"name"];
|
|
78
|
-
FBAlert *alert = [FBAlert alertWithApplication:
|
|
78
|
+
FBAlert *alert = [FBAlert alertWithApplication:application];
|
|
79
79
|
NSError *error;
|
|
80
80
|
|
|
81
81
|
if (!alert.isPresent) {
|
|
@@ -96,9 +96,9 @@
|
|
|
96
96
|
|
|
97
97
|
+ (id<FBResponsePayload>)handleAlertDismissCommand:(FBRouteRequest *)request
|
|
98
98
|
{
|
|
99
|
-
|
|
99
|
+
FBApplication *application = request.session.activeApplication ?: FBApplication.fb_activeApplication;
|
|
100
100
|
NSString *name = request.arguments[@"name"];
|
|
101
|
-
FBAlert *alert = [FBAlert alertWithApplication:
|
|
101
|
+
FBAlert *alert = [FBAlert alertWithApplication:application];
|
|
102
102
|
NSError *error;
|
|
103
103
|
|
|
104
104
|
if (!alert.isPresent) {
|
|
@@ -292,11 +292,7 @@
|
|
|
292
292
|
NSString *errMsg = @"The 'resource' argument must be set to a valid resource identifier (numeric value). See https://developer.apple.com/documentation/xctest/xcuiprotectedresource?language=objc";
|
|
293
293
|
return FBResponseWithStatus([FBCommandStatus invalidArgumentErrorWithMessage:errMsg traceback:nil]);
|
|
294
294
|
}
|
|
295
|
-
|
|
296
|
-
if (![request.session.activeApplication fb_resetAuthorizationStatusForResource:resource.longLongValue
|
|
297
|
-
error:&error]) {
|
|
298
|
-
return FBResponseWithUnknownError(error);
|
|
299
|
-
}
|
|
295
|
+
[request.session.activeApplication resetAuthorizationStatusForResource:(XCUIProtectedResource)resource.longLongValue];
|
|
300
296
|
return FBResponseWithOK();
|
|
301
297
|
}
|
|
302
298
|
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
#import "FBApplication.h"
|
|
13
13
|
#import "FBRouteRequest.h"
|
|
14
14
|
#import "FBSession.h"
|
|
15
|
+
#import "FBXMLGenerationOptions.h"
|
|
15
16
|
#import "XCUIApplication+FBHelpers.h"
|
|
16
17
|
#import "XCUIElement+FBUtilities.h"
|
|
17
18
|
#import "FBXPath.h"
|
|
@@ -43,14 +44,16 @@ static NSString *const SOURCE_FORMAT_DESCRIPTION = @"description";
|
|
|
43
44
|
// This method might be called without session
|
|
44
45
|
FBApplication *application = request.session.activeApplication ?: FBApplication.fb_activeApplication;
|
|
45
46
|
NSString *sourceType = request.parameters[@"format"] ?: SOURCE_FORMAT_XML;
|
|
47
|
+
NSString *sourceScope = request.parameters[@"scope"];
|
|
46
48
|
id result;
|
|
47
49
|
if ([sourceType caseInsensitiveCompare:SOURCE_FORMAT_XML] == NSOrderedSame) {
|
|
48
50
|
NSArray<NSString *> *excludedAttributes = nil == request.parameters[@"excluded_attributes"]
|
|
49
51
|
? nil
|
|
50
52
|
: [request.parameters[@"excluded_attributes"] componentsSeparatedByString:@","];
|
|
51
|
-
result =
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
result = [application fb_xmlRepresentationWithOptions:
|
|
54
|
+
[[[FBXMLGenerationOptions new]
|
|
55
|
+
withExcludedAttributes:excludedAttributes]
|
|
56
|
+
withScope:sourceScope]];
|
|
54
57
|
} else if ([sourceType caseInsensitiveCompare:SOURCE_FORMAT_JSON] == NSOrderedSame) {
|
|
55
58
|
result = application.fb_tree;
|
|
56
59
|
} else if ([sourceType caseInsensitiveCompare:SOURCE_FORMAT_DESCRIPTION] == NSOrderedSame) {
|
|
@@ -133,23 +133,12 @@ static const NSTimeInterval APP_STATE_CHANGE_TIMEOUT = 5.0;
|
|
|
133
133
|
[[FBXCAXClientProxy.sharedClient systemApplication] processIdentifier]];
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
+ (instancetype)appWithPID:(pid_t)processID
|
|
137
|
-
{
|
|
138
|
-
if ([NSProcessInfo processInfo].processIdentifier == processID) {
|
|
139
|
-
return nil;
|
|
140
|
-
}
|
|
141
|
-
return [super appWithPID:processID];
|
|
142
|
-
}
|
|
143
|
-
|
|
144
136
|
+ (instancetype)applicationWithPID:(pid_t)processID
|
|
145
137
|
{
|
|
146
138
|
if ([NSProcessInfo processInfo].processIdentifier == processID) {
|
|
147
139
|
return nil;
|
|
148
140
|
}
|
|
149
|
-
|
|
150
|
-
return (FBApplication *)[FBXCAXClientProxy.sharedClient monitoredApplicationWithProcessIdentifier:processID];
|
|
151
|
-
}
|
|
152
|
-
return [super applicationWithPID:processID];
|
|
141
|
+
return (FBApplication *)[FBXCAXClientProxy.sharedClient monitoredApplicationWithProcessIdentifier:processID];
|
|
153
142
|
}
|
|
154
143
|
|
|
155
144
|
- (void)launch
|
|
@@ -23,18 +23,15 @@
|
|
|
23
23
|
{
|
|
24
24
|
[super setUp];
|
|
25
25
|
self.continueAfterFailure = YES;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(_XCTestCaseImplementation *)[FBXCTestCaseImplementationFailureHoldingProxy
|
|
30
|
-
proxyWithXCTestCaseImplementation:self.internalImplementation];
|
|
31
|
-
} else {
|
|
32
|
-
// https://github.com/appium/appium/issues/13949
|
|
33
|
-
self.shouldSetShouldHaltWhenReceivesControl = NO;
|
|
34
|
-
self.shouldHaltWhenReceivesControl = NO;
|
|
35
|
-
}
|
|
26
|
+
// https://github.com/appium/appium/issues/13949
|
|
27
|
+
self.shouldSetShouldHaltWhenReceivesControl = NO;
|
|
28
|
+
self.shouldHaltWhenReceivesControl = NO;
|
|
36
29
|
}
|
|
37
30
|
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
Override 'recordFailureWithDescription' to not stop by failures.
|
|
34
|
+
*/
|
|
38
35
|
- (void)recordFailureWithDescription:(NSString *)description
|
|
39
36
|
inFile:(NSString *)filePath
|
|
40
37
|
atLine:(NSUInteger)lineNumber
|
|
@@ -35,7 +35,9 @@
|
|
|
35
35
|
if (!mainStatusBar || (expectVisibleBar && !mainStatusBar.fb_isVisible)) {
|
|
36
36
|
return CGSizeZero;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
CGSize result = mainStatusBar.frame.size;
|
|
39
|
+
// Workaround for https://github.com/appium/appium/issues/15961
|
|
40
|
+
return CGSizeMake(MAX(result.width, result.height), MIN(result.width, result.height));
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
@end
|
|
@@ -519,22 +519,10 @@ static NSString *const FB_KEY_ACTIONS = @"actions";
|
|
|
519
519
|
// TODO: The current approach throws zero division error on execution
|
|
520
520
|
// NSUInteger modifiers = [self collectModifersWithItems:allItems currentItemIndex:currentItemIndex];
|
|
521
521
|
// [resultPath setModifiers:modifiers mergeWithCurrentModifierFlags:NO atOffset:0];
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
} else if ([resultPath respondsToSelector:@selector(typeText:atOffset:typingSpeed:shouldRedact:)]) {
|
|
527
|
-
[resultPath typeText:text
|
|
528
|
-
atOffset:offset
|
|
529
|
-
typingSpeed:FBConfiguration.maxTypingFrequency
|
|
530
|
-
shouldRedact:YES];
|
|
531
|
-
} else {
|
|
532
|
-
NSString *description = @"typeText: selector signature has been unexpectedly changed in the current XCTest SDK. Consider switching to the most recent WDA version";
|
|
533
|
-
if (error) {
|
|
534
|
-
*error = [[FBErrorBuilder.builder withDescription:description] build];
|
|
535
|
-
}
|
|
536
|
-
return nil;
|
|
537
|
-
}
|
|
522
|
+
[resultPath typeText:text
|
|
523
|
+
atOffset:offset
|
|
524
|
+
typingSpeed:FBConfiguration.maxTypingFrequency
|
|
525
|
+
shouldRedact:YES];
|
|
538
526
|
return @[resultPath];
|
|
539
527
|
}
|
|
540
528
|
|
|
@@ -52,11 +52,7 @@ static id FBAXClient = nil;
|
|
|
52
52
|
static dispatch_once_t onceToken;
|
|
53
53
|
dispatch_once(&onceToken, ^{
|
|
54
54
|
instance = [[self alloc] init];
|
|
55
|
-
|
|
56
|
-
FBAXClient = [XCAXClient_iOS sharedClient];
|
|
57
|
-
} else {
|
|
58
|
-
FBAXClient = [XCUIDevice.sharedDevice accessibilityInterface];
|
|
59
|
-
}
|
|
55
|
+
FBAXClient = [XCUIDevice.sharedDevice accessibilityInterface];
|
|
60
56
|
});
|
|
61
57
|
return instance;
|
|
62
58
|
}
|
|
@@ -81,18 +77,13 @@ static id FBAXClient = nil;
|
|
|
81
77
|
[parameters addEntriesFromDictionary:self.defaultParameters];
|
|
82
78
|
parameters[FBSnapshotMaxDepthKey] = maxDepth;
|
|
83
79
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
return [FBAXClient snapshotForElement:element
|
|
93
|
-
attributes:attributes
|
|
94
|
-
parameters:[parameters copy]
|
|
95
|
-
error:error];
|
|
80
|
+
|
|
81
|
+
id result = [FBAXClient requestSnapshotForElement:element
|
|
82
|
+
attributes:attributes
|
|
83
|
+
parameters:[parameters copy]
|
|
84
|
+
error:error];
|
|
85
|
+
XCElementSnapshot *snapshot = [result valueForKey:@"_rootElementSnapshot"];
|
|
86
|
+
return nil == snapshot ? result : snapshot;
|
|
96
87
|
}
|
|
97
88
|
|
|
98
89
|
- (NSArray<XCAccessibilityElement *> *)activeApplications
|
|
@@ -119,27 +110,14 @@ static id FBAXClient = nil;
|
|
|
119
110
|
- (NSDictionary *)attributesForElement:(XCAccessibilityElement *)element
|
|
120
111
|
attributes:(NSArray *)attributes
|
|
121
112
|
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
[FBLogger logFmt:@"Cannot retrieve element attribute(s) %@. Original error: %@", attributes, error.description];
|
|
129
|
-
}
|
|
130
|
-
return result;
|
|
113
|
+
NSError *error = nil;
|
|
114
|
+
NSDictionary* result = [FBAXClient attributesForElement:element
|
|
115
|
+
attributes:attributes
|
|
116
|
+
error:&error];
|
|
117
|
+
if (error) {
|
|
118
|
+
[FBLogger logFmt:@"Cannot retrieve element attribute(s) %@. Original error: %@", attributes, error.description];
|
|
131
119
|
}
|
|
132
|
-
return
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
- (BOOL)hasProcessTracker
|
|
136
|
-
{
|
|
137
|
-
static BOOL hasTracker;
|
|
138
|
-
static dispatch_once_t onceToken;
|
|
139
|
-
dispatch_once(&onceToken, ^{
|
|
140
|
-
hasTracker = [FBAXClient respondsToSelector:@selector(applicationProcessTracker)];
|
|
141
|
-
});
|
|
142
|
-
return hasTracker;
|
|
120
|
+
return result;
|
|
143
121
|
}
|
|
144
122
|
|
|
145
123
|
- (XCUIApplication *)monitoredApplicationWithProcessIdentifier:(int)pid
|
|
@@ -50,12 +50,7 @@ static dispatch_once_t onceTestRunnerDaemonClass;
|
|
|
50
50
|
|
|
51
51
|
+ (id<XCTestManager_ManagerInterface>)retrieveTestRunnerProxy
|
|
52
52
|
{
|
|
53
|
-
|
|
54
|
-
[[XCTestDriver sharedTestDriver] respondsToSelector:@selector(managerProxy)]) {
|
|
55
|
-
return [XCTestDriver sharedTestDriver].managerProxy;
|
|
56
|
-
} else {
|
|
57
|
-
return ((XCTRunnerDaemonSession *)[FBXCTRunnerDaemonSessionClass sharedSession]).daemonProxy;
|
|
58
|
-
}
|
|
53
|
+
return ((XCTRunnerDaemonSession *)[FBXCTRunnerDaemonSessionClass sharedSession]).daemonProxy;
|
|
59
54
|
}
|
|
60
55
|
|
|
61
56
|
#if !TARGET_OS_TV
|
|
@@ -87,15 +82,9 @@ static dispatch_once_t onceTestRunnerDaemonClass;
|
|
|
87
82
|
XCEventGeneratorHandler handlerBlock = ^(XCSynthesizedEventRecord *innerRecord, NSError *invokeError) {
|
|
88
83
|
errorHandler(invokeError);
|
|
89
84
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}];
|
|
94
|
-
} else {
|
|
95
|
-
[[FBXCTRunnerDaemonSessionClass sharedSession] synthesizeEvent:record completion:^(NSError *invokeError){
|
|
96
|
-
handlerBlock(record, invokeError);
|
|
97
|
-
}];
|
|
98
|
-
}
|
|
85
|
+
[[XCUIDevice.sharedDevice eventSynthesizer] synthesizeEvent:record completion:(id)^(BOOL result, NSError *invokeError) {
|
|
86
|
+
handlerBlock(record, invokeError);
|
|
87
|
+
}];
|
|
99
88
|
}
|
|
100
89
|
}];
|
|
101
90
|
return didSucceed;
|
|
@@ -34,8 +34,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
34
34
|
*/
|
|
35
35
|
@interface XCElementSnapshot (FBCompatibility)
|
|
36
36
|
|
|
37
|
-
- (nullable XCElementSnapshot *)fb_rootElement;
|
|
38
|
-
|
|
39
37
|
+ (nullable SEL)fb_attributesForElementSnapshotKeyPathsSelector;
|
|
40
38
|
|
|
41
39
|
@end
|
|
@@ -93,11 +91,6 @@ extern NSString *const FBApplicationMethodNotSupportedException;
|
|
|
93
91
|
*/
|
|
94
92
|
- (nullable XCElementSnapshot *)fb_uniqueSnapshotWithError:(NSError **)error;
|
|
95
93
|
|
|
96
|
-
/**
|
|
97
|
-
@returns YES if the element supports unique snapshots retrieval
|
|
98
|
-
*/
|
|
99
|
-
- (BOOL)fb_isUniqueSnapshotSupported;
|
|
100
|
-
|
|
101
94
|
@end
|
|
102
95
|
|
|
103
96
|
|
|
@@ -110,16 +103,6 @@ extern NSString *const FBApplicationMethodNotSupportedException;
|
|
|
110
103
|
|
|
111
104
|
@interface XCUIElement (FBCompatibility)
|
|
112
105
|
|
|
113
|
-
/**
|
|
114
|
-
Enforces snapshot resolution of the destination element.
|
|
115
|
-
!!! Do not cal this method on Xcode 11 or later due to performance considerations.
|
|
116
|
-
Prefer using fb_takeSnapshot instead.
|
|
117
|
-
|
|
118
|
-
@param error Contains the actual error if element resolution fails
|
|
119
|
-
@returns YES if the element has been successfully resolved
|
|
120
|
-
*/
|
|
121
|
-
- (BOOL)fb_resolveWithError:(NSError **)error;
|
|
122
|
-
|
|
123
106
|
/**
|
|
124
107
|
Determines whether current iOS SDK supports non modal elements inlusion into snapshots
|
|
125
108
|
|
|
@@ -19,21 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
static const NSTimeInterval APP_STATE_CHANGE_TIMEOUT = 5.0;
|
|
21
21
|
|
|
22
|
-
static BOOL FBShouldUseOldElementRootSelector = NO;
|
|
23
|
-
static dispatch_once_t onceRootElementToken;
|
|
24
22
|
@implementation XCElementSnapshot (FBCompatibility)
|
|
25
23
|
|
|
26
|
-
- (XCElementSnapshot *)fb_rootElement
|
|
27
|
-
{
|
|
28
|
-
dispatch_once(&onceRootElementToken, ^{
|
|
29
|
-
FBShouldUseOldElementRootSelector = [self respondsToSelector:@selector(_rootElement)];
|
|
30
|
-
});
|
|
31
|
-
if (FBShouldUseOldElementRootSelector) {
|
|
32
|
-
return [self _rootElement];
|
|
33
|
-
}
|
|
34
|
-
return [self rootElement];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
24
|
+ (id)fb_axAttributesForElementSnapshotKeyPathsIOS:(id)arg1
|
|
38
25
|
{
|
|
39
26
|
return [self.class axAttributesForElementSnapshotKeyPaths:arg1 isMacOS:NO];
|
|
@@ -44,9 +31,7 @@ static dispatch_once_t onceRootElementToken;
|
|
|
44
31
|
static SEL attributesForElementSnapshotKeyPathsSelector = nil;
|
|
45
32
|
static dispatch_once_t attributesForElementSnapshotKeyPathsSelectorToken;
|
|
46
33
|
dispatch_once(&attributesForElementSnapshotKeyPathsSelectorToken, ^{
|
|
47
|
-
if ([self.class respondsToSelector:@selector(
|
|
48
|
-
attributesForElementSnapshotKeyPathsSelector = @selector(snapshotAttributesForElementSnapshotKeyPaths:);
|
|
49
|
-
} else if ([self.class respondsToSelector:@selector(axAttributesForElementSnapshotKeyPaths:)]) {
|
|
34
|
+
if ([self.class respondsToSelector:@selector(axAttributesForElementSnapshotKeyPaths:)]) {
|
|
50
35
|
attributesForElementSnapshotKeyPathsSelector = @selector(axAttributesForElementSnapshotKeyPaths:);
|
|
51
36
|
} else if ([self.class respondsToSelector:@selector(axAttributesForElementSnapshotKeyPaths:isMacOS:)]) {
|
|
52
37
|
attributesForElementSnapshotKeyPathsSelector = @selector(fb_axAttributesForElementSnapshotKeyPathsIOS:);
|
|
@@ -60,22 +45,14 @@ static dispatch_once_t onceRootElementToken;
|
|
|
60
45
|
|
|
61
46
|
NSString *const FBApplicationMethodNotSupportedException = @"FBApplicationMethodNotSupportedException";
|
|
62
47
|
|
|
63
|
-
static BOOL FBShouldUseOldAppWithPIDSelector = NO;
|
|
64
|
-
static dispatch_once_t onceAppWithPIDToken;
|
|
65
48
|
@implementation XCUIApplication (FBCompatibility)
|
|
66
49
|
|
|
67
50
|
+ (instancetype)fb_applicationWithPID:(pid_t)processID
|
|
68
51
|
{
|
|
69
|
-
dispatch_once(&onceAppWithPIDToken, ^{
|
|
70
|
-
FBShouldUseOldAppWithPIDSelector = [XCUIApplication respondsToSelector:@selector(appWithPID:)];
|
|
71
|
-
});
|
|
72
52
|
if (0 == processID) {
|
|
73
53
|
return nil;
|
|
74
54
|
}
|
|
75
55
|
|
|
76
|
-
if (FBShouldUseOldAppWithPIDSelector) {
|
|
77
|
-
return [self appWithPID:processID];
|
|
78
|
-
}
|
|
79
56
|
return [self applicationWithPID:processID];
|
|
80
57
|
}
|
|
81
58
|
|
|
@@ -105,16 +82,6 @@ static dispatch_once_t onceAppWithPIDToken;
|
|
|
105
82
|
|
|
106
83
|
@implementation XCUIElementQuery (FBCompatibility)
|
|
107
84
|
|
|
108
|
-
- (BOOL)fb_isUniqueSnapshotSupported
|
|
109
|
-
{
|
|
110
|
-
static dispatch_once_t onceToken;
|
|
111
|
-
static BOOL isUniqueMatchingSnapshotAvailable;
|
|
112
|
-
dispatch_once(&onceToken, ^{
|
|
113
|
-
isUniqueMatchingSnapshotAvailable = [self respondsToSelector:@selector(uniqueMatchingSnapshotWithError:)];
|
|
114
|
-
});
|
|
115
|
-
return isUniqueMatchingSnapshotAvailable;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
85
|
- (XCElementSnapshot *)fb_uniqueSnapshotWithError:(NSError **)error
|
|
119
86
|
{
|
|
120
87
|
return [self uniqueMatchingSnapshotWithError:error];
|
|
@@ -140,27 +107,6 @@ static dispatch_once_t onceAppWithPIDToken;
|
|
|
140
107
|
|
|
141
108
|
@implementation XCUIElement (FBCompatibility)
|
|
142
109
|
|
|
143
|
-
- (BOOL)fb_resolveWithError:(NSError **)error
|
|
144
|
-
{
|
|
145
|
-
@try {
|
|
146
|
-
// The order here matters
|
|
147
|
-
if ([self respondsToSelector:@selector(resolveOrRaiseTestFailure)]) {
|
|
148
|
-
[self resolveOrRaiseTestFailure];
|
|
149
|
-
return YES;
|
|
150
|
-
} else if ([self respondsToSelector:@selector(resolve:)]) {
|
|
151
|
-
return [self resolve:error];
|
|
152
|
-
} else if ([self respondsToSelector:@selector(resolve)]) {
|
|
153
|
-
[self resolve];
|
|
154
|
-
return nil != self.lastSnapshot;
|
|
155
|
-
}
|
|
156
|
-
} @catch (NSException *e) {
|
|
157
|
-
if (nil != e.reason) {
|
|
158
|
-
return [[FBErrorBuilder.builder withDescription:(NSString *)e.reason] buildError:error];
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return [[FBErrorBuilder.builder withDescription:@"Cannot find a matching method to resolve elements. Please contact Appium developers"] buildError:error];
|
|
162
|
-
}
|
|
163
|
-
|
|
164
110
|
+ (BOOL)fb_supportsNonModalElementsInclusion
|
|
165
111
|
{
|
|
166
112
|
static dispatch_once_t hasIncludingNonModalElements;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 <Foundation/Foundation.h>
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
+
|
|
14
|
+
@interface FBXMLGenerationOptions : NSObject
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
XML buidling scope. Passing nil means the XML should be built in the default scope,
|
|
18
|
+
i.e no changes to the original tree structore. If the scope is provided then the resulting
|
|
19
|
+
XML tree will be put under the root, which name is equal to the given scope value.
|
|
20
|
+
*/
|
|
21
|
+
@property (nonatomic, nullable) NSString *scope;
|
|
22
|
+
/**
|
|
23
|
+
The list of attribute names to exclude from the resulting document.
|
|
24
|
+
Passing nil means all the available attributes should be included
|
|
25
|
+
*/
|
|
26
|
+
@property (nonatomic, nullable) NSArray<NSString *> *excludedAttributes;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
Allows to provide XML scope.
|
|
30
|
+
|
|
31
|
+
@param scope See the property description above
|
|
32
|
+
@return self instance for chaining
|
|
33
|
+
*/
|
|
34
|
+
- (FBXMLGenerationOptions *)withScope:(nullable NSString *)scope;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
Allows to provide a list of excluded XML attributes.
|
|
38
|
+
|
|
39
|
+
@param excludedAttributes See the property description above
|
|
40
|
+
@return self instance for chaining
|
|
41
|
+
*/
|
|
42
|
+
- (FBXMLGenerationOptions *)withExcludedAttributes:(nullable NSArray<NSString *> *)excludedAttributes;
|
|
43
|
+
|
|
44
|
+
@end
|
|
45
|
+
|
|
46
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,26 @@
|
|
|
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 "FBXMLGenerationOptions.h"
|
|
11
|
+
|
|
12
|
+
@implementation FBXMLGenerationOptions
|
|
13
|
+
|
|
14
|
+
- (FBXMLGenerationOptions *)withScope:(NSString *)scope
|
|
15
|
+
{
|
|
16
|
+
self.scope = scope;
|
|
17
|
+
return self;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
- (FBXMLGenerationOptions *)withExcludedAttributes:(NSArray<NSString *> *)excludedAttributes
|
|
21
|
+
{
|
|
22
|
+
self.excludedAttributes = excludedAttributes;
|
|
23
|
+
return self;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@end
|