summaryrefslogtreecommitdiff
path: root/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m
diff options
context:
space:
mode:
Diffstat (limited to 'platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m')
-rw-r--r--platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m9
1 files changed, 6 insertions, 3 deletions
diff --git a/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m b/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m
index 777afe3380..8b5d94f6f3 100644
--- a/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m
+++ b/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m
@@ -112,13 +112,16 @@ static const CGPoint kAnnotationRelativeScale = { 0.05f, 0.125f };
// Also note, that at this point, the internal mechanism that determines if
// an annotation view is offscreen and should be put back in the reuse queue
// will have run, and `viewForAnnotation` may return nil
-
- [self.mapView selectAnnotation:point moveIntoView:moveIntoView animateSelection:animateSelection];
+
+ XCTestExpectation *selectionCompleted = [self expectationWithDescription:@"Selection completed"];
+ [self.mapView selectAnnotation:point moveIntoView:moveIntoView animateSelection:animateSelection completionHandler:^{
+ [selectionCompleted fulfill];
+ }];
// Animated selection takes MGLAnimationDuration (0.3 seconds), so wait a little
// longer. We don't need to wait as long if we're not animated (but we do
// want the runloop to tick over)
- [self waitFor:animateSelection ? 0.4: 0.05];
+ [self waitForExpectations:@[selectionCompleted] timeout:animateSelection ? 0.4: 0.05];
UIView *annotationViewAfterSelection = [self.mapView viewForAnnotation:point];
CLLocationCoordinate2D mapCenterAfterSelection = self.mapView.centerCoordinate;