Member-only story
Flutter Widget and Integration Tests — some Surprises about Timeouts and Durations
7 min readDec 26, 2021
I’ve been working on a big Flutter project for half a year now. One of my tasks is writing integration tests. In this article I summarize what I have learned about timouts.
You will learn:
- how to fail early when pumpAndSettle() waits on endless running animations.
- how to set the default timeout for all widgetTests.
- some surprises of time and size when running widgetTests.
Preparation of a Tiny Project
I modified the standard counter app for a little experiment:
- I removed the floating action button and replaced it with a timer which increases the _counter every second.
- I added an endless running CircularProgressIndicator.
- I figured out the size of the widget using context.findRenderObject().
Here I start the timer in initState():