npx skills add ...
npx skills add flutter/skills --skill flutter-add-integration-test
npx skills add flutter/skills --skill flutter-add-integration-test
Configures Flutter Driver for app interaction and converts MCP actions into permanent integration tests. Use when adding integration testing to a project, exploring UI components via MCP, or automating user flows with the integration_test package.
The same skill content is published under more than one repo. The install counts are split across them; any of these commands works.
Configure the project to support integration testing and Flutter Driver extensions.
pubspec.yaml:
lib/main.dart or a dedicated lib/main_test.dart):
package:flutter_driver/driver_extension.dart.enableFlutterDriverExtension(); before runApp().Key parameters (e.g., ValueKey('login_button')) to critical widgets in the application code to ensure reliable targeting during tests.Use the Dart/Flutter MCP server tools to interactively explore and manipulate the application state before writing static tests.
launch_app with target: "lib/main_test.dart" to start the application and acquire the DTD URI.get_widget_tree to discover available Keys, Text nodes, and widget Types.tap, enter_text, and scroll to simulate user flows.waitFor or verify state with get_health when navigating or triggering animations.SliverList or ListView. Execute scroll or scrollIntoView to force the widget to mount before interacting with it.Structure integration tests using the flutter_test API paradigm.
integration_test/ directory at the project root.<name>_test.dart convention.IntegrationTestWidgetsFlutterBinding.ensureInitialized(); at the start of main().await tester.pumpWidget(MyApp());.await tester.pumpAndSettle(); after interactions like tester.tap().expect(find.byKey(ValueKey('foo')), findsOneWidget); or findsNothing.await tester.scrollUntilVisible(itemFinder, 500.0, scrollable: listFinder);.Conditional Logic for Legacy flutter_driver:
flutter_driver tests, use driver.waitFor(), driver.waitForAbsent(), driver.tap(), and driver.scroll() instead of the WidgetTester APIs.Execute tests using the flutter drive command. Require a host driver script located in test_driver/integration_test.dart that calls integrationDriver().
Conditional Execution Targets:
chromedriver --port=4444 in a separate terminal, then run:
flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart -d chrome-d web-server.flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart.flutter build apk --debug./gradlew app:assembleAndroidTestCopy and follow this checklist to implement and verify integration tests.
integration_test and flutter_test to pubspec.yaml.enableFlutterDriverExtension() into the app entry point.ValueKeys to target widgets.launch_app via MCP.get_widget_tree.tap, enter_text).integration_test/app_test.dart.WidgetTester APIs.test_driver/integration_test.dart with integrationDriver().flutter drive --driver=test_driver/integration_test.dart --target=integration_test/app_test.dart.PumpAndSettleTimedOutException occurs, check for infinite animations -> If widget not found, add scrollUntilVisible -> Re-run test until passing.integration_test/app_test.dart)test_driver/integration_test.dart)test_driver/perf_driver.dart)Use this driver script if you wrap your test actions in binding.traceAction() to capture performance metrics.