Flutter "flutter drive timed out" / waited for element in CI
A Flutter integration test or flutter drive waited for a widget (via tester.pumpAndSettle or a driver finder) and the timeout elapsed before it appeared. On CI this is usually a slow device or an animation/future that never settles.
What this error means
The test fails with "Waited for ... but it never appeared" or "pumpAndSettle timed out", or the driver reports a timeout waiting for a finder. It passes locally on faster hardware.
TimeoutException after 0:00:30.000000: Waited for the finder to become
present, but it never appeared.
pumpAndSettle timed outCommon causes
A slow CI device rendered the widget late
The widget appears after the default finder timeout on a resource-starved emulator or simulator.
pumpAndSettle never settles
An infinite animation, a repeating ticker, or a never-completing future keeps frames scheduling, so pumpAndSettle waits until it times out.
How to fix it
Pump with a timeout and wait for the finder
- Replace bare
pumpAndSettle()with a bounded pump plus an explicit finder wait. - Raise the timeout for CI hardware.
- If an animation loops forever, avoid it or use
pumpwith a fixed duration.
await tester.pumpAndSettle(const Duration(seconds: 15));
expect(find.text('Welcome'), findsOneWidget);Avoid infinite animations under test
Replace endless spinners with a bounded animation in test builds so pumpAndSettle can reach a stable frame.
How to prevent it
- Bound pump timeouts for slower CI devices.
- Avoid infinite animations/tickers on screens under test.
- Wait for finders explicitly instead of assuming immediate presence.