Skip to content

Commit 6532027

Browse files
evil159github-actions[bot]
authored andcommitted
Listen for mapLoaded events for QRF tests
GitOrigin-RevId: 0317e8a434b94a26a90c6a196a6b208075d444a7
1 parent 43b2952 commit 6532027

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)