appium-webdriveragent 4.10.9 → 4.10.11
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/CHANGELOG.md +9 -0
- package/WebDriverAgentLib/Categories/XCUIApplication+FBAlert.m +3 -3
- package/WebDriverAgentLib/Categories/XCUIApplication+FBHelpers.m +1 -1
- package/WebDriverAgentLib/Categories/XCUIElement+FBResolve.m +1 -1
- package/WebDriverAgentLib/Categories/XCUIElement+FBUtilities.m +11 -30
- package/WebDriverAgentLib/Commands/FBElementCommands.m +9 -5
- package/WebDriverAgentLib/FBAlert.m +1 -1
- package/WebDriverAgentLib/Utilities/FBScreen.m +1 -1
- package/WebDriverAgentLib/Utilities/FBXCodeCompatibility.m +5 -4
- package/WebDriverAgentRunner-Runner.app.zip +0 -0
- package/WebDriverAgentTests/IntegrationTests/FBAppiumTouchActionsIntegrationTests.m +1 -1
- package/WebDriverAgentTests/IntegrationTests/FBElementAttributeTests.m +1 -1
- package/WebDriverAgentTests/IntegrationTests/FBElementVisibilityTests.m +4 -4
- package/WebDriverAgentTests/IntegrationTests/FBPasteboardTests.m +1 -1
- package/WebDriverAgentTests/IntegrationTests/FBPickerWheelSelectTests.m +1 -1
- package/WebDriverAgentTests/IntegrationTests/FBW3CTouchActionsIntegrationTests.m +1 -1
- package/WebDriverAgentTests/IntegrationTests/FBXPathIntegrationTests.m +1 -1
- package/WebDriverAgentTests/IntegrationTests/XCUIElementFBFindTests.m +79 -38
- package/WebDriverAgentTests/IntegrationTests/XCUIElementHelperIntegrationTests.m +2 -2
- package/build/lib/check-dependencies.js +1 -2
- package/build/lib/check-dependencies.js.map +1 -1
- package/build/lib/utils.js +4 -21
- package/build/lib/utils.js.map +1 -1
- package/build/lib/webdriveragent.js +1 -11
- package/build/lib/webdriveragent.js.map +1 -1
- package/build/lib/xcodebuild.js +1 -10
- package/build/lib/xcodebuild.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [4.10.11](https://github.com/appium/WebDriverAgent/compare/v4.10.10...v4.10.11) (2022-11-29)
|
|
2
|
+
|
|
3
|
+
## [4.10.10](https://github.com/appium/WebDriverAgent/compare/v4.10.9...v4.10.10) (2022-11-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Only check existence if firstMatch is applied ([#638](https://github.com/appium/WebDriverAgent/issues/638)) ([5394fe8](https://github.com/appium/WebDriverAgent/commit/5394fe8cc2eda3d1668685bd00f9f7383e122627))
|
|
9
|
+
|
|
1
10
|
## [4.10.9](https://github.com/appium/WebDriverAgent/compare/v4.10.8...v4.10.9) (2022-11-25)
|
|
2
11
|
|
|
3
12
|
## [4.10.8](https://github.com/appium/WebDriverAgent/compare/v4.10.7...v4.10.8) (2022-11-24)
|
|
@@ -45,7 +45,7 @@ NSString *const FB_SAFARI_APP_NAME = @"Safari";
|
|
|
45
45
|
descendantsMatchingType:XCUIElementTypeOther]
|
|
46
46
|
matchingPredicate:dstViewMatchPredicate]
|
|
47
47
|
containingPredicate:dstViewContainPredicate1]
|
|
48
|
-
containingPredicate:dstViewContainPredicate2].
|
|
48
|
+
containingPredicate:dstViewContainPredicate2].allElementsBoundByIndex.firstObject;
|
|
49
49
|
} else {
|
|
50
50
|
NSPredicate *webViewPredicate = [NSPredicate predicateWithFormat:@"elementType == %lu", XCUIElementTypeWebView];
|
|
51
51
|
// Find the first XCUIElementTypeOther which is the descendant of the scroll view
|
|
@@ -54,7 +54,7 @@ NSString *const FB_SAFARI_APP_NAME = @"Safari";
|
|
|
54
54
|
descendantsMatchingType:XCUIElementTypeOther]
|
|
55
55
|
matchingPredicate:dstViewMatchPredicate]
|
|
56
56
|
containingPredicate:dstViewContainPredicate1]
|
|
57
|
-
containingPredicate:dstViewContainPredicate2].
|
|
57
|
+
containingPredicate:dstViewContainPredicate2].allElementsBoundByIndex.firstObject;
|
|
58
58
|
}
|
|
59
59
|
if (nil == candidate) {
|
|
60
60
|
return nil;
|
|
@@ -80,7 +80,7 @@ NSString *const FB_SAFARI_APP_NAME = @"Safari";
|
|
|
80
80
|
NSPredicate *alertCollectorPredicate = [NSPredicate predicateWithFormat:@"elementType IN {%lu,%lu,%lu}",
|
|
81
81
|
XCUIElementTypeAlert, XCUIElementTypeSheet, XCUIElementTypeScrollView];
|
|
82
82
|
XCUIElement *alert = [[self descendantsMatchingType:XCUIElementTypeAny]
|
|
83
|
-
matchingPredicate:alertCollectorPredicate].
|
|
83
|
+
matchingPredicate:alertCollectorPredicate].allElementsBoundByIndex.firstObject;
|
|
84
84
|
if (nil == alert) {
|
|
85
85
|
return nil;
|
|
86
86
|
}
|
|
@@ -192,7 +192,7 @@ static NSString* const FBUnknownBundleId = @"unknown";
|
|
|
192
192
|
- (NSString *)fb_descriptionRepresentation
|
|
193
193
|
{
|
|
194
194
|
NSMutableArray<NSString *> *childrenDescriptions = [NSMutableArray array];
|
|
195
|
-
for (XCUIElement *child in [self.fb_query childrenMatchingType:XCUIElementTypeAny].
|
|
195
|
+
for (XCUIElement *child in [self.fb_query childrenMatchingType:XCUIElementTypeAny].allElementsBoundByIndex) {
|
|
196
196
|
[childrenDescriptions addObject:child.debugDescription];
|
|
197
197
|
}
|
|
198
198
|
// debugDescription property of XCUIApplication instance shows descendants addresses in memory
|
|
@@ -50,7 +50,7 @@ static char XCUIELEMENT_IS_RESOLVED_NATIVELY_KEY;
|
|
|
50
50
|
NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id<FBXCElementSnapshot> snapshot, NSDictionary *bindings) {
|
|
51
51
|
return [[FBXCElementSnapshotWrapper wdUIDWithSnapshot:snapshot] isEqualToString:uid];
|
|
52
52
|
}];
|
|
53
|
-
return [query matchingPredicate:predicate].
|
|
53
|
+
return [query matchingPredicate:predicate].allElementsBoundByIndex.firstObject ?: self;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
@end
|
|
@@ -132,11 +132,11 @@
|
|
|
132
132
|
if (0 == snapshots.count) {
|
|
133
133
|
return @[];
|
|
134
134
|
}
|
|
135
|
-
NSMutableArray<NSString *> *
|
|
135
|
+
NSMutableArray<NSString *> *matchedIds = [NSMutableArray new];
|
|
136
136
|
for (id<FBXCElementSnapshot> snapshot in snapshots) {
|
|
137
137
|
NSString *uid = [FBXCElementSnapshotWrapper wdUIDWithSnapshot:snapshot];
|
|
138
138
|
if (nil != uid) {
|
|
139
|
-
[
|
|
139
|
+
[matchedIds addObject:uid];
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
NSMutableArray<XCUIElement *> *matchedElements = [NSMutableArray array];
|
|
@@ -146,11 +146,13 @@
|
|
|
146
146
|
? [FBXCElementSnapshotWrapper wdUIDWithSnapshot:self.lastSnapshot]
|
|
147
147
|
: self.fb_uid;
|
|
148
148
|
}
|
|
149
|
-
if ([
|
|
149
|
+
if (nil != uid && [matchedIds containsObject:uid]) {
|
|
150
|
+
XCUIElement *stableSelf = self.fb_stableInstance;
|
|
151
|
+
stableSelf.fb_isResolvedNatively = @NO;
|
|
150
152
|
if (1 == snapshots.count) {
|
|
151
|
-
return @[
|
|
153
|
+
return @[stableSelf];
|
|
152
154
|
}
|
|
153
|
-
[matchedElements addObject:
|
|
155
|
+
[matchedElements addObject:stableSelf];
|
|
154
156
|
}
|
|
155
157
|
XCUIElementType type = XCUIElementTypeAny;
|
|
156
158
|
NSArray<NSNumber *> *uniqueTypes = [snapshots valueForKeyPath:[NSString stringWithFormat:@"@distinctUnionOfObjects.%@", FBStringify(XCUIElement, elementType)]];
|
|
@@ -161,34 +163,13 @@
|
|
|
161
163
|
? [self.fb_query childrenMatchingType:type]
|
|
162
164
|
: [self.fb_query descendantsMatchingType:type];
|
|
163
165
|
NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id<FBXCElementSnapshot> snapshot, NSDictionary *bindings) {
|
|
164
|
-
return [
|
|
166
|
+
return [matchedIds containsObject:[FBXCElementSnapshotWrapper wdUIDWithSnapshot:snapshot] ?: @""];
|
|
165
167
|
}];
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
XCUIElement *result = query.fb_firstMatch;
|
|
169
|
-
result.fb_isResolvedNatively = @NO;
|
|
170
|
-
return result ? @[result] : @[];
|
|
171
|
-
}
|
|
172
|
-
// Rely here on the fact, that XPath always returns query results in the same
|
|
173
|
-
// order they appear in the document, which means we don't need to resort the resulting
|
|
174
|
-
// array. Although, if it turns out this is still not the case then we could always
|
|
175
|
-
// uncomment the sorting procedure below:
|
|
176
|
-
// query = [query sorted:(id)^NSComparisonResult(XCElementSnapshot *a, XCElementSnapshot *b) {
|
|
177
|
-
// NSUInteger first = [sortedIds indexOfObject:a.wdUID];
|
|
178
|
-
// NSUInteger second = [sortedIds indexOfObject:b.wdUID];
|
|
179
|
-
// if (first < second) {
|
|
180
|
-
// return NSOrderedAscending;
|
|
181
|
-
// }
|
|
182
|
-
// if (first > second) {
|
|
183
|
-
// return NSOrderedDescending;
|
|
184
|
-
// }
|
|
185
|
-
// return NSOrderedSame;
|
|
186
|
-
// }];
|
|
187
|
-
NSArray<XCUIElement *> *result = query.fb_allMatches;
|
|
188
|
-
for (XCUIElement *el in result) {
|
|
168
|
+
[matchedElements addObjectsFromArray:[query matchingPredicate:predicate].allElementsBoundByIndex];
|
|
169
|
+
for (XCUIElement *el in matchedElements) {
|
|
189
170
|
el.fb_isResolvedNatively = @NO;
|
|
190
171
|
}
|
|
191
|
-
return
|
|
172
|
+
return matchedElements.copy;
|
|
192
173
|
}
|
|
193
174
|
|
|
194
175
|
- (void)fb_waitUntilStable
|
|
@@ -386,9 +386,11 @@
|
|
|
386
386
|
// what ios-driver did and sadly, we must copy them.
|
|
387
387
|
NSString *const name = request.arguments[@"name"];
|
|
388
388
|
if (name) {
|
|
389
|
-
XCUIElement *childElement = [[[[element.fb_query descendantsMatchingType:XCUIElementTypeAny]
|
|
389
|
+
XCUIElement *childElement = [[[[element.fb_query descendantsMatchingType:XCUIElementTypeAny]
|
|
390
|
+
matchingIdentifier:name] allElementsBoundByIndex] lastObject];
|
|
390
391
|
if (!childElement) {
|
|
391
|
-
return FBResponseWithStatus([FBCommandStatus noSuchElementErrorWithMessage:[NSString stringWithFormat:@"'%@' identifier didn't match any elements", name]
|
|
392
|
+
return FBResponseWithStatus([FBCommandStatus noSuchElementErrorWithMessage:[NSString stringWithFormat:@"'%@' identifier didn't match any elements", name]
|
|
393
|
+
traceback:[NSString stringWithFormat:@"%@", NSThread.callStackSymbols]]);
|
|
392
394
|
}
|
|
393
395
|
return [self.class handleScrollElementToVisible:childElement withRequest:request];
|
|
394
396
|
}
|
|
@@ -413,9 +415,11 @@
|
|
|
413
415
|
if (predicateString) {
|
|
414
416
|
NSPredicate *formattedPredicate = [NSPredicate fb_snapshotBlockPredicateWithPredicate:[NSPredicate
|
|
415
417
|
predicateWithFormat:predicateString]];
|
|
416
|
-
XCUIElement *childElement = [[[[element.fb_query descendantsMatchingType:XCUIElementTypeAny]
|
|
418
|
+
XCUIElement *childElement = [[[[element.fb_query descendantsMatchingType:XCUIElementTypeAny]
|
|
419
|
+
matchingPredicate:formattedPredicate] allElementsBoundByIndex] lastObject];
|
|
417
420
|
if (!childElement) {
|
|
418
|
-
return FBResponseWithStatus([FBCommandStatus noSuchElementErrorWithMessage:[NSString stringWithFormat:@"'%@' predicate didn't match any elements", predicateString]
|
|
421
|
+
return FBResponseWithStatus([FBCommandStatus noSuchElementErrorWithMessage:[NSString stringWithFormat:@"'%@' predicate didn't match any elements", predicateString]
|
|
422
|
+
traceback:[NSString stringWithFormat:@"%@", NSThread.callStackSymbols]]);
|
|
419
423
|
}
|
|
420
424
|
return [self.class handleScrollElementToVisible:childElement withRequest:request];
|
|
421
425
|
}
|
|
@@ -675,7 +679,7 @@ static const CGFloat DEFAULT_OFFSET = (CGFloat)0.2;
|
|
|
675
679
|
*/
|
|
676
680
|
XCUIElement *element = application;
|
|
677
681
|
if (isSDKVersionGreaterThanOrEqualTo(@"11.0")) {
|
|
678
|
-
XCUIElement *window = application.windows.
|
|
682
|
+
XCUIElement *window = application.windows.allElementsBoundByIndex.firstObject;
|
|
679
683
|
if (window) {
|
|
680
684
|
element = window;
|
|
681
685
|
id<FBXCElementSnapshot> snapshot = element.fb_cachedSnapshot ?: element.fb_takeSnapshot;
|
|
@@ -245,7 +245,7 @@
|
|
|
245
245
|
|
|
246
246
|
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"label == %@", label];
|
|
247
247
|
XCUIElement *requestedButton = [[self.alertElement descendantsMatchingType:XCUIElementTypeButton]
|
|
248
|
-
matchingPredicate:predicate].
|
|
248
|
+
matchingPredicate:predicate].allElementsBoundByIndex.firstObject;
|
|
249
249
|
if (!requestedButton) {
|
|
250
250
|
return [[[FBErrorBuilder builder]
|
|
251
251
|
withDescriptionFormat:@"Failed to find button with label '%@' for alert: %@", label, self.alertElement]
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
expectVisibleBar = NO;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
XCUIElement *mainStatusBar = app.statusBars.
|
|
34
|
+
XCUIElement *mainStatusBar = app.statusBars.allElementsBoundByIndex.firstObject;
|
|
35
35
|
if (!mainStatusBar || (expectVisibleBar && !mainStatusBar.fb_isVisible)) {
|
|
36
36
|
return CGSizeZero;
|
|
37
37
|
}
|
|
@@ -65,10 +65,11 @@ NSString *const FBApplicationMethodNotSupportedException = @"FBApplicationMethod
|
|
|
65
65
|
|
|
66
66
|
- (XCUIElement *)fb_firstMatch
|
|
67
67
|
{
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
:
|
|
71
|
-
|
|
68
|
+
if (FBConfiguration.useFirstMatch) {
|
|
69
|
+
XCUIElement* match = self.firstMatch;
|
|
70
|
+
return [match exists] ? match : nil;
|
|
71
|
+
}
|
|
72
|
+
return self.fb_allMatches.firstObject;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
- (NSArray<XCUIElement *> *)fb_allMatches
|
|
Binary file
|
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
[self launchApplication];
|
|
299
299
|
[self goToAttributesPage];
|
|
300
300
|
});
|
|
301
|
-
self.pickerWheel = self.testedApplication.pickerWheels.
|
|
301
|
+
self.pickerWheel = self.testedApplication.pickerWheels.allElementsBoundByIndex.firstObject;
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
- (void)tearDown
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
- (void)testIgnoredAccessibilityAttributes
|
|
62
62
|
{
|
|
63
63
|
// Images are neither accessibility elements nor contain them, so both checks should fail
|
|
64
|
-
XCUIElement *imageElement = self.testedApplication.images.
|
|
64
|
+
XCUIElement *imageElement = self.testedApplication.images.allElementsBoundByIndex.firstObject;
|
|
65
65
|
XCTAssertTrue(imageElement.exists);
|
|
66
66
|
XCTAssertFalse(imageElement.fb_isAccessibilityElement);
|
|
67
67
|
XCTAssertFalse(imageElement.isWDAccessibilityContainer);
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
XCTAssertTrue(self.springboard.icons[@"Reminders"].fb_isVisible);
|
|
37
37
|
|
|
38
38
|
// Check Icons on second screen screen
|
|
39
|
-
XCTAssertFalse(self.springboard.icons[@"IntegrationApp"].
|
|
39
|
+
XCTAssertFalse(self.springboard.icons[@"IntegrationApp"].firstMatch.fb_isVisible);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
- (void)testSpringBoardSubfolder
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
XCTAssertFalse(self.springboard.icons[@"Reminders"].fb_isVisible);
|
|
60
60
|
XCTAssertFalse([[[self.springboard descendantsMatchingType:XCUIElementTypeIcon]
|
|
61
61
|
matchingIdentifier:@"IntegrationApp"]
|
|
62
|
-
|
|
62
|
+
firstMatch].fb_isVisible);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
- (void)testTableViewCells
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
[self launchApplication];
|
|
73
73
|
[self goToScrollPageWithCells:YES];
|
|
74
74
|
for (int i = 0 ; i < 10 ; i++) {
|
|
75
|
-
FBAssertWaitTillBecomesTrue(self.testedApplication.cells.
|
|
76
|
-
FBAssertWaitTillBecomesTrue(self.testedApplication.staticTexts.
|
|
75
|
+
FBAssertWaitTillBecomesTrue(self.testedApplication.cells.allElementsBoundByIndex[i].fb_isVisible);
|
|
76
|
+
FBAssertWaitTillBecomesTrue(self.testedApplication.staticTexts.allElementsBoundByIndex[i].fb_isVisible);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
if (![pastItemsQuery.firstMatch waitForExistenceWithTimeout:2.0]) {
|
|
45
45
|
XCTFail(@"No matched element named 'Paste'");
|
|
46
46
|
}
|
|
47
|
-
XCUIElement *pasteItem = pastItemsQuery.
|
|
47
|
+
XCUIElement *pasteItem = pastItemsQuery.firstMatch;
|
|
48
48
|
XCTAssertNotNil(pasteItem);
|
|
49
49
|
[pasteItem tap];
|
|
50
50
|
FBAssertWaitTillBecomesTrue([textField.value isEqualToString:text]);
|
|
@@ -33,7 +33,7 @@ static const CGFloat DEFAULT_OFFSET = (CGFloat)0.2;
|
|
|
33
33
|
|
|
34
34
|
- (void)testSelectNextPickerValue
|
|
35
35
|
{
|
|
36
|
-
XCUIElement *element = self.testedApplication.pickerWheels.
|
|
36
|
+
XCUIElement *element = self.testedApplication.pickerWheels.allElementsBoundByIndex.firstObject;
|
|
37
37
|
XCTAssertTrue(element.exists);
|
|
38
38
|
XCTAssertEqualObjects(element.wdType, @"XCUIElementTypePickerWheel");
|
|
39
39
|
NSError *error;
|
|
@@ -415,7 +415,7 @@
|
|
|
415
415
|
[self launchApplication];
|
|
416
416
|
[self goToAttributesPage];
|
|
417
417
|
});
|
|
418
|
-
self.pickerWheel = self.testedApplication.pickerWheels.
|
|
418
|
+
self.pickerWheel = self.testedApplication.pickerWheels.allElementsBoundByIndex.firstObject;
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
- (void)tearDown
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
- (id<FBXCElementSnapshot>)destinationSnapshot
|
|
43
43
|
{
|
|
44
|
-
XCUIElement *matchingElement = self.testedView.buttons.
|
|
44
|
+
XCUIElement *matchingElement = self.testedView.buttons.allElementsBoundByIndex.firstObject;
|
|
45
45
|
FBAssertWaitTillBecomesTrue(nil != matchingElement.fb_takeSnapshot);
|
|
46
46
|
|
|
47
47
|
id<FBXCElementSnapshot> snapshot = matchingElement.fb_takeSnapshot;
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
@"Deadlock app",
|
|
49
49
|
@"Touch",
|
|
50
50
|
]];
|
|
51
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingClassName:@"XCUIElementTypeButton"
|
|
51
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingClassName:@"XCUIElementTypeButton"
|
|
52
|
+
shouldReturnAfterFirstMatch:NO];
|
|
52
53
|
XCTAssertEqual(matchingSnapshots.count, expectedLabels.count);
|
|
53
54
|
NSArray<NSString *> *labels = [matchingSnapshots valueForKeyPath:@"@distinctUnionOfObjects.label"];
|
|
54
55
|
XCTAssertEqualObjects([NSSet setWithArray:labels], expectedLabels);
|
|
@@ -60,14 +61,16 @@
|
|
|
60
61
|
|
|
61
62
|
- (void)testSingleDescendantWithClassName
|
|
62
63
|
{
|
|
63
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingClassName:@"XCUIElementTypeButton"
|
|
64
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingClassName:@"XCUIElementTypeButton"
|
|
65
|
+
shouldReturnAfterFirstMatch:YES];
|
|
64
66
|
XCTAssertEqual(matchingSnapshots.count, 1);
|
|
65
67
|
XCTAssertEqual(matchingSnapshots.lastObject.elementType, XCUIElementTypeButton);
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
- (void)testDescendantsWithIdentifier
|
|
69
71
|
{
|
|
70
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingIdentifier:@"Alerts"
|
|
72
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingIdentifier:@"Alerts"
|
|
73
|
+
shouldReturnAfterFirstMatch:NO];
|
|
71
74
|
int snapshotsCount = 1;
|
|
72
75
|
if (@available(iOS 13.0, *)) {
|
|
73
76
|
snapshotsCount = 2;
|
|
@@ -81,7 +84,8 @@
|
|
|
81
84
|
|
|
82
85
|
- (void)testSingleDescendantWithIdentifier
|
|
83
86
|
{
|
|
84
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingIdentifier:@"Alerts"
|
|
87
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingIdentifier:@"Alerts"
|
|
88
|
+
shouldReturnAfterFirstMatch:YES];
|
|
85
89
|
XCTAssertEqual(matchingSnapshots.count, 1);
|
|
86
90
|
XCTAssertEqual(matchingSnapshots.lastObject.elementType, XCUIElementTypeButton);
|
|
87
91
|
XCTAssertEqualObjects(matchingSnapshots.lastObject.label, @"Alerts");
|
|
@@ -89,7 +93,8 @@
|
|
|
89
93
|
|
|
90
94
|
- (void)testStableInstance
|
|
91
95
|
{
|
|
92
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingIdentifier:@"Alerts"
|
|
96
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingIdentifier:@"Alerts"
|
|
97
|
+
shouldReturnAfterFirstMatch:YES];
|
|
93
98
|
XCTAssertEqual(matchingSnapshots.count, 1);
|
|
94
99
|
for (XCUIElement *el in @[matchingSnapshots.lastObject, matchingSnapshots.lastObject.fb_stableInstance]) {
|
|
95
100
|
XCTAssertEqual(el.elementType, XCUIElementTypeButton);
|
|
@@ -105,7 +110,8 @@
|
|
|
105
110
|
|
|
106
111
|
- (void)testDescendantsWithXPathQuery
|
|
107
112
|
{
|
|
108
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeButton[@label='Alerts']"
|
|
113
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeButton[@label='Alerts']"
|
|
114
|
+
shouldReturnAfterFirstMatch:NO];
|
|
109
115
|
XCTAssertEqual(matchingSnapshots.count, 1);
|
|
110
116
|
XCTAssertEqual(matchingSnapshots.lastObject.elementType, XCUIElementTypeButton);
|
|
111
117
|
XCTAssertEqualObjects(matchingSnapshots.lastObject.label, @"Alerts");
|
|
@@ -113,14 +119,16 @@
|
|
|
113
119
|
|
|
114
120
|
- (void)testSelfWithXPathQuery
|
|
115
121
|
{
|
|
116
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedApplication fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeApplication"
|
|
122
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedApplication fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeApplication"
|
|
123
|
+
shouldReturnAfterFirstMatch:NO];
|
|
117
124
|
XCTAssertEqual(matchingSnapshots.count, 1);
|
|
118
125
|
XCTAssertEqual(matchingSnapshots.lastObject.elementType, XCUIElementTypeApplication);
|
|
119
126
|
}
|
|
120
127
|
|
|
121
128
|
- (void)testSingleDescendantWithXPathQuery
|
|
122
129
|
{
|
|
123
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedApplication fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeButton"
|
|
130
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedApplication fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeButton"
|
|
131
|
+
shouldReturnAfterFirstMatch:YES];
|
|
124
132
|
XCTAssertEqual(matchingSnapshots.count, 1);
|
|
125
133
|
XCUIElement *matchingSnapshot = [matchingSnapshots firstObject];
|
|
126
134
|
XCTAssertNotNil(matchingSnapshot);
|
|
@@ -130,26 +138,30 @@
|
|
|
130
138
|
|
|
131
139
|
- (void)testSingleDescendantWithXPathQueryNoMatches
|
|
132
140
|
{
|
|
133
|
-
XCUIElement *matchingSnapshot = [[self.testedView fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeButtonnn"
|
|
141
|
+
XCUIElement *matchingSnapshot = [[self.testedView fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeButtonnn"
|
|
142
|
+
shouldReturnAfterFirstMatch:YES] firstObject];
|
|
134
143
|
XCTAssertNil(matchingSnapshot);
|
|
135
144
|
}
|
|
136
145
|
|
|
137
146
|
- (void)testSingleLastDescendantWithXPathQuery
|
|
138
147
|
{
|
|
139
|
-
XCUIElement *matchingSnapshot = [[self.testedView fb_descendantsMatchingXPathQuery:@"(//XCUIElementTypeButton)[last()]"
|
|
148
|
+
XCUIElement *matchingSnapshot = [[self.testedView fb_descendantsMatchingXPathQuery:@"(//XCUIElementTypeButton)[last()]"
|
|
149
|
+
shouldReturnAfterFirstMatch:YES] firstObject];
|
|
140
150
|
XCTAssertNotNil(matchingSnapshot);
|
|
141
151
|
XCTAssertEqual(matchingSnapshot.elementType, XCUIElementTypeButton);
|
|
142
152
|
}
|
|
143
153
|
|
|
144
154
|
- (void)testDescendantsWithXPathQueryNoMatches
|
|
145
155
|
{
|
|
146
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeButton[@label='Alerts1']"
|
|
156
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeButton[@label='Alerts1']"
|
|
157
|
+
shouldReturnAfterFirstMatch:NO];
|
|
147
158
|
XCTAssertEqual(matchingSnapshots.count, 0);
|
|
148
159
|
}
|
|
149
160
|
|
|
150
161
|
- (void)testDescendantsWithComplexXPathQuery
|
|
151
162
|
{
|
|
152
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingXPathQuery:@"//*[@label='Scrolling']/preceding::*[boolean(string(@label))]"
|
|
163
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingXPathQuery:@"//*[@label='Scrolling']/preceding::*[boolean(string(@label))]"
|
|
164
|
+
shouldReturnAfterFirstMatch:NO];
|
|
153
165
|
int snapshotsCount = 3;
|
|
154
166
|
if (@available(iOS 13.0, *)) {
|
|
155
167
|
snapshotsCount = 6;
|
|
@@ -159,13 +171,15 @@
|
|
|
159
171
|
|
|
160
172
|
- (void)testDescendantsWithWrongXPathQuery
|
|
161
173
|
{
|
|
162
|
-
XCTAssertThrowsSpecificNamed([self.testedView fb_descendantsMatchingXPathQuery:@"//*[blabla(@label, Scrolling')]"
|
|
174
|
+
XCTAssertThrowsSpecificNamed([self.testedView fb_descendantsMatchingXPathQuery:@"//*[blabla(@label, Scrolling')]"
|
|
175
|
+
shouldReturnAfterFirstMatch:NO],
|
|
163
176
|
NSException, FBInvalidXPathException);
|
|
164
177
|
}
|
|
165
178
|
|
|
166
179
|
- (void)testFirstDescendantWithWrongXPathQuery
|
|
167
180
|
{
|
|
168
|
-
XCTAssertThrowsSpecificNamed([self.testedView fb_descendantsMatchingXPathQuery:@"//*[blabla(@label, Scrolling')]"
|
|
181
|
+
XCTAssertThrowsSpecificNamed([self.testedView fb_descendantsMatchingXPathQuery:@"//*[blabla(@label, Scrolling')]"
|
|
182
|
+
shouldReturnAfterFirstMatch:YES],
|
|
169
183
|
NSException, FBInvalidXPathException);
|
|
170
184
|
}
|
|
171
185
|
|
|
@@ -200,7 +214,8 @@
|
|
|
200
214
|
- (void)testSelfWithPredicateString
|
|
201
215
|
{
|
|
202
216
|
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"type == 'XCUIElementTypeApplication'"];
|
|
203
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedApplication fb_descendantsMatchingPredicate:predicate
|
|
217
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedApplication fb_descendantsMatchingPredicate:predicate
|
|
218
|
+
shouldReturnAfterFirstMatch:NO];
|
|
204
219
|
XCTAssertEqual(matchingSnapshots.count, 1);
|
|
205
220
|
XCTAssertEqual(matchingSnapshots.lastObject.elementType, XCUIElementTypeApplication);
|
|
206
221
|
}
|
|
@@ -223,7 +238,9 @@
|
|
|
223
238
|
|
|
224
239
|
- (void)testDescendantsWithPropertyStrict
|
|
225
240
|
{
|
|
226
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingProperty:@"label"
|
|
241
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingProperty:@"label"
|
|
242
|
+
value:@"Alert"
|
|
243
|
+
partialSearch:NO];
|
|
227
244
|
XCTAssertEqual(matchingSnapshots.count, 0);
|
|
228
245
|
matchingSnapshots = [self.testedView fb_descendantsMatchingProperty:@"label" value:@"Alerts" partialSearch:NO];
|
|
229
246
|
int snapshotsCount = 1;
|
|
@@ -237,7 +254,9 @@
|
|
|
237
254
|
|
|
238
255
|
- (void)testGlobalWithPropertyStrict
|
|
239
256
|
{
|
|
240
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedApplication fb_descendantsMatchingProperty:@"label"
|
|
257
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedApplication fb_descendantsMatchingProperty:@"label"
|
|
258
|
+
value:@"Alert"
|
|
259
|
+
partialSearch:NO];
|
|
241
260
|
XCTAssertEqual(matchingSnapshots.count, 0);
|
|
242
261
|
matchingSnapshots = [self.testedApplication fb_descendantsMatchingProperty:@"label" value:@"Alerts" partialSearch:NO];
|
|
243
262
|
int snapshotsCount = 1;
|
|
@@ -251,7 +270,9 @@
|
|
|
251
270
|
|
|
252
271
|
- (void)testDescendantsWithPropertyPartial
|
|
253
272
|
{
|
|
254
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingProperty:@"label"
|
|
273
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingProperty:@"label"
|
|
274
|
+
value:@"Alerts"
|
|
275
|
+
partialSearch:NO];
|
|
255
276
|
int snapshotsCount = 1;
|
|
256
277
|
if (@available(iOS 13.0, *)) {
|
|
257
278
|
snapshotsCount = 2;
|
|
@@ -265,7 +286,8 @@
|
|
|
265
286
|
{
|
|
266
287
|
NSArray<XCUIElement *> *matchingSnapshots;
|
|
267
288
|
NSString *queryString =@"XCUIElementTypeWindow/XCUIElementTypeOther/**/XCUIElementTypeButton";
|
|
268
|
-
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
289
|
+
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
290
|
+
shouldReturnAfterFirstMatch:NO];
|
|
269
291
|
XCTAssertEqual(matchingSnapshots.count, 5); // /XCUIElementTypeButton
|
|
270
292
|
for (XCUIElement *matchingSnapshot in matchingSnapshots) {
|
|
271
293
|
XCTAssertEqual(matchingSnapshot.elementType, XCUIElementTypeButton);
|
|
@@ -279,14 +301,17 @@
|
|
|
279
301
|
if (@available(iOS 13.0, *)) {
|
|
280
302
|
// iPhone
|
|
281
303
|
queryString = @"XCUIElementTypeWindow/*/*/*/*[2]/*/*/XCUIElementTypeButton";
|
|
282
|
-
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
304
|
+
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
305
|
+
shouldReturnAfterFirstMatch:NO];
|
|
283
306
|
if (matchingSnapshots.count == 0) {
|
|
284
307
|
// iPad
|
|
285
308
|
queryString = @"XCUIElementTypeWindow/*/*/*/*/*[2]/*/*/XCUIElementTypeButton";
|
|
286
|
-
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
309
|
+
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
310
|
+
shouldReturnAfterFirstMatch:NO];
|
|
287
311
|
}
|
|
288
312
|
} else {
|
|
289
|
-
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
313
|
+
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
314
|
+
shouldReturnAfterFirstMatch:NO];
|
|
290
315
|
}
|
|
291
316
|
XCTAssertEqual(matchingSnapshots.count, 5); // /XCUIElementTypeButton
|
|
292
317
|
for (XCUIElement *matchingSnapshot in matchingSnapshots) {
|
|
@@ -298,7 +323,8 @@
|
|
|
298
323
|
{
|
|
299
324
|
NSArray<XCUIElement *> *matchingSnapshots;
|
|
300
325
|
NSString *queryString = @"XCUIElementTypeWindow/**/XCUIElementTypeButton[`label BEGINSWITH 'A'`]";
|
|
301
|
-
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
326
|
+
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
327
|
+
shouldReturnAfterFirstMatch:NO];
|
|
302
328
|
XCTAssertEqual(matchingSnapshots.count, 2);
|
|
303
329
|
XCTAssertEqualObjects([matchingSnapshots firstObject].label, @"Alerts");
|
|
304
330
|
XCTAssertEqualObjects([matchingSnapshots lastObject].label, @"Attributes");
|
|
@@ -307,8 +333,10 @@
|
|
|
307
333
|
- (void)testDescendantsWithIndirectClassChainAndPredicates
|
|
308
334
|
{
|
|
309
335
|
NSString *queryString = @"XCUIElementTypeWindow/**/XCUIElementTypeButton[`label BEGINSWITH 'A'`]";
|
|
310
|
-
NSArray<XCUIElement *> *simpleQueryMatches = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
311
|
-
|
|
336
|
+
NSArray<XCUIElement *> *simpleQueryMatches = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
337
|
+
shouldReturnAfterFirstMatch:NO];
|
|
338
|
+
NSArray<XCUIElement *> *deepQueryMatches = [self.testedApplication fb_descendantsMatchingClassChain:@"XCUIElementTypeWindow/**/XCUIElementTypeButton[`label BEGINSWITH 'A'`]"
|
|
339
|
+
shouldReturnAfterFirstMatch:NO];
|
|
312
340
|
XCTAssertEqual(simpleQueryMatches.count, deepQueryMatches.count);
|
|
313
341
|
XCTAssertEqualObjects([simpleQueryMatches firstObject].label, [deepQueryMatches firstObject].label);
|
|
314
342
|
XCTAssertEqualObjects([simpleQueryMatches lastObject].label, [deepQueryMatches lastObject].label);
|
|
@@ -316,8 +344,10 @@
|
|
|
316
344
|
|
|
317
345
|
- (void)testClassChainWithDescendantPredicate
|
|
318
346
|
{
|
|
319
|
-
NSArray<XCUIElement *> *simpleQueryMatches = [self.testedApplication fb_descendantsMatchingClassChain:@"XCUIElementTypeWindow/*/*[1]"
|
|
320
|
-
|
|
347
|
+
NSArray<XCUIElement *> *simpleQueryMatches = [self.testedApplication fb_descendantsMatchingClassChain:@"XCUIElementTypeWindow/*/*[1]"
|
|
348
|
+
shouldReturnAfterFirstMatch:NO];
|
|
349
|
+
NSArray<XCUIElement *> *predicateQueryMatches = [self.testedApplication fb_descendantsMatchingClassChain:@"XCUIElementTypeWindow/*/*[$type == 'XCUIElementTypeButton' AND label BEGINSWITH 'A'$]"
|
|
350
|
+
shouldReturnAfterFirstMatch:NO];
|
|
321
351
|
XCTAssertEqual(simpleQueryMatches.count, predicateQueryMatches.count);
|
|
322
352
|
XCTAssertEqual([simpleQueryMatches firstObject].elementType, [predicateQueryMatches firstObject].elementType);
|
|
323
353
|
XCTAssertEqual([simpleQueryMatches lastObject].elementType, [predicateQueryMatches lastObject].elementType);
|
|
@@ -325,7 +355,8 @@
|
|
|
325
355
|
|
|
326
356
|
- (void)testSingleDescendantWithComplexIndirectClassChain
|
|
327
357
|
{
|
|
328
|
-
NSArray<XCUIElement *> *queryMatches = [self.testedApplication fb_descendantsMatchingClassChain:@"**/*/XCUIElementTypeButton[2]"
|
|
358
|
+
NSArray<XCUIElement *> *queryMatches = [self.testedApplication fb_descendantsMatchingClassChain:@"**/*/XCUIElementTypeButton[2]"
|
|
359
|
+
shouldReturnAfterFirstMatch:NO];
|
|
329
360
|
XCTAssertEqual(queryMatches.count, 1);
|
|
330
361
|
XCTAssertEqual(queryMatches.lastObject.elementType, XCUIElementTypeButton);
|
|
331
362
|
XCTAssertEqualObjects(queryMatches.lastObject.label, @"Deadlock app");
|
|
@@ -333,7 +364,8 @@
|
|
|
333
364
|
|
|
334
365
|
- (void)testSingleDescendantWithComplexIndirectClassChainAndZeroMatches
|
|
335
366
|
{
|
|
336
|
-
NSArray<XCUIElement *> *queryMatches = [self.testedApplication fb_descendantsMatchingClassChain:@"**/*/XCUIElementTypeWindow"
|
|
367
|
+
NSArray<XCUIElement *> *queryMatches = [self.testedApplication fb_descendantsMatchingClassChain:@"**/*/XCUIElementTypeWindow"
|
|
368
|
+
shouldReturnAfterFirstMatch:NO];
|
|
337
369
|
XCTAssertEqual(queryMatches.count, 0);
|
|
338
370
|
}
|
|
339
371
|
|
|
@@ -341,14 +373,16 @@
|
|
|
341
373
|
{
|
|
342
374
|
NSArray<XCUIElement *> *matchingSnapshots;
|
|
343
375
|
NSString *queryString = @"XCUIElementTypeWindow[`name != 'bla'`]/**/XCUIElementTypeButton[`label BEGINSWITH \"A\"`][1]";
|
|
344
|
-
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
376
|
+
matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString
|
|
377
|
+
shouldReturnAfterFirstMatch:NO];
|
|
345
378
|
XCTAssertEqual(matchingSnapshots.count, 1);
|
|
346
379
|
XCTAssertEqualObjects([matchingSnapshots firstObject].label, @"Alerts");
|
|
347
380
|
}
|
|
348
381
|
|
|
349
382
|
- (void)testSingleDescendantWithClassChain
|
|
350
383
|
{
|
|
351
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingClassChain:@"XCUIElementTypeButton"
|
|
384
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedView fb_descendantsMatchingClassChain:@"XCUIElementTypeButton"
|
|
385
|
+
shouldReturnAfterFirstMatch:YES];
|
|
352
386
|
|
|
353
387
|
XCTAssertEqual(matchingSnapshots.count, 1);
|
|
354
388
|
XCTAssertEqual(matchingSnapshots.lastObject.elementType, XCUIElementTypeButton);
|
|
@@ -358,19 +392,22 @@
|
|
|
358
392
|
- (void)testSingleDescendantWithClassChainAndNegativeIndex
|
|
359
393
|
{
|
|
360
394
|
NSArray<XCUIElement *> *matchingSnapshots;
|
|
361
|
-
matchingSnapshots = [self.testedView fb_descendantsMatchingClassChain:@"XCUIElementTypeButton[-1]"
|
|
395
|
+
matchingSnapshots = [self.testedView fb_descendantsMatchingClassChain:@"XCUIElementTypeButton[-1]"
|
|
396
|
+
shouldReturnAfterFirstMatch:YES];
|
|
362
397
|
|
|
363
398
|
XCTAssertEqual(matchingSnapshots.count, 1);
|
|
364
399
|
XCTAssertEqual(matchingSnapshots.lastObject.elementType, XCUIElementTypeButton);
|
|
365
400
|
XCTAssertTrue([matchingSnapshots.lastObject.label isEqualToString:@"Touch"]);
|
|
366
401
|
|
|
367
|
-
matchingSnapshots = [self.testedView fb_descendantsMatchingClassChain:@"XCUIElementTypeButton[-10]"
|
|
402
|
+
matchingSnapshots = [self.testedView fb_descendantsMatchingClassChain:@"XCUIElementTypeButton[-10]"
|
|
403
|
+
shouldReturnAfterFirstMatch:YES];
|
|
368
404
|
XCTAssertEqual(matchingSnapshots.count, 0);
|
|
369
405
|
}
|
|
370
406
|
|
|
371
407
|
- (void)testInvalidQueryWithClassChain
|
|
372
408
|
{
|
|
373
|
-
XCTAssertThrowsSpecificNamed([self.testedView fb_descendantsMatchingClassChain:@"NoXCUIElementTypePrefix"
|
|
409
|
+
XCTAssertThrowsSpecificNamed([self.testedView fb_descendantsMatchingClassChain:@"NoXCUIElementTypePrefix"
|
|
410
|
+
shouldReturnAfterFirstMatch:YES],
|
|
374
411
|
NSException, FBClassChainQueryParseException);
|
|
375
412
|
}
|
|
376
413
|
|
|
@@ -384,7 +421,8 @@
|
|
|
384
421
|
|
|
385
422
|
- (void)testClassChainWithInvalidPredicate
|
|
386
423
|
{
|
|
387
|
-
XCTAssertThrowsSpecificNamed([self.testedApplication fb_descendantsMatchingClassChain:@"XCUIElementTypeWindow[`bla != 'bla'`]"
|
|
424
|
+
XCTAssertThrowsSpecificNamed([self.testedApplication fb_descendantsMatchingClassChain:@"XCUIElementTypeWindow[`bla != 'bla'`]"
|
|
425
|
+
shouldReturnAfterFirstMatch:NO],
|
|
388
426
|
NSException, FBUnknownAttributeException);;
|
|
389
427
|
}
|
|
390
428
|
|
|
@@ -411,8 +449,10 @@
|
|
|
411
449
|
queryString = @"XCUIElementTypePicker";
|
|
412
450
|
}
|
|
413
451
|
FBAssertWaitTillBecomesTrue(self.testedApplication.buttons[@"Button"].fb_isVisible);
|
|
414
|
-
XCUIElement *datePicker = [self.testedApplication
|
|
415
|
-
|
|
452
|
+
XCUIElement *datePicker = [self.testedApplication
|
|
453
|
+
descendantsMatchingType:XCUIElementTypeDatePicker].allElementsBoundByIndex.firstObject;
|
|
454
|
+
NSArray<XCUIElement *> *matches = [datePicker fb_descendantsMatchingClassChain:queryString
|
|
455
|
+
shouldReturnAfterFirstMatch:NO];
|
|
416
456
|
XCTAssertEqual(matches.count, 1);
|
|
417
457
|
|
|
418
458
|
XCUIElementType expectedType = XCUIElementTypeOther;
|
|
@@ -440,7 +480,8 @@
|
|
|
440
480
|
|
|
441
481
|
- (void)testInvisibleDescendantWithXPathQuery
|
|
442
482
|
{
|
|
443
|
-
NSArray<XCUIElement *> *matchingSnapshots = [self.testedApplication fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeStaticText[@visible='false']"
|
|
483
|
+
NSArray<XCUIElement *> *matchingSnapshots = [self.testedApplication fb_descendantsMatchingXPathQuery:@"//XCUIElementTypeStaticText[@visible='false']"
|
|
484
|
+
shouldReturnAfterFirstMatch:NO];
|
|
444
485
|
XCTAssertGreaterThan(matchingSnapshots.count, 1);
|
|
445
486
|
XCTAssertEqual(matchingSnapshots.lastObject.elementType, XCUIElementTypeStaticText);
|
|
446
487
|
XCTAssertFalse(matchingSnapshots.lastObject.fb_isVisible);
|