Skip to content

Commit 7b8a08b

Browse files
committed
test: fix test for multiple destinations navigation
1 parent fb0b623 commit 7b8a08b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

example/integration_test/t03_navigation_test.dart

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void main() {
171171
'Test navigating to multiple destinations',
172172
(PatrolIntegrationTester $) async {
173173
final Completer<void> navigationFinished = Completer<void>();
174-
final Completer<void> newSessionFired = Completer<void>();
174+
Completer<void> newSessionFired = Completer<void>();
175175
int arrivalEventCount = 0;
176176
List<NavigationWaypoint> waypoints = <NavigationWaypoint>[];
177177

@@ -202,6 +202,9 @@ void main() {
202202
SimulationOptions(speedMultiplier: 5),
203203
);
204204
} else {
205+
// Reset the completer to test that new session event fires again
206+
newSessionFired = Completer<void>();
207+
205208
// Find and remove the waypoint that matches the arrived waypoint
206209
int waypointIndex = -1;
207210
for (int i = 0; i < waypoints.length; i++) {
@@ -225,6 +228,17 @@ void main() {
225228
),
226229
);
227230
await GoogleMapsNavigator.setDestinations(updatedDestinations);
231+
232+
// Wait for new session event after updating destinations
233+
await newSessionFired.future.timeout(
234+
const Duration(seconds: 10),
235+
onTimeout:
236+
() =>
237+
throw TimeoutException(
238+
'New navigation session event was not fired after updating destinations',
239+
),
240+
);
241+
228242
await GoogleMapsNavigator.simulator
229243
.simulateLocationsAlongExistingRouteWithOptions(
230244
SimulationOptions(speedMultiplier: 5),

0 commit comments

Comments
 (0)