From c93f03fa0bf44bbd0d3b79c61225a2a21eeb50d0 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 7 May 2026 12:27:33 +0200 Subject: [PATCH] Replace pumpAndSettle with pump where possible --- test/auth/auth_screen_test.dart | 8 ++++---- test/exercises/contribute_exercise_test.dart | 8 ++++---- test/nutrition/ingredient_typeahead_test.dart | 8 ++++---- .../nutritional_meal_item_form_test.dart | 18 +++++++++--------- test/routine/day_form_test.dart | 2 +- test/routine/forms/slot_form_test.dart | 4 ++-- .../gym_mode/gym_mode_options_test.dart | 10 +++++----- .../routines/gym_mode/log_page_test.dart | 2 +- .../routines/plate_calculator_test.dart | 4 ++-- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/test/auth/auth_screen_test.dart b/test/auth/auth_screen_test.dart index 74d1333a3..59a5826c6 100644 --- a/test/auth/auth_screen_test.dart +++ b/test/auth/auth_screen_test.dart @@ -202,9 +202,9 @@ void main() { // Act await tester.tap(find.byKey(const ValueKey('toggleCustomServerButton'))); - await tester.pumpAndSettle(); + await tester.pump(); await tester.tap(find.byKey(const ValueKey('toggleApiTokenButton'))); - await tester.pumpAndSettle(); + await tester.pump(); await tester.enterText( find.byKey(const ValueKey('inputApiToken')), '1234567890abcdef1234567890abcdef12345678', @@ -255,9 +255,9 @@ void main() { // Act await tester.tap(find.byKey(const ValueKey('toggleCustomServerButton'))); - await tester.pumpAndSettle(); + await tester.pump(); await tester.tap(find.byKey(const ValueKey('toggleApiTokenButton'))); - await tester.pumpAndSettle(); + await tester.pump(); await tester.enterText( find.byKey(const ValueKey('inputApiToken')), '31e2ea0322c07b9df583a9b6d1e794f7139e78d4', diff --git a/test/exercises/contribute_exercise_test.dart b/test/exercises/contribute_exercise_test.dart index 7399a227c..362f6c073 100644 --- a/test/exercises/contribute_exercise_test.dart +++ b/test/exercises/contribute_exercise_test.dart @@ -179,7 +179,7 @@ void main() { // Enter text into the name field await tester.enterText(nameField, 'Bench Press'); - await tester.pumpAndSettle(); + await tester.pump(); // Verify that the entered text is displayed expect(find.text('Bench Press'), findsOneWidget); @@ -204,7 +204,7 @@ void main() { // Enter multi-line text with newline character await tester.enterText(alternativeNamesField, 'Chest Press\nFlat Bench Press'); - await tester.pumpAndSettle(); + await tester.pump(); // Verify that multi-line text was accepted and is displayed expect(find.text('Chest Press\nFlat Bench Press'), findsOneWidget); @@ -226,7 +226,7 @@ void main() { // Fill the name field (to isolate category validation) final nameField = find.byType(TextFormField).first; await tester.enterText(nameField, 'Test Exercise'); - await tester.pumpAndSettle(); + await tester.pump(); // Get localized text for UI elements final context = tester.element(find.byType(Stepper)); @@ -268,7 +268,7 @@ void main() { // Enter text in the name field final nameField = find.byType(TextFormField).first; await tester.enterText(nameField, 'Test Exercise'); - await tester.pumpAndSettle(); + await tester.pump(); // Verify that the entered text persists final enteredText = find.text('Test Exercise'); diff --git a/test/nutrition/ingredient_typeahead_test.dart b/test/nutrition/ingredient_typeahead_test.dart index 7be4e520c..5c9194a8c 100644 --- a/test/nutrition/ingredient_typeahead_test.dart +++ b/test/nutrition/ingredient_typeahead_test.dart @@ -120,11 +120,11 @@ void main() { expect(tester.widget(vegetarianSwitchFinder).value, isFalse); await tester.tap(veganSwitchFinder); - await tester.pumpAndSettle(); + await tester.pump(); expect(tester.widget(veganSwitchFinder).value, isTrue); await tester.tap(vegetarianSwitchFinder); - await tester.pumpAndSettle(); + await tester.pump(); expect(tester.widget(vegetarianSwitchFinder).value, isTrue); }); @@ -207,7 +207,7 @@ void main() { // Toggle Vegan switch to ON await tester.tap(find.widgetWithText(SwitchListTile, 'Vegan')); - await tester.pumpAndSettle(); + await tester.pump(); await tester.tap(find.text('Close')); await tester.pumpAndSettle(); @@ -261,7 +261,7 @@ void main() { final sliderFinder = find.byType(Slider); final Slider slider = tester.widget(sliderFinder); slider.onChanged!(1.0); - await tester.pumpAndSettle(); + await tester.pump(); await tester.tap(find.text('Close')); await tester.pumpAndSettle(); diff --git a/test/nutrition/nutritional_meal_item_form_test.dart b/test/nutrition/nutritional_meal_item_form_test.dart index 580d805e6..1c154127c 100644 --- a/test/nutrition/nutritional_meal_item_form_test.dart +++ b/test/nutrition/nutritional_meal_item_form_test.dart @@ -211,10 +211,10 @@ void main() { await tester.pumpWidget(createMealItemFormScreen(meal1, '123', true)); await tester.enterText(find.byKey(const Key('field-weight')), ''); - await tester.pumpAndSettle(); + await tester.pump(); await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); - await tester.pumpAndSettle(); + await tester.pump(); expect(find.text('Please enter a value'), findsOneWidget); }); @@ -223,10 +223,10 @@ void main() { await tester.pumpWidget(createMealItemFormScreen(meal1, '123', true)); await tester.enterText(find.byKey(const Key('field-weight')), '2'); - await tester.pumpAndSettle(); + await tester.pump(); await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); - await tester.pumpAndSettle(); + await tester.pump(); expect(find.text('Please enter a valid number'), findsNothing); }); @@ -234,10 +234,10 @@ void main() { await tester.pumpWidget(createMealItemFormScreen(meal1, '123', true)); await tester.enterText(find.byKey(const Key('field-weight')), 'test'); - await tester.pumpAndSettle(); + await tester.pump(); await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); - await tester.pumpAndSettle(); + await tester.pump(); expect(find.text('Please enter a valid number'), findsOneWidget); }); @@ -280,7 +280,7 @@ void main() { await tester.pumpWidget(createMealItemFormScreen(meal1, '123', true)); await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); - await tester.pumpAndSettle(); + await tester.pump(); expect(find.text('Please select an ingredient'), findsOneWidget); expect(find.text('Please enter a value'), findsOneWidget); @@ -300,7 +300,7 @@ void main() { await tester.pumpAndSettle(); await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); - await tester.pumpAndSettle(); + await tester.pump(); expect(find.text('Please enter a value'), findsOneWidget); }); @@ -335,7 +335,7 @@ void main() { expect(find.byKey(const Key('ingredient-scan-result-dialog')), findsNothing); await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); - await tester.pumpAndSettle(); + await tester.pump(); expect(formState.mealItem.amount, 2); diff --git a/test/routine/day_form_test.dart b/test/routine/day_form_test.dart index 7f33b7e0e..351b1893a 100644 --- a/test/routine/day_form_test.dart +++ b/test/routine/day_form_test.dart @@ -58,7 +58,7 @@ void main() { await tester.pumpWidget(renderWidget()); await tester.pumpAndSettle(); await tester.tap(find.byKey(const Key('field-is-rest-day'))); - await tester.pumpAndSettle(); + await tester.pump(); final nameField = find.byKey(const Key('field-name')); final TextFormField nameTextField = tester.widget(nameField); diff --git a/test/routine/forms/slot_form_test.dart b/test/routine/forms/slot_form_test.dart index 14f02052e..dbdfcdf56 100644 --- a/test/routine/forms/slot_form_test.dart +++ b/test/routine/forms/slot_form_test.dart @@ -278,7 +278,7 @@ void main() { await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.content_copy)); - await tester.pumpAndSettle(); + await tester.pump(); verify( mockProvider.addSlot( @@ -314,7 +314,7 @@ void main() { await tester.pumpAndSettle(); await tester.tap(find.byIcon(Icons.content_copy).first); - await tester.pumpAndSettle(); + await tester.pump(); // slot2 must be shifted to order 3 to make room for the new slot at order 2 verify( diff --git a/test/widgets/routines/gym_mode/gym_mode_options_test.dart b/test/widgets/routines/gym_mode/gym_mode_options_test.dart index cd7ea51f2..45de755bb 100644 --- a/test/widgets/routines/gym_mode/gym_mode_options_test.dart +++ b/test/widgets/routines/gym_mode/gym_mode_options_test.dart @@ -92,19 +92,19 @@ void main() { final notifySwitch = find.byKey(const ValueKey('gym-mode-notify-countdown')); expect(notifySwitch, findsOneWidget); await tester.tap(notifySwitch); - await tester.pumpAndSettle(); + await tester.pump(); // Now toggle show exercises final showExercisesSwitch = find.byKey(const ValueKey('gym-mode-option-show-exercises')); expect(showExercisesSwitch, findsOneWidget); await tester.tap(showExercisesSwitch); - await tester.pumpAndSettle(); + await tester.pump(); // Toggle show timer (this will disable notify switch) final showTimerSwitch = find.byKey(const ValueKey('gym-mode-option-show-timer')); expect(showTimerSwitch, findsOneWidget); await tester.tap(showTimerSwitch); - await tester.pumpAndSettle(); + await tester.pump(); final notifier = container.read(gymStateProvider.notifier); expect(notifier.state.showExercisePages, isFalse); @@ -156,7 +156,7 @@ void main() { expect(textField, findsOneWidget); await tester.enterText(textField, '60'); - await tester.pumpAndSettle(); + await tester.pump(); expect(notifier.state.countdownDuration.inSeconds, 60); @@ -164,7 +164,7 @@ void main() { final refreshIcon = find.descendant(of: countdownField, matching: find.byIcon(Icons.refresh)); expect(refreshIcon, findsOneWidget); await tester.tap(refreshIcon); - await tester.pumpAndSettle(); + await tester.pump(); expect(notifier.state.countdownDuration.inSeconds, DEFAULT_COUNTDOWN_DURATION); }); diff --git a/test/widgets/routines/gym_mode/log_page_test.dart b/test/widgets/routines/gym_mode/log_page_test.dart index cda242608..594603941 100644 --- a/test/widgets/routines/gym_mode/log_page_test.dart +++ b/test/widgets/routines/gym_mode/log_page_test.dart @@ -211,7 +211,7 @@ void main() { await tester.enterText(editableFields.at(0), '12'); // Reps await tester.enterText(editableFields.at(1), '34'); // Weight - await tester.pumpAndSettle(); + await tester.pump(); Log? capturedLog; when(mockRoutines.addLog(any)).thenAnswer((invocation) async { diff --git a/test/widgets/routines/plate_calculator_test.dart b/test/widgets/routines/plate_calculator_test.dart index 718337495..5e334103b 100644 --- a/test/widgets/routines/plate_calculator_test.dart +++ b/test/widgets/routines/plate_calculator_test.dart @@ -83,13 +83,13 @@ void main() { // Correctly toggles the useColors switch expect(notifier.state.useColors, isFalse); await tester.tap(find.byKey(const ValueKey('useColorsSwitch'))); - await tester.pumpAndSettle(); + await tester.pump(); expect(notifier.state.useColors, isTrue); // Correctly adds and removes plates expect(notifier.state.selectedPlates.contains(5.0), isTrue); await tester.tap(find.byKey(const ValueKey('plateWeight-5'))); - await tester.pumpAndSettle(); + await tester.pump(); expect(notifier.state.selectedPlates.contains(5.0), isFalse); }, );