From flutter-skills-33
Configures Flutter Driver extension for app interaction and converts MCP actions into permanent integration tests using integration_test package. Use for adding integration testing, UI exploration via MCP, or automating user flows.
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin flutter-skills-33This skill uses the workspace's default tool permissions.
- [Project Setup and Dependencies](#project-setup-and-dependencies)
Conducts multi-round deep research on GitHub repos via API and web searches, generating markdown reports with executive summaries, timelines, metrics, and Mermaid diagrams.
Dynamically discovers and combines enabled skills into cohesive, unexpected delightful experiences like interactive HTML or themed artifacts. Activates on 'surprise me', inspiration, or boredom cues.
Generates images from structured JSON prompts via Python script execution. Supports reference images and aspect ratios for characters, scenes, products, visuals.
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,
);
}
},
);
}