Skip to content

Commit 207328c

Browse files
mapbox-github-ci-writer-1[bot]evil159
authored andcommitted
[Backport release/v0.12] Listen for mapLoaded events before QRF tests (#3551)
Backport 0317e8a434b94a26a90c6a196a6b208075d444a7 from #3457. cc @mapbox/sdk-ci Co-authored-by: Roman Laitarenko <[email protected]> GitOrigin-RevId: 632a825bd0becc33144906e9dbc8e4ffbedc6823
1 parent 5f46396 commit 207328c

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

Tests/MapboxMapsTests/Foundation/FeaturesetsTests.swift

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@ final class FeaturesetsTests: IntegrationTestCase {
1616

1717
map.setCamera(to: CameraOptions(center: CLLocationCoordinate2D(latitude: 0, longitude: 0), zoom: 10))
1818

19-
let expectation = expectation(description: "Load style")
20-
map.load(mapStyle: .featuresetTestsStyle) { res in
21-
switch res {
22-
case .none:
23-
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(1)) {
24-
expectation.fulfill()
25-
}
26-
case .some(let error):
27-
XCTFail("Failed to load style: \(error)")
28-
}
29-
}
19+
let expectation = expectation(description: "Load the map")
20+
21+
map.load(mapStyle: .featuresetTestsStyle)
22+
23+
map.onMapLoaded.observeNext { _ in
24+
expectation.fulfill()
25+
}.store(in: &cancelables)
3026

3127
wait(for: [expectation], timeout: 10.0)
3228

Tests/MapboxMapsTests/Foundation/InteractionsTests.swift

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@ final class InteractionsTests: IntegrationTestCase {
1616

1717
map.setCamera(to: CameraOptions(center: CLLocationCoordinate2D(latitude: 0, longitude: 0), zoom: 10))
1818

19-
let expectation = expectation(description: "Load style")
20-
map.load(mapStyle: .featuresetTestsStyle) { res in
21-
switch res {
22-
case .none:
23-
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(1)) {
24-
expectation.fulfill()
25-
}
26-
case .some(let error):
27-
XCTFail("Failed to load style: \(error)")
28-
}
29-
}
19+
let expectation = expectation(description: "Load the map")
20+
21+
map.load(mapStyle: .featuresetTestsStyle)
22+
23+
map.onMapLoaded.observeNext { _ in
24+
expectation.fulfill()
25+
}.store(in: &cancelables)
3026

3127
wait(for: [expectation], timeout: 10.0)
3228

Tests/MapboxMapsTests/Style/AttributionTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class AttributionTests: XCTestCase {
135135
parseExpectation.fulfill()
136136
}
137137

138-
wait(for: [parseExpectation], timeout: 5)
138+
wait(for: [parseExpectation], timeout: 15)
139139
}
140140

141141
func testFeedbackSnapshotTitle() {

0 commit comments

Comments
 (0)