diff --git a/WebDriverAgentLib/Commands/FBElementCommands.m b/WebDriverAgentLib/Commands/FBElementCommands.m index 0313302f2..762bad327 100644 --- a/WebDriverAgentLib/Commands/FBElementCommands.m +++ b/WebDriverAgentLib/Commands/FBElementCommands.m @@ -352,10 +352,6 @@ + (NSArray *)routes { FBElementCache *elementCache = request.session.elementCache; XCUIElement *element = [self targetFromRequest:request]; - if (![element respondsToSelector:@selector(pressForDuration:thenDragToElement:withVelocity:thenHoldForDuration:)]) { - return FBResponseWithStatus([FBCommandStatus unsupportedOperationErrorWithMessage:@"This method is only supported in Xcode 12 and above" - traceback:nil]); - } [element pressForDuration:[request.arguments[@"pressDuration"] doubleValue] thenDragToElement:[elementCache elementForUUID:(NSString *)request.arguments[@"toElement"]] withVelocity:[request.arguments[@"velocity"] doubleValue] @@ -370,10 +366,6 @@ + (NSArray *)routes (CGFloat)[request.arguments[@"fromY"] doubleValue]); XCUICoordinate *startCoordinate = [self.class gestureCoordinateWithOffset:startOffset element:session.activeApplication]; - if (![startCoordinate respondsToSelector:@selector(pressForDuration:thenDragToCoordinate:withVelocity:thenHoldForDuration:)]) { - return FBResponseWithStatus([FBCommandStatus unsupportedOperationErrorWithMessage:@"This method is only supported in Xcode 12 and above" - traceback:nil]); - } CGVector endOffset = CGVectorMake((CGFloat)[request.arguments[@"toX"] doubleValue], (CGFloat)[request.arguments[@"toY"] doubleValue]); XCUICoordinate *endCoordinate = [self.class gestureCoordinateWithOffset:endOffset diff --git a/WebDriverAgentTests/IntegrationTests/FBElementAttributeTests.m b/WebDriverAgentTests/IntegrationTests/FBElementAttributeTests.m index 13cba4e57..2d6f30c5b 100644 --- a/WebDriverAgentTests/IntegrationTests/FBElementAttributeTests.m +++ b/WebDriverAgentTests/IntegrationTests/FBElementAttributeTests.m @@ -48,14 +48,9 @@ - (void)testContainerAccessibilityAttributes XCUIElement *inaccessibleButtonElement = self.testedApplication.buttons[@"not_accessible"]; XCTAssertTrue(inaccessibleButtonElement.exists); XCTAssertFalse(inaccessibleButtonElement.fb_isAccessibilityElement); - if (@available(iOS 13.0, *)) { - // FIXME: Xcode 11 environment returns false even if iOS 12 - // We must fix here to XCTAssertTrue if Xcode version will return the value properly - XCTAssertFalse(inaccessibleButtonElement.isWDAccessibilityContainer); - } else { - // Xcode 10 and the below works fine - XCTAssertTrue(inaccessibleButtonElement.isWDAccessibilityContainer); - } + // FIXME: Xcode 11 environment returns false even if iOS 12 + // We must fix here to XCTAssertTrue if Xcode version will return the value properly + XCTAssertFalse(inaccessibleButtonElement.isWDAccessibilityContainer); } - (void)testIgnoredAccessibilityAttributes diff --git a/WebDriverAgentTests/IntegrationTests/FBElementVisibilityTests.m b/WebDriverAgentTests/IntegrationTests/FBElementVisibilityTests.m index d791e8ab5..1449e1ae8 100644 --- a/WebDriverAgentTests/IntegrationTests/FBElementVisibilityTests.m +++ b/WebDriverAgentTests/IntegrationTests/FBElementVisibilityTests.m @@ -63,11 +63,6 @@ - (void)disabled_testIconsFromSearchDashboard - (void)testTableViewCells { - if (SYSTEM_VERSION_GREATER_THAN(@"12.0")) { - // The test is flacky on iOS 12+ in Travis env - return; - } - [self launchApplication]; [self goToScrollPageWithCells:YES]; for (int i = 0 ; i < 10 ; i++) { diff --git a/WebDriverAgentTests/IntegrationTests/XCUIElementFBFindTests.m b/WebDriverAgentTests/IntegrationTests/XCUIElementFBFindTests.m index 243ebec5d..713aee760 100644 --- a/WebDriverAgentTests/IntegrationTests/XCUIElementFBFindTests.m +++ b/WebDriverAgentTests/IntegrationTests/XCUIElementFBFindTests.m @@ -71,10 +71,7 @@ - (void)testDescendantsWithIdentifier { NSArray *matchingSnapshots = [self.testedView fb_descendantsMatchingIdentifier:@"Alerts" shouldReturnAfterFirstMatch:NO]; - int snapshotsCount = 1; - if (@available(iOS 13.0, *)) { - snapshotsCount = 2; - } + int snapshotsCount = 2; XCTAssertEqual(matchingSnapshots.count, snapshotsCount); XCTAssertEqual(matchingSnapshots.firstObject.elementType, XCUIElementTypeButton); XCTAssertEqualObjects(matchingSnapshots.lastObject.label, @"Alerts"); @@ -162,10 +159,7 @@ - (void)testDescendantsWithComplexXPathQuery { NSArray *matchingSnapshots = [self.testedView fb_descendantsMatchingXPathQuery:@"//*[@label='Scrolling']/preceding::*[boolean(string(@label))]" shouldReturnAfterFirstMatch:NO]; - int snapshotsCount = 3; - if (@available(iOS 13.0, *)) { - snapshotsCount = 6; - } + int snapshotsCount = 6; XCTAssertEqual(matchingSnapshots.count, snapshotsCount); } @@ -198,10 +192,7 @@ - (void)testDescendantsWithPredicateString NSPredicate *predicate = [NSPredicate predicateWithFormat:@"label = 'Alerts'"]; NSArray *matchingSnapshots = [self.testedView fb_descendantsMatchingPredicate:predicate shouldReturnAfterFirstMatch:NO]; - int snapshotsCount = 1; - if (@available(iOS 13.0, *)) { - snapshotsCount = 2; - } + int snapshotsCount = 2; XCTAssertEqual(matchingSnapshots.count, snapshotsCount); XCTAssertEqual(matchingSnapshots.firstObject.elementType, XCUIElementTypeButton); XCTAssertEqualObjects(matchingSnapshots.lastObject.label, @"Alerts"); @@ -243,10 +234,7 @@ - (void)testDescendantsWithPropertyStrict partialSearch:NO]; XCTAssertEqual(matchingSnapshots.count, 0); matchingSnapshots = [self.testedView fb_descendantsMatchingProperty:@"label" value:@"Alerts" partialSearch:NO]; - int snapshotsCount = 1; - if (@available(iOS 13.0, *)) { - snapshotsCount = 2; - } + int snapshotsCount = 2; XCTAssertEqual(matchingSnapshots.count, snapshotsCount); XCTAssertEqual(matchingSnapshots.firstObject.elementType, XCUIElementTypeButton); XCTAssertEqualObjects(matchingSnapshots.lastObject.label, @"Alerts"); @@ -259,10 +247,7 @@ - (void)testGlobalWithPropertyStrict partialSearch:NO]; XCTAssertEqual(matchingSnapshots.count, 0); matchingSnapshots = [self.testedApplication fb_descendantsMatchingProperty:@"label" value:@"Alerts" partialSearch:NO]; - int snapshotsCount = 1; - if (@available(iOS 13.0, *)) { - snapshotsCount = 2; - } + int snapshotsCount = 2; XCTAssertEqual(matchingSnapshots.count, snapshotsCount); XCTAssertEqual(matchingSnapshots.firstObject.elementType, XCUIElementTypeButton); XCTAssertEqualObjects(matchingSnapshots.lastObject.label, @"Alerts"); @@ -273,10 +258,7 @@ - (void)testDescendantsWithPropertyPartial NSArray *matchingSnapshots = [self.testedView fb_descendantsMatchingProperty:@"label" value:@"Alerts" partialSearch:NO]; - int snapshotsCount = 1; - if (@available(iOS 13.0, *)) { - snapshotsCount = 2; - } + int snapshotsCount = 2; XCTAssertEqual(matchingSnapshots.count, snapshotsCount); XCTAssertEqual(matchingSnapshots.firstObject.elementType, XCUIElementTypeButton); XCTAssertEqualObjects(matchingSnapshots.lastObject.label, @"Alerts"); @@ -297,19 +279,13 @@ - (void)testDescendantsWithClassChain - (void)testDescendantsWithClassChainWithIndex { NSArray *matchingSnapshots; - NSString *queryString = @"XCUIElementTypeWindow/*/*[2]/*/*/XCUIElementTypeButton"; - if (@available(iOS 13.0, *)) { - // iPhone - queryString = @"XCUIElementTypeWindow/*/*/*/*[2]/*/*/XCUIElementTypeButton"; - matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString - shouldReturnAfterFirstMatch:NO]; - if (matchingSnapshots.count == 0) { - // iPad - queryString = @"XCUIElementTypeWindow/*/*/*/*/*[2]/*/*/XCUIElementTypeButton"; - matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString - shouldReturnAfterFirstMatch:NO]; - } - } else { + // iPhone + NSString *queryString = @"XCUIElementTypeWindow/*/*/*/*[2]/*/*/XCUIElementTypeButton"; + matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString + shouldReturnAfterFirstMatch:NO]; + if (matchingSnapshots.count == 0) { + // iPad + queryString = @"XCUIElementTypeWindow/*/*/*/*/*[2]/*/*/XCUIElementTypeButton"; matchingSnapshots = [self.testedApplication fb_descendantsMatchingClassChain:queryString shouldReturnAfterFirstMatch:NO]; } @@ -444,10 +420,7 @@ - (void)setUp - (void)testNestedQueryWithClassChain { - NSString *queryString = @"XCUIElementTypeOther"; - if (@available(iOS 13.0, *)) { - queryString = @"XCUIElementTypePicker"; - } + NSString *queryString = @"XCUIElementTypePicker"; FBAssertWaitTillBecomesTrue(self.testedApplication.buttons[@"Button"].fb_isVisible); XCUIElement *datePicker = [self.testedApplication descendantsMatchingType:XCUIElementTypeDatePicker].allElementsBoundByIndex.firstObject; @@ -455,10 +428,7 @@ - (void)testNestedQueryWithClassChain shouldReturnAfterFirstMatch:NO]; XCTAssertEqual(matches.count, 1); - XCUIElementType expectedType = XCUIElementTypeOther; - if (@available(iOS 13.0, *)) { - expectedType = XCUIElementTypePicker; - } + XCUIElementType expectedType = XCUIElementTypePicker; XCTAssertEqual([matches firstObject].elementType, expectedType); }