flutter-widget-testing
Installation
SKILL.md
When to Use
- Testing UI components (atoms, molecules, organisms, templates, pages)
- Testing widget rendering, layout, and text content
- Testing user interactions (tap, scroll, enter text, drag)
- Creating golden tests for visual regression
- Verifying accessibility (semantics, labels)
- Testing widgets that use Riverpod providers
- Testing navigation and routing behavior
Critical Patterns
| Pattern | Rule |
|---|---|
| Test FIRST | Write the failing widget test before the widget. Red -> Green -> Refactor. |
| Wrap with app shell | Always wrap tested widgets in MaterialApp or the Forui theme equivalent |
| pump vs pumpAndSettle | pump() advances one frame; pumpAndSettle() waits for all animations |
| Finders are lazy | find.text('X') doesn't search until used in expect() or tester.tap() |
| Golden tests pinned | Update goldens explicitly with --update-goldens; never auto-update in CI |
Related skills