diff --git a/KIF Tests/AccessibilityIdentifierPullToRefreshTests.m b/KIF Tests/AccessibilityIdentifierPullToRefreshTests.m index fac2ab30..c4aab2a9 100644 --- a/KIF Tests/AccessibilityIdentifierPullToRefreshTests.m +++ b/KIF Tests/AccessibilityIdentifierPullToRefreshTests.m @@ -15,31 +15,29 @@ @interface AccessibilityIdentifierPullToRefreshTests : KIFTestCase @implementation AccessibilityIdentifierPullToRefreshTests --(void) testPullToRefreshByAccessibilityIdentifier +- (void)afterEach { - UITableView *tableView; - [tester waitForAccessibilityElement:NULL view:&tableView withIdentifier:@"Test Suite TableView" tappable:NO]; - - [tester tapViewWithAccessibilityLabel:@"Reset Refresh Control"]; - [tester pullToRefreshViewWithAccessibilityIdentifier:@"Test Suite TableView"]; - [tester waitForViewWithAccessibilityLabel:@"Bingo!"]; - [tester waitForAbsenceOfViewWithAccessibilityLabel:@"Bingo!"]; + // Once #1296 is landed, use that on the `waitForView...` calls below. + // The issue is that implicit scrolling the table view when searching for label is causing "Bingo!" to immediately disappear. + [tester waitForTimeInterval:3.0]; } --(void) testPullToRefreshByAccessibilityIdentifierWithDuration +- (void)testPullToRefreshByAccessibilityIdentifier { - UITableView *tableView; - [tester waitForAccessibilityElement:NULL view:&tableView withIdentifier:@"Test Suite TableView" tappable:NO]; - - [tester tapViewWithAccessibilityLabel:@"Reset Refresh Control"]; - [tester pullToRefreshViewWithAccessibilityIdentifier:@"Test Suite TableView" pullDownDuration:KIFPullToRefreshInAboutThreeSeconds]; - [tester waitForViewWithAccessibilityLabel:@"Bingo!"]; - [tester waitForAbsenceOfViewWithAccessibilityLabel:@"Bingo!"]; + [tester waitForViewWithAccessibilityIdentifier:@"Test Suite TableView"]; + [tester pullToRefreshViewWithAccessibilityIdentifier:@"Test Suite TableView"]; + [tester waitForTimeInterval:1.0]; + [tester waitForViewWithAccessibilityLabel:@"Bingo!"]; + [tester waitForAbsenceOfViewWithAccessibilityLabel:@"Bingo!"]; } -- (void)afterEach +- (void)testPullToRefreshByAccessibilityIdentifierWithDuration { - [tester waitForAnimationsToFinish]; + [tester waitForViewWithAccessibilityIdentifier:@"Test Suite TableView"]; + [tester pullToRefreshViewWithAccessibilityIdentifier:@"Test Suite TableView" pullDownDuration:KIFPullToRefreshInAboutAHalfSecond]; + [tester waitForTimeInterval:1.0]; + [tester waitForViewWithAccessibilityLabel:@"Bingo!"]; + [tester waitForAbsenceOfViewWithAccessibilityLabel:@"Bingo!"]; } @end diff --git a/KIF Tests/PullToRefreshTests.m b/KIF Tests/PullToRefreshTests.m index 67f350d6..84963953 100644 --- a/KIF Tests/PullToRefreshTests.m +++ b/KIF Tests/PullToRefreshTests.m @@ -15,30 +15,34 @@ @interface PullToRefreshTests : KIFTestCase @implementation PullToRefreshTests --(void) testPullToRefreshByAccessibilityLabelWithDuration +- (void)afterEach { - UITableView *tableView; - [tester waitForAccessibilityElement:NULL view:&tableView withIdentifier:@"Test Suite TableView" tappable:NO]; - - [tester pullToRefreshViewWithAccessibilityLabel:@"Table View" pullDownDuration:KIFPullToRefreshInAboutThreeSeconds]; - [tester waitForViewWithAccessibilityLabel:@"Bingo!"]; - [tester waitForAbsenceOfViewWithAccessibilityLabel:@"Bingo!"]; + // Once #1296 is landed, use that on the `waitForView...` calls below. + // The issue is that implicit scrolling the table view when searching for label is causing "Bingo!" to immediately disappear. + [tester waitForTimeInterval:3.0]; +} - [tester waitForTimeInterval:5.0f]; //make sure the PTR is finished. +- (void)testPullToRefreshByAccessibilityLabelWithDuration +{ + [tester waitForViewWithAccessibilityIdentifier:@"Test Suite TableView"]; + [tester pullToRefreshViewWithAccessibilityLabel:@"Table View" pullDownDuration:KIFPullToRefreshInAboutAHalfSecond]; + [tester waitForTimeInterval:1.0]; + [tester waitForViewWithAccessibilityLabel:@"Bingo!"]; + [tester waitForAbsenceOfViewWithAccessibilityLabel:@"Bingo!"]; } --(void) testPullToRefreshWithBigContentSize +- (void)testPullToRefreshWithBigContentSize { UITableView *tableView; [tester waitForAccessibilityElement:NULL view:&tableView withIdentifier:@"Test Suite TableView" tappable:NO]; CGSize originalSize = tableView.contentSize; tableView.contentSize = CGSizeMake(1000, 10000); - [tester pullToRefreshViewWithAccessibilityLabel:@"Table View" pullDownDuration:KIFPullToRefreshInAboutThreeSeconds]; + [tester pullToRefreshViewWithAccessibilityLabel:@"Table View" pullDownDuration:KIFPullToRefreshInAboutAHalfSecond]; + [tester waitForTimeInterval:1.0]; [tester waitForViewWithAccessibilityLabel:@"Bingo!"]; [tester waitForAbsenceOfViewWithAccessibilityLabel:@"Bingo!"]; - [tester waitForTimeInterval:5.0f]; //make sure the PTR is finished. tableView.contentSize = originalSize; } diff --git a/KIF Tests/PullToRefreshTests_ViewTestActor.m b/KIF Tests/PullToRefreshTests_ViewTestActor.m index 6882d107..e406b4e5 100644 --- a/KIF Tests/PullToRefreshTests_ViewTestActor.m +++ b/KIF Tests/PullToRefreshTests_ViewTestActor.m @@ -15,26 +15,33 @@ @interface PullToRefreshTests_ViewTestActor : KIFTestCase @implementation PullToRefreshTests_ViewTestActor --(void) testPullToRefreshByAccessibilityLabelWithDuration +- (void)afterEach +{ + // Once #1296 is landed, use that on the `waitForView...` calls below. + // The issue is that implicit scrolling the table view when searching for label is causing "Bingo!" to immediately disappear. + [tester waitForTimeInterval:3.0]; +} + +- (void)testPullToRefreshByAccessibilityLabelWithDuration { [[viewTester usingIdentifier:@"Test Suite TableView"] waitForView]; - [[viewTester usingLabel:@"Table View"] pullToRefreshWithDuration:KIFPullToRefreshInAboutOneSecond]; + [[viewTester usingLabel:@"Table View"] pullToRefreshWithDuration:KIFPullToRefreshInAboutAHalfSecond]; + [tester waitForTimeInterval:1.0]; [[viewTester usingLabel:@"Bingo!"] waitForView]; [[viewTester usingLabel:@"Bingo!"] waitForAbsenceOfView]; - [viewTester waitForTimeInterval:1.0f]; } --(void) testPullToRefreshWithBigContentSize +- (void)testPullToRefreshWithBigContentSize { UITableView *tableView = (id)[[viewTester usingIdentifier:@"Test Suite TableView"] waitForView]; CGSize originalSize = tableView.contentSize; tableView.contentSize = CGSizeMake(1000, 10000); - [[viewTester usingLabel:@"Table View"] pullToRefreshWithDuration:KIFPullToRefreshInAboutOneSecond]; + [[viewTester usingLabel:@"Table View"] pullToRefreshWithDuration:KIFPullToRefreshInAboutAHalfSecond]; + [tester waitForTimeInterval:1.0]; [[viewTester usingLabel:@"Bingo!"] waitForView]; [[viewTester usingLabel:@"Bingo!"] waitForAbsenceOfView]; - [viewTester waitForTimeInterval:1.0f]; tableView.contentSize = originalSize; } diff --git a/Sources/KIF/Classes/KIFUITestActor.m b/Sources/KIF/Classes/KIFUITestActor.m index 80b1f8f9..c686fc2c 100644 --- a/Sources/KIF/Classes/KIFUITestActor.m +++ b/Sources/KIF/Classes/KIFUITestActor.m @@ -1330,7 +1330,8 @@ - (void)pullToRefreshAccessibilityElement:(UIAccessibilityElement *)element inVi // Can handle only the touchable space. CGRect elementFrame = [viewToSwipe convertRect:viewToSwipe.bounds toView:[UIApplication sharedApplication].keyWindow.rootViewController.view]; CGPoint swipeStart = CGPointCenteredInRect(elementFrame); - CGPoint swipeDisplacement = CGPointMake(CGRectGetMidX(elementFrame), CGRectGetMaxY(elementFrame)); + swipeStart.y = swipeStart.y - CGRectGetMaxY(elementFrame) / 4.0; + CGPoint swipeDisplacement = CGPointMake(0, CGRectGetMaxY(elementFrame) / 2.0); [viewToSwipe dragFromPoint:swipeStart displacement:swipeDisplacement steps:kNumberOfPointsInSwipePath]; } diff --git a/Test Host/Base.lproj/MainStoryboard.storyboard b/Test Host/Base.lproj/MainStoryboard.storyboard index bfb6a686..02c310ca 100644 --- a/Test Host/Base.lproj/MainStoryboard.storyboard +++ b/Test Host/Base.lproj/MainStoryboard.storyboard @@ -3,7 +3,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -364,7 +364,7 @@ - + @@ -373,6 +373,7 @@ + @@ -388,7 +389,7 @@ - +