agentsclimarketplace

Flutter integration test

Skill almasumdev/awesome-flutter-agent-skills/.github/skills/testing_and_automation/flutter-integration-test

Curated agent skills, conventions, and workflows for building Flutter apps with AI coding agents.

Install
npx -y skills add almasumdev/awesome-flutter-agent-skills --skill flutter-integration-test

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Essential scripts and patterns for Flutter integration_test automation — end-to-end flows, semantic navigation, device farms, and CI. Use this when building or running on-device tests.

SKILL.md

3.5 KB, as published. Nobody here has run it

Flutter integration_test Automation

Instructions

The integration_test package runs real app flows on real devices/emulators. Use it for end-to-end smoke tests, cross-platform regression, and screenshots.

1. Setup

Add to pubspec.yaml:

dev_dependencies:
  integration_test:
    sdk: flutter
  flutter_test:
    sdk: flutter

Create integration_test/app_test.dart:

import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:my_app/main.dart' as app;

void main() {
  IntegrationTestWidgetsFlutterBinding.ensureInitialized();

  testWidgets('login → articles → detail', (tester) async {
    app.main();
    await tester.pumpAndSettle();

    await tester.enterText(find.byKey(const Key('email')), '[email protected]');
    await tester.enterText(find.byKey(const Key('password')), 'pw');
    await tester.tap(find.byKey(const Key('submit')));
    await tester.pumpAndSettle();

    expect(find.byKey(const Key('articles-screen')), findsOneWidget);
    await tester.tap(find.byKey(const ValueKey('article-1')));
    await tester.pumpAndSettle();
    expect(find.byKey(const Key('article-detail')), findsOneWidget);
  });
}

2. Running

  • Local device / emulator: flutter test integration_test/app_test.dart.
  • Specific device: flutter test integration_test -d <deviceId>.
  • Headless web / desktop: supported on the respective platform.

3. Screenshots

final binding =
    IntegrationTestWidgetsFlutterBinding.ensureInitialized();

testWidgets('take home screenshot', (tester) async {
  app.main();
  await tester.pumpAndSettle();
  await binding.convertFlutterSurfaceToImage();
  await tester.pumpAndSettle();
  await binding.takeScreenshot('home');
});

Screenshots are saved per platform; hook into the driver (test_driver/integration_test.dart) to persist them to disk.

4. Semantic Navigation

Use Keys on important widgets and navigate by keys — more stable than by text.

For semantic queries from an agent or test runner:

final found = find.bySemanticsLabel(RegExp('Submit'));
await tester.tap(found);

5. Device Farms / CI

  • Firebase Test Lab (Android): gcloud firebase test android run --type instrumentation --test build/app/outputs/apk/androidTest/....
  • Xcode Cloud / Maestro / BrowserStack: follow each provider's recipe; the Flutter side is the same.
  • Build a test driver APK with: flutter build apk --config-only then ./gradlew app:assembleAndroidTest.

6. Flakiness Reduction

  • Never rely on await Future.delayed(...) to wait for UI — use pump(Duration) in a loop with a predicate, or tester.pumpUntil(...) helper.
  • Stub network at the app layer (override providers / inject fakes via --dart-define).
  • Seed the app with a known fixture state for each test.
  • Disable animations if needed: timeDilation = 0.01; (from scheduler lib) in setUpAll.

7. Checklist

  • integration_test wired up with IntegrationTestWidgetsFlutterBinding.
  • Each test resets app state (start from app.main() or a controlled entrypoint).
  • Key widgets are tagged with stable Keys.
  • CI job runs on an emulator/simulator image pinned by version.
  • Screenshots archived as CI artifacts for failure diagnosis.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.