mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-30 17:52:35 +01:00
Replace pumpAndSettle with pump where possible
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -120,11 +120,11 @@ void main() {
|
||||
expect(tester.widget<SwitchListTile>(vegetarianSwitchFinder).value, isFalse);
|
||||
|
||||
await tester.tap(veganSwitchFinder);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.pump();
|
||||
expect(tester.widget<SwitchListTile>(veganSwitchFinder).value, isTrue);
|
||||
|
||||
await tester.tap(vegetarianSwitchFinder);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.pump();
|
||||
expect(tester.widget<SwitchListTile>(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<Slider>(sliderFinder);
|
||||
slider.onChanged!(1.0);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.pump();
|
||||
|
||||
await tester.tap(find.text('Close'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user