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
|
@@ -19,30 +19,6 @@
|
|
|
19
19
|
|
|
20
20
|
static const NSTimeInterval APP_STATE_CHANGE_TIMEOUT = 5.0;
|
|
21
21
|
|
|
22
|
-
@implementation XCElementSnapshot (FBCompatibility)
|
|
23
|
-
|
|
24
|
-
+ (id)fb_axAttributesForElementSnapshotKeyPathsIOS:(id)arg1
|
|
25
|
-
{
|
|
26
|
-
return [self.class axAttributesForElementSnapshotKeyPaths:arg1 isMacOS:NO];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
+ (nullable SEL)fb_attributesForElementSnapshotKeyPathsSelector
|
|
30
|
-
{
|
|
31
|
-
static SEL attributesForElementSnapshotKeyPathsSelector = nil;
|
|
32
|
-
static dispatch_once_t attributesForElementSnapshotKeyPathsSelectorToken;
|
|
33
|
-
dispatch_once(&attributesForElementSnapshotKeyPathsSelectorToken, ^{
|
|
34
|
-
if ([self.class respondsToSelector:@selector(axAttributesForElementSnapshotKeyPaths:)]) {
|
|
35
|
-
attributesForElementSnapshotKeyPathsSelector = @selector(axAttributesForElementSnapshotKeyPaths:);
|
|
36
|
-
} else if ([self.class respondsToSelector:@selector(axAttributesForElementSnapshotKeyPaths:isMacOS:)]) {
|
|
37
|
-
attributesForElementSnapshotKeyPathsSelector = @selector(fb_axAttributesForElementSnapshotKeyPathsIOS:);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
return attributesForElementSnapshotKeyPathsSelector;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
@end
|
|
44
|
-
|
|
45
|
-
|
|
46
22
|
NSString *const FBApplicationMethodNotSupportedException = @"FBApplicationMethodNotSupportedException";
|
|
47
23
|
|
|
48
24
|
@implementation XCUIApplication (FBCompatibility)
|
|
@@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
25
25
|
If `query` argument is assigned then `excludedAttributes` argument is effectively ignored.
|
|
26
26
|
@return zero if the method has completed successfully
|
|
27
27
|
*/
|
|
28
|
-
+ (int)xmlRepresentationWithRootElement:(
|
|
28
|
+
+ (int)xmlRepresentationWithRootElement:(id<FBElement>)root
|
|
29
29
|
writer:(xmlTextWriterPtr)writer
|
|
30
30
|
elementStore:(nullable NSMutableDictionary *)elementStore
|
|
31
31
|
query:(nullable NSString*)query
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
#import <XCTest/XCTest.h>
|
|
11
11
|
#import <WebDriverAgentLib/FBElement.h>
|
|
12
|
-
#import
|
|
12
|
+
#import "FBXCElementSnapshot.h"
|
|
13
13
|
|
|
14
14
|
#ifdef __clang__
|
|
15
15
|
#pragma clang diagnostic push
|
|
@@ -41,8 +41,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
41
41
|
@return an array of descendants matching the given xpath query or an empty array if no matches were found
|
|
42
42
|
@throws NSException if there is an unexpected internal error during xml parsing
|
|
43
43
|
*/
|
|
44
|
-
+ (NSArray<
|
|
45
|
-
|
|
44
|
+
+ (NSArray<id<FBXCElementSnapshot>> *)matchesWithRootElement:(id<FBElement>)root
|
|
45
|
+
forQuery:(NSString *)xpathQuery;
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
Gets XML representation of XCElementSnapshot with all its descendants. This method generates the same
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
#import "FBExceptions.h"
|
|
14
14
|
#import "FBLogger.h"
|
|
15
15
|
#import "FBXMLGenerationOptions.h"
|
|
16
|
+
#import "FBXCElementSnapshotWrapper+Helpers.h"
|
|
16
17
|
#import "NSString+FBXMLSafeString.h"
|
|
17
|
-
#import "XCElementSnapshot+FBHelpers.h"
|
|
18
18
|
#import "XCUIElement.h"
|
|
19
19
|
#import "XCUIElement+FBCaching.h"
|
|
20
20
|
#import "XCUIElement+FBUtilities.h"
|
|
@@ -172,8 +172,8 @@ static NSString *const topNodeIndexPath = @"top";
|
|
|
172
172
|
return result;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
+ (NSArray<
|
|
176
|
-
|
|
175
|
+
+ (NSArray<id<FBXCElementSnapshot>> *)matchesWithRootElement:(id<FBElement>)root
|
|
176
|
+
forQuery:(NSString *)xpathQuery
|
|
177
177
|
{
|
|
178
178
|
xmlDocPtr doc;
|
|
179
179
|
|
|
@@ -238,7 +238,7 @@ static NSString *const topNodeIndexPath = @"top";
|
|
|
238
238
|
[FBLogger log:@"Failed to invoke libxml2>xmlGetProp"];
|
|
239
239
|
return nil;
|
|
240
240
|
}
|
|
241
|
-
|
|
241
|
+
id<FBXCElementSnapshot> element = [elementStore objectForKey:(id)[NSString stringWithCString:(const char *)attrValue encoding:NSUTF8StringEncoding]];
|
|
242
242
|
if (element) {
|
|
243
243
|
[matchingSnapshots addObject:element];
|
|
244
244
|
}
|
|
@@ -325,7 +325,7 @@ static NSString *const topNodeIndexPath = @"top";
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
+ (int)recordElementAttributes:(xmlTextWriterPtr)writer
|
|
328
|
-
forElement:(
|
|
328
|
+
forElement:(id<FBXCElementSnapshot>)element
|
|
329
329
|
indexPath:(nullable NSString *)indexPath
|
|
330
330
|
includedAttributes:(nullable NSSet<Class> *)includedAttributes
|
|
331
331
|
{
|
|
@@ -334,7 +334,8 @@ static NSString *const topNodeIndexPath = @"top";
|
|
|
334
334
|
if (includedAttributes && ![includedAttributes containsObject:attributeCls]) {
|
|
335
335
|
continue;
|
|
336
336
|
}
|
|
337
|
-
int rc = [attributeCls recordWithWriter:writer
|
|
337
|
+
int rc = [attributeCls recordWithWriter:writer
|
|
338
|
+
forElement:[FBXCElementSnapshotWrapper ensureWrapped:element]];
|
|
338
339
|
if (rc < 0) {
|
|
339
340
|
return rc;
|
|
340
341
|
}
|
|
@@ -355,8 +356,8 @@ static NSString *const topNodeIndexPath = @"top";
|
|
|
355
356
|
{
|
|
356
357
|
NSAssert((indexPath == nil && elementStore == nil) || (indexPath != nil && elementStore != nil), @"Either both or none of indexPath and elementStore arguments should be equal to nil", nil);
|
|
357
358
|
|
|
358
|
-
|
|
359
|
-
NSArray<
|
|
359
|
+
id<FBXCElementSnapshot> currentSnapshot;
|
|
360
|
+
NSArray<id<FBXCElementSnapshot>> *children;
|
|
360
361
|
if ([root isKindOfClass:XCUIElement.class]) {
|
|
361
362
|
XCUIElement *element = (XCUIElement *)root;
|
|
362
363
|
NSMutableArray<NSString *> *snapshotAttributes = [NSMutableArray arrayWithArray:FBStandardAttributeNames()];
|
|
@@ -370,7 +371,7 @@ static NSString *const topNodeIndexPath = @"top";
|
|
|
370
371
|
maxDepth:nil];
|
|
371
372
|
children = currentSnapshot.children;
|
|
372
373
|
} else {
|
|
373
|
-
currentSnapshot = (
|
|
374
|
+
currentSnapshot = (id<FBXCElementSnapshot>)root;
|
|
374
375
|
children = currentSnapshot.children;
|
|
375
376
|
}
|
|
376
377
|
|
|
@@ -378,9 +379,10 @@ static NSString *const topNodeIndexPath = @"top";
|
|
|
378
379
|
[elementStore setObject:currentSnapshot forKey:topNodeIndexPath];
|
|
379
380
|
}
|
|
380
381
|
|
|
381
|
-
|
|
382
|
+
FBXCElementSnapshotWrapper *wrappedSnapshot = [FBXCElementSnapshotWrapper ensureWrapped:currentSnapshot];
|
|
383
|
+
int rc = xmlTextWriterStartElement(writer, (xmlChar *)[wrappedSnapshot.wdType UTF8String]);
|
|
382
384
|
if (rc < 0) {
|
|
383
|
-
[FBLogger logFmt:@"Failed to invoke libxml2>xmlTextWriterStartElement for the tag value '%@'. Error code: %d",
|
|
385
|
+
[FBLogger logFmt:@"Failed to invoke libxml2>xmlTextWriterStartElement for the tag value '%@'. Error code: %d", wrappedSnapshot.wdType, rc];
|
|
384
386
|
return rc;
|
|
385
387
|
}
|
|
386
388
|
|
|
@@ -393,12 +395,12 @@ static NSString *const topNodeIndexPath = @"top";
|
|
|
393
395
|
}
|
|
394
396
|
|
|
395
397
|
for (NSUInteger i = 0; i < [children count]; i++) {
|
|
396
|
-
|
|
398
|
+
id<FBXCElementSnapshot> childSnapshot = [children objectAtIndex:i];
|
|
397
399
|
NSString *newIndexPath = (indexPath != nil) ? [indexPath stringByAppendingFormat:@",%lu", (unsigned long)i] : nil;
|
|
398
400
|
if (elementStore != nil && newIndexPath != nil) {
|
|
399
401
|
[elementStore setObject:childSnapshot forKey:(id)newIndexPath];
|
|
400
402
|
}
|
|
401
|
-
rc = [self writeXmlWithRootElement:childSnapshot
|
|
403
|
+
rc = [self writeXmlWithRootElement:[FBXCElementSnapshotWrapper ensureWrapped:childSnapshot]
|
|
402
404
|
indexPath:newIndexPath
|
|
403
405
|
elementStore:elementStore
|
|
404
406
|
includedAttributes:includedAttributes
|
|
@@ -23,7 +23,20 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
23
23
|
@return formatted predicate
|
|
24
24
|
@throw FBUnknownPredicateKeyException in case the given property name is not declared in FBElement protocol
|
|
25
25
|
*/
|
|
26
|
-
+ (
|
|
26
|
+
+ (instancetype)fb_formatSearchPredicate:(NSPredicate *)input;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
Creates a block predicate expression, which properly evalluates the given raw predicate agains
|
|
30
|
+
xctest hierarchy. Vanilla string predicates don't work on this hierachy because "raw" snapshots
|
|
31
|
+
don't have any of the custom properties declared in FBElement protocol.
|
|
32
|
+
`fb_formatSearchPredicate` is called automtically on the original predicate before
|
|
33
|
+
making it to a block.
|
|
34
|
+
|
|
35
|
+
@param input predicate object received from user input
|
|
36
|
+
@return formatted predicate
|
|
37
|
+
@throw FBUnknownPredicateKeyException in case the given property name is not declared in FBElement protocol
|
|
38
|
+
*/
|
|
39
|
+
+ (instancetype)fb_snapshotBlockPredicateWithPredicate:(NSPredicate *)input;
|
|
27
40
|
|
|
28
41
|
@end
|
|
29
42
|
|
|
@@ -9,23 +9,20 @@
|
|
|
9
9
|
|
|
10
10
|
#import "NSPredicate+FBFormat.h"
|
|
11
11
|
|
|
12
|
-
#import "FBPredicate.h"
|
|
13
12
|
#import "NSExpression+FBFormat.h"
|
|
13
|
+
#import "FBXCElementSnapshotWrapper+Helpers.h"
|
|
14
14
|
|
|
15
15
|
@implementation NSPredicate (FBFormat)
|
|
16
16
|
|
|
17
|
-
+ (instancetype)fb_predicateWithPredicate:(NSPredicate *)original
|
|
17
|
+
+ (instancetype)fb_predicateWithPredicate:(NSPredicate *)original
|
|
18
|
+
comparisonModifier:(NSPredicate *(^)(NSComparisonPredicate *))comparisonModifier
|
|
18
19
|
{
|
|
19
20
|
if ([original isKindOfClass:NSCompoundPredicate.class]) {
|
|
20
21
|
NSCompoundPredicate *compPred = (NSCompoundPredicate *)original;
|
|
21
22
|
NSMutableArray *predicates = [NSMutableArray array];
|
|
22
23
|
for (NSPredicate *predicate in [compPred subpredicates]) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
[predicates addObject:predicate];
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
NSPredicate *newPredicate = [self.class fb_predicateWithPredicate:predicate comparisonModifier:comparisonModifier];
|
|
24
|
+
NSPredicate *newPredicate = [self.class fb_predicateWithPredicate:predicate
|
|
25
|
+
comparisonModifier:comparisonModifier];
|
|
29
26
|
if (nil != newPredicate) {
|
|
30
27
|
[predicates addObject:newPredicate];
|
|
31
28
|
}
|
|
@@ -41,7 +38,8 @@
|
|
|
41
38
|
|
|
42
39
|
+ (instancetype)fb_formatSearchPredicate:(NSPredicate *)input
|
|
43
40
|
{
|
|
44
|
-
return [self.class fb_predicateWithPredicate:input
|
|
41
|
+
return [self.class fb_predicateWithPredicate:input
|
|
42
|
+
comparisonModifier:^NSPredicate *(NSComparisonPredicate *cp) {
|
|
45
43
|
NSExpression *left = [NSExpression fb_wdExpressionWithExpression:[cp leftExpression]];
|
|
46
44
|
NSExpression *right = [NSExpression fb_wdExpressionWithExpression:[cp rightExpression]];
|
|
47
45
|
return [NSComparisonPredicate predicateWithLeftExpression:left
|
|
@@ -52,4 +50,15 @@
|
|
|
52
50
|
}];
|
|
53
51
|
}
|
|
54
52
|
|
|
53
|
+
+ (instancetype)fb_snapshotBlockPredicateWithPredicate:(NSPredicate *)input
|
|
54
|
+
{
|
|
55
|
+
NSPredicate *wdPredicate = [self.class fb_formatSearchPredicate:input];
|
|
56
|
+
return [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject,
|
|
57
|
+
NSDictionary<NSString *,id> * _Nullable bindings) {
|
|
58
|
+
FBXCElementSnapshotWrapper *wrappedSnapshot = [FBXCElementSnapshotWrapper ensureWrapped:evaluatedObject];
|
|
59
|
+
return [wdPredicate evaluateWithObject:wrappedSnapshot];
|
|
60
|
+
}];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
55
64
|
@end
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
|
|
14
14
|
#import "FBRuntimeUtils.h"
|
|
15
15
|
#import "FBXCodeCompatibility.h"
|
|
16
|
-
#import "XCElementSnapshot.h"
|
|
17
16
|
|
|
18
17
|
NSNumber *FB_XCAXAIsVisibleAttribute;
|
|
19
18
|
NSString *FB_XCAXAIsVisibleAttributeName = @"XC_kAXXCAttributeIsVisible";
|
|
@@ -56,8 +55,15 @@ void *FBRetrieveXCTestSymbol(const char *name)
|
|
|
56
55
|
|
|
57
56
|
NSArray<NSString*> *FBStandardAttributeNames(void)
|
|
58
57
|
{
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
static NSArray<NSString *> *attributeNames;
|
|
59
|
+
static dispatch_once_t onceToken;
|
|
60
|
+
dispatch_once(&onceToken, ^{
|
|
61
|
+
Class xcElementSnapshotClass = NSClassFromString(@"XCElementSnapshot");
|
|
62
|
+
NSCAssert(nil != xcElementSnapshotClass, @"XCElementSnapshot class must be resolvable", xcElementSnapshotClass);
|
|
63
|
+
attributeNames = [xcElementSnapshotClass sanitizedElementSnapshotHierarchyAttributesForAttributes:nil
|
|
64
|
+
isMacOS:NO];
|
|
65
|
+
});
|
|
66
|
+
return attributeNames;
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
NSArray<NSString*> *FBCustomAttributeNames(void)
|
|
@@ -21,10 +21,16 @@ static NSLock * lock = nil;
|
|
|
21
21
|
|
|
22
22
|
@implementation XCUIApplicationProcessDelay
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
#pragma clang diagnostic push
|
|
25
|
+
#pragma clang diagnostic ignored "-Wobjc-load-method"
|
|
26
|
+
|
|
27
|
+
+ (void)load
|
|
28
|
+
{
|
|
25
29
|
lock = [[NSLock alloc] init];
|
|
26
30
|
}
|
|
27
31
|
|
|
32
|
+
#pragma clang diagnostic pop
|
|
33
|
+
|
|
28
34
|
+ (void)setEventLoopHasIdledDelay:(NSTimeInterval)delay
|
|
29
35
|
{
|
|
30
36
|
[lock lock];
|
|
@@ -703,8 +703,11 @@ enum GCDAsyncSocketConfig
|
|
|
703
703
|
else {
|
|
704
704
|
maxPreBufferLength = preBufferLength;
|
|
705
705
|
}
|
|
706
|
-
|
|
706
|
+
|
|
707
|
+
#pragma clang diagnostic push
|
|
708
|
+
#pragma clang diagnostic ignored "-Wvla"
|
|
707
709
|
uint8_t seq[termLength];
|
|
710
|
+
#pragma clang diagnostic pop
|
|
708
711
|
const void *termBuf = [term bytes];
|
|
709
712
|
|
|
710
713
|
NSUInteger bufLen = MIN(bytesDone, (termLength - 1));
|
|
@@ -7123,7 +7126,10 @@ static OSStatus SSLWriteFunction(SSLConnectionRef connection, const void *data,
|
|
|
7123
7126
|
{
|
|
7124
7127
|
NSArray *cipherSuites = (NSArray *)value;
|
|
7125
7128
|
NSUInteger numberCiphers = [cipherSuites count];
|
|
7129
|
+
#pragma clang diagnostic push
|
|
7130
|
+
#pragma clang diagnostic ignored "-Wvla"
|
|
7126
7131
|
SSLCipherSuite ciphers[numberCiphers];
|
|
7132
|
+
#pragma clang diagnostic pop
|
|
7127
7133
|
|
|
7128
7134
|
NSUInteger cipherIndex;
|
|
7129
7135
|
for (cipherIndex = 0; cipherIndex < numberCiphers; cipherIndex++)
|
|
@@ -39,7 +39,6 @@ FOUNDATION_EXPORT const unsigned char WebDriverAgentLib_VersionString[];
|
|
|
39
39
|
#import <WebDriverAgentLib/FBRuntimeUtils.h>
|
|
40
40
|
#import <WebDriverAgentLib/FBSession.h>
|
|
41
41
|
#import <WebDriverAgentLib/FBWebServer.h>
|
|
42
|
-
#import <WebDriverAgentLib/XCElementSnapshot+FBHelpers.h>
|
|
43
42
|
#import <WebDriverAgentLib/XCUIApplication+FBHelpers.h>
|
|
44
43
|
#import <WebDriverAgentLib/XCUIDevice+FBHelpers.h>
|
|
45
44
|
#import <WebDriverAgentLib/XCUIDevice+FBRotation.h>
|
|
Binary file
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
#import "FBTestMacros.h"
|
|
14
14
|
#import "FBXPath.h"
|
|
15
15
|
#import "FBXCodeCompatibility.h"
|
|
16
|
+
#import "FBXCElementSnapshotWrapper+Helpers.h"
|
|
16
17
|
#import "FBXMLGenerationOptions.h"
|
|
17
18
|
#import "XCUIElement.h"
|
|
18
19
|
#import "XCUIElement+FBFind.h"
|
|
@@ -38,64 +39,70 @@
|
|
|
38
39
|
FBAssertWaitTillBecomesTrue(self.testedView.buttons.count > 0);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
- (
|
|
42
|
+
- (id<FBXCElementSnapshot>)destinationSnapshot
|
|
42
43
|
{
|
|
43
44
|
XCUIElement *matchingElement = self.testedView.buttons.fb_firstMatch;
|
|
44
45
|
FBAssertWaitTillBecomesTrue(nil != matchingElement.fb_takeSnapshot);
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
id<FBXCElementSnapshot> snapshot = matchingElement.fb_takeSnapshot;
|
|
47
48
|
// Over iOS13, snapshot returns a child.
|
|
48
|
-
// The purpose of here is return a single element
|
|
49
|
-
snapshot.children =
|
|
49
|
+
// The purpose of here is return a single element to replace children with an empty array for testing.
|
|
50
|
+
snapshot.children = @[];
|
|
50
51
|
return snapshot;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
- (void)testSingleDescendantXMLRepresentation
|
|
54
55
|
{
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
id<FBXCElementSnapshot> snapshot = self.destinationSnapshot;
|
|
57
|
+
FBXCElementSnapshotWrapper *wrappedSnapshot = [FBXCElementSnapshotWrapper ensureWrapped:snapshot];
|
|
58
|
+
NSString *xmlStr = [FBXPath xmlStringWithRootElement:wrappedSnapshot
|
|
59
|
+
options:nil];
|
|
57
60
|
XCTAssertNotNil(xmlStr);
|
|
58
|
-
NSString *expectedXml = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<%@ type=\"%@\" name=\"%@\" label=\"%@\" enabled=\"%@\" visible=\"%@\" accessible=\"%@\" x=\"%@\" y=\"%@\" width=\"%@\" height=\"%@\" index=\"%lu\"/>\n",
|
|
61
|
+
NSString *expectedXml = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<%@ type=\"%@\" name=\"%@\" label=\"%@\" enabled=\"%@\" visible=\"%@\" accessible=\"%@\" x=\"%@\" y=\"%@\" width=\"%@\" height=\"%@\" index=\"%lu\"/>\n", wrappedSnapshot.wdType, wrappedSnapshot.wdType, wrappedSnapshot.wdName, wrappedSnapshot.wdLabel, wrappedSnapshot.wdEnabled ? @"true" : @"false", wrappedSnapshot.wdVisible ? @"true" : @"false", wrappedSnapshot.wdAccessible ? @"true" : @"false", [wrappedSnapshot.wdRect[@"x"] stringValue], [wrappedSnapshot.wdRect[@"y"] stringValue], [wrappedSnapshot.wdRect[@"width"] stringValue], [wrappedSnapshot.wdRect[@"height"] stringValue], wrappedSnapshot.wdIndex];
|
|
59
62
|
XCTAssertEqualObjects(xmlStr, expectedXml);
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
- (void)testSingleDescendantXMLRepresentationWithScope
|
|
63
66
|
{
|
|
64
|
-
|
|
67
|
+
id<FBXCElementSnapshot> snapshot = self.destinationSnapshot;
|
|
65
68
|
NSString *scope = @"AppiumAUT";
|
|
66
69
|
FBXMLGenerationOptions *options = [[FBXMLGenerationOptions new] withScope:scope];
|
|
67
|
-
|
|
70
|
+
FBXCElementSnapshotWrapper *wrappedSnapshot = [FBXCElementSnapshotWrapper ensureWrapped:snapshot];
|
|
71
|
+
NSString *xmlStr = [FBXPath xmlStringWithRootElement:wrappedSnapshot
|
|
72
|
+
options:options];
|
|
68
73
|
XCTAssertNotNil(xmlStr);
|
|
69
|
-
NSString *expectedXml = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<%@>\n <%@ type=\"%@\" name=\"%@\" label=\"%@\" enabled=\"%@\" visible=\"%@\" accessible=\"%@\" x=\"%@\" y=\"%@\" width=\"%@\" height=\"%@\" index=\"%lu\"/>\n</%@>\n", scope,
|
|
74
|
+
NSString *expectedXml = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<%@>\n <%@ type=\"%@\" name=\"%@\" label=\"%@\" enabled=\"%@\" visible=\"%@\" accessible=\"%@\" x=\"%@\" y=\"%@\" width=\"%@\" height=\"%@\" index=\"%lu\"/>\n</%@>\n", scope, wrappedSnapshot.wdType, wrappedSnapshot.wdType, wrappedSnapshot.wdName, wrappedSnapshot.wdLabel, wrappedSnapshot.wdEnabled ? @"true" : @"false", wrappedSnapshot.wdVisible ? @"true" : @"false", wrappedSnapshot.wdAccessible ? @"true" : @"false", [wrappedSnapshot.wdRect[@"x"] stringValue], [wrappedSnapshot.wdRect[@"y"] stringValue], [wrappedSnapshot.wdRect[@"width"] stringValue], [wrappedSnapshot.wdRect[@"height"] stringValue], wrappedSnapshot.wdIndex, scope];
|
|
70
75
|
XCTAssertEqualObjects(xmlStr, expectedXml);
|
|
71
76
|
}
|
|
72
77
|
|
|
73
78
|
- (void)testSingleDescendantXMLRepresentationWithoutAttributes
|
|
74
79
|
{
|
|
75
|
-
|
|
80
|
+
id<FBXCElementSnapshot> snapshot = self.destinationSnapshot;
|
|
76
81
|
FBXMLGenerationOptions *options = [[FBXMLGenerationOptions new]
|
|
77
82
|
withExcludedAttributes:@[@"visible", @"enabled", @"index", @"blabla"]];
|
|
78
|
-
|
|
83
|
+
FBXCElementSnapshotWrapper *wrappedSnapshot = [FBXCElementSnapshotWrapper ensureWrapped:snapshot];
|
|
84
|
+
NSString *xmlStr = [FBXPath xmlStringWithRootElement:wrappedSnapshot
|
|
85
|
+
options:options];
|
|
79
86
|
XCTAssertNotNil(xmlStr);
|
|
80
|
-
NSString *expectedXml = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<%@ type=\"%@\" name=\"%@\" label=\"%@\" accessible=\"%@\" x=\"%@\" y=\"%@\" width=\"%@\" height=\"%@\"/>\n",
|
|
87
|
+
NSString *expectedXml = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<%@ type=\"%@\" name=\"%@\" label=\"%@\" accessible=\"%@\" x=\"%@\" y=\"%@\" width=\"%@\" height=\"%@\"/>\n", wrappedSnapshot.wdType, wrappedSnapshot.wdType, wrappedSnapshot.wdName, wrappedSnapshot.wdLabel, wrappedSnapshot.wdAccessible ? @"true" : @"false", [wrappedSnapshot.wdRect[@"x"] stringValue], [wrappedSnapshot.wdRect[@"y"] stringValue], [wrappedSnapshot.wdRect[@"width"] stringValue], [wrappedSnapshot.wdRect[@"height"] stringValue]];
|
|
81
88
|
XCTAssertEqualObjects(xmlStr, expectedXml);
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
- (void)testFindMatchesInElement
|
|
85
92
|
{
|
|
86
|
-
NSArray *matchingSnapshots = [FBXPath matchesWithRootElement:self.testedApplication forQuery:@"//XCUIElementTypeButton"];
|
|
93
|
+
NSArray<id<FBXCElementSnapshot>> *matchingSnapshots = [FBXPath matchesWithRootElement:self.testedApplication forQuery:@"//XCUIElementTypeButton"];
|
|
87
94
|
XCTAssertEqual([matchingSnapshots count], 5);
|
|
88
|
-
for (id<
|
|
89
|
-
XCTAssertTrue([element.wdType isEqualToString:@"XCUIElementTypeButton"]);
|
|
95
|
+
for (id<FBXCElementSnapshot> element in matchingSnapshots) {
|
|
96
|
+
XCTAssertTrue([[FBXCElementSnapshotWrapper ensureWrapped:element].wdType isEqualToString:@"XCUIElementTypeButton"]);
|
|
90
97
|
}
|
|
91
98
|
}
|
|
92
99
|
|
|
93
100
|
- (void)testFindMatchesInElementWithDotNotation
|
|
94
101
|
{
|
|
95
|
-
NSArray *matchingSnapshots = [FBXPath matchesWithRootElement:self.testedApplication forQuery:@".//XCUIElementTypeButton"];
|
|
102
|
+
NSArray<id<FBXCElementSnapshot>> *matchingSnapshots = [FBXPath matchesWithRootElement:self.testedApplication forQuery:@".//XCUIElementTypeButton"];
|
|
96
103
|
XCTAssertEqual([matchingSnapshots count], 5);
|
|
97
|
-
for (id<
|
|
98
|
-
XCTAssertTrue([element.wdType isEqualToString:@"XCUIElementTypeButton"]);
|
|
104
|
+
for (id<FBXCElementSnapshot> element in matchingSnapshots) {
|
|
105
|
+
XCTAssertTrue([[FBXCElementSnapshotWrapper ensureWrapped:element].wdType isEqualToString:@"XCUIElementTypeButton"]);
|
|
99
106
|
}
|
|
100
107
|
}
|
|
101
108
|
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
#import "FBIntegrationTestCase.h"
|
|
13
13
|
#import "FBTestMacros.h"
|
|
14
|
-
#import "XCElementSnapshot+FBHelpers.h"
|
|
15
14
|
#import "XCUIElement.h"
|
|
16
15
|
#import "XCUIElement+FBIsVisible.h"
|
|
17
16
|
#import "XCUIElement+FBUtilities.h"
|
|
18
17
|
#import "XCUIElement+FBWebDriverAttributes.h"
|
|
18
|
+
#import "FBXCElementSnapshotWrapper+Helpers.h"
|
|
19
19
|
#import "FBXCodeCompatibility.h"
|
|
20
20
|
|
|
21
21
|
@interface XCElementSnapshotHelperTests : FBIntegrationTestCase
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
@"Deadlock app",
|
|
45
45
|
@"Touch",
|
|
46
46
|
]];
|
|
47
|
-
NSArray<
|
|
47
|
+
NSArray<id<FBXCElementSnapshot>> *matchingSnapshots = [[FBXCElementSnapshotWrapper ensureWrapped:self.testedView.fb_takeSnapshot]
|
|
48
|
+
fb_descendantsMatchingType:XCUIElementTypeButton];
|
|
48
49
|
XCTAssertEqual(matchingSnapshots.count, expectedLabels.count);
|
|
49
50
|
NSArray<NSString *> *labels = [matchingSnapshots valueForKeyPath:@"@distinctUnionOfObjects.label"];
|
|
50
51
|
XCTAssertEqualObjects([NSSet setWithArray:labels], expectedLabels);
|
|
@@ -58,7 +59,8 @@
|
|
|
58
59
|
{
|
|
59
60
|
XCUIElement *button = self.testedApplication.buttons[@"Alerts"];
|
|
60
61
|
FBAssertWaitTillBecomesTrue(button.exists);
|
|
61
|
-
|
|
62
|
+
id<FBXCElementSnapshot> windowSnapshot = [[FBXCElementSnapshotWrapper ensureWrapped:button.fb_takeSnapshot]
|
|
63
|
+
fb_parentMatchingType:XCUIElementTypeWindow];
|
|
62
64
|
XCTAssertNotNil(windowSnapshot);
|
|
63
65
|
XCTAssertEqual(windowSnapshot.elementType, XCUIElementTypeWindow);
|
|
64
66
|
}
|
|
@@ -84,7 +86,8 @@
|
|
|
84
86
|
{
|
|
85
87
|
XCUIElement *todayPickerWheel = self.testedApplication.pickerWheels[@"Today"];
|
|
86
88
|
FBAssertWaitTillBecomesTrue(todayPickerWheel.exists);
|
|
87
|
-
|
|
89
|
+
id<FBXCElementSnapshot> datePicker = [[FBXCElementSnapshotWrapper ensureWrapped:todayPickerWheel.fb_takeSnapshot]
|
|
90
|
+
fb_parentMatchingOneOfTypes:@[@(XCUIElementTypeDatePicker), @(XCUIElementTypeWindow)]];
|
|
88
91
|
XCTAssertNotNil(datePicker);
|
|
89
92
|
XCTAssertEqual(datePicker.elementType, XCUIElementTypeDatePicker);
|
|
90
93
|
}
|
|
@@ -93,27 +96,17 @@
|
|
|
93
96
|
{
|
|
94
97
|
XCUIElement *todayPickerWheel = self.testedApplication.pickerWheels[@"Today"];
|
|
95
98
|
FBAssertWaitTillBecomesTrue(todayPickerWheel.exists);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// </XCUIElementTypeOther>
|
|
99
|
-
// <XCUIElementTypeDatePicker>
|
|
100
|
-
// <XCUIElementTypePicker>
|
|
101
|
-
// <XCUIElementTypePickerWheel value="Today"...>
|
|
102
|
-
otherSnapshot = [[[todayPickerWheel.fb_takeSnapshot fb_parentMatchingType:XCUIElementTypePicker]
|
|
103
|
-
fb_parentMatchingType:XCUIElementTypeDatePicker] fb_parentMatchingOneOfTypes:@[@(XCUIElementTypeAny), @(XCUIElementTypeWindow)]];
|
|
104
|
-
} else {
|
|
105
|
-
otherSnapshot = [todayPickerWheel.fb_takeSnapshot fb_parentMatchingOneOfTypes:@[@(XCUIElementTypeAny),
|
|
106
|
-
@(XCUIElementTypeWindow)]];
|
|
107
|
-
}
|
|
99
|
+
id<FBXCElementSnapshot> otherSnapshot =[[FBXCElementSnapshotWrapper ensureWrapped:todayPickerWheel.fb_takeSnapshot]
|
|
100
|
+
fb_parentMatchingOneOfTypes:@[@(XCUIElementTypeAny)]];
|
|
108
101
|
XCTAssertNotNil(otherSnapshot);
|
|
109
|
-
XCTAssertEqual(otherSnapshot.elementType, XCUIElementTypeOther);
|
|
110
102
|
}
|
|
111
103
|
|
|
112
104
|
- (void)testParentMatchingOneOfTypesWithAbsentParents
|
|
113
105
|
{
|
|
114
106
|
XCUIElement *todayPickerWheel = self.testedApplication.pickerWheels[@"Today"];
|
|
115
107
|
FBAssertWaitTillBecomesTrue(todayPickerWheel.exists);
|
|
116
|
-
|
|
108
|
+
id<FBXCElementSnapshot> otherSnapshot = [[FBXCElementSnapshotWrapper ensureWrapped:todayPickerWheel.fb_takeSnapshot]
|
|
109
|
+
fb_parentMatchingOneOfTypes:@[@(XCUIElementTypeTab), @(XCUIElementTypeLink)]];
|
|
117
110
|
XCTAssertNil(otherSnapshot);
|
|
118
111
|
}
|
|
119
112
|
|
|
@@ -143,10 +136,11 @@
|
|
|
143
136
|
@(XCUIElementTypeCollectionView),
|
|
144
137
|
@(XCUIElementTypeTable),
|
|
145
138
|
];
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
id<FBXCElementSnapshot> scrollView = [[FBXCElementSnapshotWrapper ensureWrapped:threeStaticText.fb_takeSnapshot]
|
|
140
|
+
fb_parentMatchingOneOfTypes:acceptedParents
|
|
141
|
+
filter:^BOOL(id<FBXCElementSnapshot> snapshot) {
|
|
142
|
+
return [[FBXCElementSnapshotWrapper ensureWrapped:snapshot] isWDVisible];
|
|
143
|
+
}];
|
|
150
144
|
XCTAssertEqualObjects(scrollView.identifier, @"scrollView");
|
|
151
145
|
}
|
|
152
146
|
|
|
@@ -159,10 +153,11 @@
|
|
|
159
153
|
@(XCUIElementTypeCollectionView),
|
|
160
154
|
@(XCUIElementTypeTable),
|
|
161
155
|
];
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
156
|
+
id<FBXCElementSnapshot> scrollView = [[FBXCElementSnapshotWrapper ensureWrapped:threeStaticText.fb_takeSnapshot]
|
|
157
|
+
fb_parentMatchingOneOfTypes:acceptedParents
|
|
158
|
+
filter:^BOOL(id<FBXCElementSnapshot> snapshot) {
|
|
159
|
+
return NO;
|
|
160
|
+
}];
|
|
166
161
|
XCTAssertNil(scrollView);
|
|
167
162
|
}
|
|
168
163
|
|
|
@@ -170,9 +165,9 @@
|
|
|
170
165
|
{
|
|
171
166
|
XCUIElement *scrollView = self.testedApplication.scrollViews[@"scrollView"];
|
|
172
167
|
FBAssertWaitTillBecomesTrue(self.testedApplication.staticTexts[@"3"].fb_isVisible);
|
|
173
|
-
NSArray *cells = [scrollView.fb_takeSnapshot fb_descendantsCellSnapshots];
|
|
168
|
+
NSArray *cells = [[FBXCElementSnapshotWrapper ensureWrapped:scrollView.fb_takeSnapshot] fb_descendantsCellSnapshots];
|
|
174
169
|
XCTAssertGreaterThanOrEqual(cells.count, 10);
|
|
175
|
-
|
|
170
|
+
id<FBXCElementSnapshot> element = cells.firstObject;
|
|
176
171
|
XCTAssertEqualObjects(element.label, @"0");
|
|
177
172
|
}
|
|
178
173
|
|
|
@@ -197,7 +192,7 @@
|
|
|
197
192
|
{
|
|
198
193
|
FBAssertWaitTillBecomesTrue(self.testedApplication.staticTexts[@"3"].fb_isVisible);
|
|
199
194
|
XCUIElement *threeStaticText = self.testedApplication.staticTexts[@"3"];
|
|
200
|
-
|
|
195
|
+
id<FBXCElementSnapshot> xcuiElementCell = [[FBXCElementSnapshotWrapper ensureWrapped:threeStaticText.fb_takeSnapshot] fb_parentCellSnapshot];
|
|
201
196
|
XCTAssertEqual(xcuiElementCell.elementType, 75);
|
|
202
197
|
}
|
|
203
198
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
#import "FBIntegrationTestCase.h"
|
|
11
11
|
#import "FBTestMacros.h"
|
|
12
|
-
#import "
|
|
12
|
+
#import "FBXCElementSnapshotWrapper+Helpers.h"
|
|
13
13
|
#import "XCUIElement.h"
|
|
14
14
|
#import "XCUIElement+FBUtilities.h"
|
|
15
15
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
[self launchApplication];
|
|
24
24
|
[self goToAttributesPage];
|
|
25
25
|
XCUIElement *dstBtn = self.testedApplication.buttons[@"not_accessible"];
|
|
26
|
-
CGPoint hitPoint = dstBtn.fb_takeSnapshot.fb_hitPoint.CGPointValue;
|
|
26
|
+
CGPoint hitPoint = [FBXCElementSnapshotWrapper ensureWrapped:dstBtn.fb_takeSnapshot].fb_hitPoint.CGPointValue;
|
|
27
27
|
XCTAssertTrue(hitPoint.x > 0 && hitPoint.y > 0);
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
#import "FBTestMacros.h"
|
|
16
16
|
#import "XCUIElement.h"
|
|
17
17
|
#import "XCUIElement+FBFind.h"
|
|
18
|
-
#import "
|
|
18
|
+
#import "FBXCElementSnapshotWrapper+Helpers.h"
|
|
19
19
|
#import "XCUIElement+FBIsVisible.h"
|
|
20
20
|
#import "XCUIElement+FBClassChain.h"
|
|
21
21
|
#import "XCUIElement+FBResolve.h"
|
|
@@ -182,7 +182,8 @@
|
|
|
182
182
|
- (void)testDescendantsWithPredicateString
|
|
183
183
|
{
|
|
184
184
|
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"label = 'Alerts'"];
|
|
185
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingPredicate:predicate
|
|
185
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingPredicate:predicate
|
|
186
|
+
shouldReturnAfterFirstMatch:NO];
|
|
186
187
|
int snapshotsCount = 1;
|
|
187
188
|
if (@available(iOS 13.0, *)) {
|
|
188
189
|
snapshotsCount = 2;
|
|
@@ -191,7 +192,8 @@
|
|
|
191
192
|
XCTAssertEqual(matchingSnapshots.firstObject.elementType, XCUIElementTypeButton);
|
|
192
193
|
XCTAssertEqualObjects(matchingSnapshots.lastObject.label, @"Alerts");
|
|
193
194
|
NSPredicate *selfPredicate = [NSPredicate predicateWithFormat:@"label == 'Alerts'"];
|
|
194
|
-
NSArray<XCUIElement *> *selfElementsByPredicate = [matchingSnapshots.lastObject fb_descendantsMatchingPredicate:selfPredicate
|
|
195
|
+
NSArray<XCUIElement *> *selfElementsByPredicate = [matchingSnapshots.lastObject fb_descendantsMatchingPredicate:selfPredicate
|
|
196
|
+
shouldReturnAfterFirstMatch:NO];
|
|
195
197
|
XCTAssertEqual(selfElementsByPredicate.count, 1);
|
|
196
198
|
}
|
|
197
199
|
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
#import "FBTestMacros.h"
|
|
16
16
|
#import "FBElement.h"
|
|
17
17
|
#import "FBElementUtils.h"
|
|
18
|
+
#import "FBXCElementSnapshot.h"
|
|
18
19
|
#import "XCUIElement+FBUtilities.h"
|
|
19
20
|
|
|
20
21
|
@interface XCUIElementHelperIntegrationTests : FBIntegrationTestCase
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
[allElements addObjectsFromArray:buttons];
|
|
41
42
|
[allElements addObjectsFromArray:windows];
|
|
42
43
|
|
|
43
|
-
NSMutableArray<
|
|
44
|
+
NSMutableArray<id<FBXCElementSnapshot>> *buttonSnapshots = [NSMutableArray array];
|
|
44
45
|
[buttonSnapshots addObject:[buttons.firstObject fb_takeSnapshot]];
|
|
45
46
|
|
|
46
47
|
NSArray<XCUIElement *> *result = [self.testedApplication fb_filterDescendantsWithSnapshots:buttonSnapshots selfUID:nil onlyChildren:NO];
|
|
@@ -7,19 +7,8 @@
|
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
#import <
|
|
11
|
-
|
|
12
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
-
|
|
14
|
-
@interface XCElementSnapshot (FBHitPoint)
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
Wrapper for Apple's hitpoint, thats resolves few known issues
|
|
18
|
-
|
|
19
|
-
@return Element's hitpoint if exists nil otherwise
|
|
20
|
-
*/
|
|
21
|
-
- (nullable NSValue *)fb_hitPoint;
|
|
10
|
+
#import <XCTest/XCTest.h>
|
|
22
11
|
|
|
12
|
+
@interface XCElementSnapshotDouble : NSObject<XCUIElementAttributes>
|
|
13
|
+
@property (readwrite, nullable) id value;
|
|
23
14
|
@end
|
|
24
|
-
|
|
25
|
-
NS_ASSUME_NONNULL_END
|