Skip to content
Latchkey

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.

Flutter
TimeoutException after 0:00:30.000000: Waited for the finder to become
present, but it never appeared.
pumpAndSettle timed out

Common 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

  1. Replace bare pumpAndSettle() with a bounded pump plus an explicit finder wait.
  2. Raise the timeout for CI hardware.
  3. If an animation loops forever, avoid it or use pump with a fixed duration.
integration_test/app_test.dart
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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →