Created
June 7, 2025 03:54
-
-
Save rubywai/fc5802f2b5e7afd16ba7ef205ae40020 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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