Skip to content

Commit 60c02af

Browse files
committed
test: fix test for multiple destinations navigation
1 parent 4b0299a commit 60c02af

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
@@ -179,7 +179,7 @@ void main() {
179179
'Test navigating to multiple destinations',
180180
(PatrolIntegrationTester $) async {
181181
final Completer<void> navigationFinished = Completer<void>();
182-
final Completer<void> newSessionFired = Completer<void>();
182+
Completer<void> newSessionFired = Completer<void>();
183183
int arrivalEventCount = 0;
184184
List<NavigationWaypoint> waypoints = <NavigationWaypoint>[];
185185

@@ -210,6 +210,9 @@ void main() {
210210
SimulationOptions(speedMultiplier: 5),
211211
);
212212
} else {
213+
// Reset the completer to test that new session event fires again
214+
newSessionFired = Completer<void>();
215+
213216
// Find and remove the waypoint that matches the arrived waypoint
214217
int waypointIndex = -1;
215218
for (int i = 0; i < waypoints.length; i++) {
@@ -233,6 +236,17 @@ void main() {
233236
),
234237
);
235238
await GoogleMapsNavigator.setDestinations(updatedDestinations);
239+
240+
// Wait for new session event after updating destinations
241+
await newSessionFired.future.timeout(
242+
const Duration(seconds: 10),
243+
onTimeout:
244+
() =>
245+
throw TimeoutException(
246+
'New navigation session event was not fired after updating destinations',
247+
),
248+
);
249+
236250
await GoogleMapsNavigator.simulator
237251
.simulateLocationsAlongExistingRouteWithOptions(
238252
SimulationOptions(speedMultiplier: 5),

0 commit comments

Comments
 (0)