Skip to content

Instantly share code, notes, and snippets.

@rubywai
Created June 7, 2025 03:54
Show Gist options
  • Save rubywai/fc5802f2b5e7afd16ba7ef205ae40020 to your computer and use it in GitHub Desktop.
Save rubywai/fc5802f2b5e7afd16ba7ef205ae40020 to your computer and use it in GitHub Desktop.
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:untitled/main.dart'; // Adjust if your main.dart is in another folder
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets("Full app integration test", (WidgetTester tester) async {
await tester.pumpWidget(const MyApp());
// Check initial state
expect(find.text('The counter is 0'), findsOneWidget);
// Tap increment
await tester.tap(find.text('Increment'));
await tester.pumpAndSettle();
expect(find.text('The counter is 1'), findsOneWidget);
// Tap decrement
await tester.tap(find.text('Decrement'));
await tester.pumpAndSettle();
expect(find.text('The counter is 0'), findsOneWidget);
// Tap reset
await tester.tap(find.text('Reset'));
await tester.pumpAndSettle();
expect(find.text('The counter is 0'), findsOneWidget);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment