From flutter-skills-33
Configures Flutter Driver and converts MCP actions into permanent integration tests. Useful for adding integration testing, exploring UI via MCP, or automating user flows.
How this skill is triggered — by the user, by Claude, or both
Slash command
/flutter-skills-33:flutter-add-integration-testThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- [Project Setup and Dependencies](#project-setup-and-dependencies)
Configure the project to support integration testing and Flutter Driver extensions.
pubspec.yaml:
flutter pub add 'dev:integration_test:{"sdk":"flutter"}'
flutter pub add 'dev:flutter_test:{"sdk":"flutter"}'
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)import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:my_app/main.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
group('End-to-end test', () {
testWidgets('tap on the floating action button, verify counter', (tester) async {
// Load app widget.
await tester.pumpWidget(const MyApp());
// Verify the counter starts at 0.
expect(find.text('0'), findsOneWidget);
// Find the floating action button to tap on.
final fab = find.byKey(const ValueKey('increment'));
// Emulate a tap on the floating action button.
await tester.tap(fab);
// Trigger a frame and wait for animations.
await tester.pumpAndSettle();
// Verify the counter increments by 1.
expect(find.text('1'), findsOneWidget);
});
});
}
test_driver/integration_test.dart)import 'package:integration_test/integration_test_driver.dart';
Future<void> main() => integrationDriver();
test_driver/perf_driver.dart)Use this driver script if you wrap your test actions in binding.traceAction() to capture performance metrics.
import 'package:flutter_driver/flutter_driver.dart' as driver;
import 'package:integration_test/integration_test_driver.dart';
Future<void> main() {
return integrationDriver(
responseDataCallback: (data) async {
if (data != null) {
final timeline = driver.Timeline.fromJson(
data['scrolling_timeline'] as Map<String, dynamic>,
);
final summary = driver.TimelineSummary.summarize(timeline);
await summary.writeTimelineToFile(
'scrolling_timeline',
pretty: true,
includeSummary: true,
);
}
},
);
}
npx claudepluginhub flutter/skillsEntry point for AI-driven inspection, control, debugging, and custom tooling of running Flutter apps; performs preflight check and routes to task-specific skills.
Implements Flutter widget tests using WidgetTester to verify UI rendering and user interactions like tapping, scrolling, and entering text.
Automates mobile app testing on iOS and Android using Maestro MCP: launches apps, interacts with UI elements, captures screenshots, runs flows, collects evidence. Use to verify implementations before completion.