Complete the code to import the Flutter test package needed for writing tests.
import '[1]'; void main() { test('Simple test', () { expect(1 + 1, 2); }); }
Complete the code to define a widget test that checks if a Text widget displays the correct string.
testWidgets('Check Text widget', (WidgetTester [1]) async { await tester.pumpWidget(const Text('Hello')); expect(find.text('Hello'), findsOneWidget); });
Fix the error in the test code by completing the missing method to rebuild the widget tree after state changes.
testWidgets('Tap button increments counter', (WidgetTester tester) async { await tester.pumpWidget(const MyCounterApp()); await tester.tap(find.byIcon(Icons.add)); await tester.[1](); expect(find.text('1'), findsOneWidget); });
Fill both blanks to create a test that verifies a widget is not found after an action.
testWidgets('Verify widget disappears', (WidgetTester tester) async { await tester.pumpWidget(const MyWidget()); await tester.tap(find.byKey(Key('removeButton'))); await tester.[1](); expect(find.byType(Text), [2]); });
Fill all three blanks to write a test that pumps a widget, taps a button, and verifies the counter text updates.
testWidgets('Counter increments test', (WidgetTester [1]) async { await [1].pumpWidget(const CounterApp()); await [1].tap(find.byIcon(Icons.add)); await [1].[2](); expect(find.text('[3]'), findsOneWidget); });
