Run Scenarios
This page explains how scenarios are executed and which snapshot artifacts are created during tests.
Widgetbook testing is built on top of Flutter's flutter_test package. Scenario execution runs in the same widget test environment you already use for regular Flutter tests.
Setup
Add the Test Entry Point
Create
test/widgetbook_test.dartand calltestWidgetbook(config):import 'package:design-system/widgetbook.config.dart'; import 'package:widgetbook/test.dart'; Future<void> main() async { await testWidgetbook(config); }Run the Test
Run tests from your Widgetbook project:
flutter testtestWidgetbookautomatically discovers all components, stories, and scenarios from yourconfigand executes them.
What Happens During Execution
For each scenario, the Widgetbook test runtime:
- applies viewport constraints and pixel ratio
- builds the scenario with your config
- runs scenario interactions via
run(if defined) - captures a screenshot after
runcompletes - captures semantics data for accessibility inspection
Because this flow uses flutter_test, your scenario run callback receives a WidgetTester. You can use familiar test APIs such as tap, pump, pumpAndSettle, and expect directly inside run.
See Creating Scenarios for concrete run examples.

