From ce073b5a9560533179c44bbb98c03a6db0d6e39a Mon Sep 17 00:00:00 2001 From: misha Date: Wed, 18 Nov 2026 16:55:36 +0300 Subject: [PATCH] fix: tests fix --- test/core/widgets/custom_popup_test.dart | 9 ++++++ .../chat_consultation_header_test.dart | 31 ++++++++++-------- .../consultation_progress_plank_test.dart | 24 +++++++------- .../personal_diet_status_chip_test.dart | 32 +++++++++---------- .../widgets/promo_code_modal_test.dart | 7 ++++ .../widgets/sbp_banks_bottom_sheet_test.dart | 1 + .../widgets/sbp_qr_bottom_sheet_test.dart | 1 + .../widgets/video_call_name_label_test.dart | 2 ++ 8 files changed, 64 insertions(+), 43 deletions(-) diff --git a/test/core/widgets/custom_popup_test.dart b/test/core/widgets/custom_popup_test.dart index 18506e8d..5044255d 100644 --- a/test/core/widgets/custom_popup_test.dart +++ b/test/core/widgets/custom_popup_test.dart @@ -86,6 +86,7 @@ void main() { ), ); + await tester.pump(); await tester.tap(find.byIcon(Icons.more_horiz_rounded)); await tester.pumpAndSettle(); @@ -108,6 +109,7 @@ void main() { ), ); + await tester.pump(); await tester.tap(find.byIcon(Icons.more_horiz_rounded)); await tester.pumpAndSettle(); @@ -131,6 +133,7 @@ void main() { ), ); + await tester.pump(); await tester.tap(find.byIcon(Icons.more_horiz_rounded)); await tester.pumpAndSettle(); @@ -153,6 +156,7 @@ void main() { ), ); + await tester.pump(); await tester.tap(find.byIcon(Icons.more_horiz_rounded)); await tester.pumpAndSettle(); @@ -175,6 +179,7 @@ void main() { ), ); + await tester.pump(); await tester.tap(find.byIcon(Icons.more_horiz_rounded)); await tester.pumpAndSettle(); @@ -196,6 +201,7 @@ void main() { ), ); + await tester.pump(); await tester.tap(find.byIcon(Icons.more_horiz_rounded)); await tester.pumpAndSettle(); @@ -217,6 +223,7 @@ void main() { ), ); + await tester.pump(); await tester.tap(find.byIcon(Icons.more_horiz_rounded)); await tester.pumpAndSettle(); @@ -237,6 +244,7 @@ void main() { ), ); + await tester.pump(); await tester.tap(find.byIcon(Icons.more_horiz_rounded)); await tester.pumpAndSettle(); @@ -257,6 +265,7 @@ void main() { ), ); + await tester.pump(); await tester.tap(find.byIcon(Icons.more_horiz_rounded)); await tester.pumpAndSettle(); diff --git a/test/features/chat/presentation/widgets/chat_consultation_header_test.dart b/test/features/chat/presentation/widgets/chat_consultation_header_test.dart index e984ef15..e96d26eb 100644 --- a/test/features/chat/presentation/widgets/chat_consultation_header_test.dart +++ b/test/features/chat/presentation/widgets/chat_consultation_header_test.dart @@ -18,6 +18,11 @@ Widget _wrap(Widget child) { ); } +Future _pump(WidgetTester tester, Widget child) async { + await tester.pumpWidget(_wrap(child)); + await tester.pump(); +} + void main() { group('ChatConsultationHeader', () { testWidgets('вызывает onInfoTap по тапу на info', (tester) async { @@ -27,13 +32,12 @@ void main() { hasPersonalDiet: false, ); - await tester.pumpWidget( - _wrap( - ChatConsultationHeader( - progress: progress, - showInfoButton: true, - onInfoTap: () => tapped++, - ), + await _pump( + tester, + ChatConsultationHeader( + progress: progress, + showInfoButton: true, + onInfoTap: () => tapped++, ), ); @@ -54,13 +58,12 @@ void main() { expect(progress.showProgressPlank, isTrue); expect(progress.dietStatus, PersonalDietStatus.proposed); - await tester.pumpWidget( - _wrap( - ChatConsultationHeader( - progress: progress, - showInfoButton: false, - onInfoTap: () {}, - ), + await _pump( + tester, + ChatConsultationHeader( + progress: progress, + showInfoButton: false, + onInfoTap: () {}, ), ); diff --git a/test/features/consultations/presentation/widgets/consultation_progress_plank_test.dart b/test/features/consultations/presentation/widgets/consultation_progress_plank_test.dart index 364a1dc0..dc94ec4f 100644 --- a/test/features/consultations/presentation/widgets/consultation_progress_plank_test.dart +++ b/test/features/consultations/presentation/widgets/consultation_progress_plank_test.dart @@ -15,6 +15,11 @@ Widget _wrap(Widget child) { ); } +Future _pump(WidgetTester tester, Widget child) async { + await tester.pumpWidget(_wrap(child)); + await tester.pump(); +} + void main() { group('ConsultationProgressPlank', () { testWidgets('не строит шаги при showProgressPlank=false', (tester) async { @@ -24,9 +29,7 @@ void main() { ); expect(progress.showProgressPlank, isFalse); - await tester.pumpWidget( - _wrap(ConsultationProgressPlank(progress: progress)), - ); + await _pump(tester, ConsultationProgressPlank(progress: progress)); expect( find.descendant( @@ -48,9 +51,7 @@ void main() { ); expect(progress.showProgressPlank, isTrue); - await tester.pumpWidget( - _wrap(ConsultationProgressPlank(progress: progress)), - ); + await _pump(tester, ConsultationProgressPlank(progress: progress)); final s = S.of(tester.element(find.byType(ConsultationProgressPlank))); @@ -70,12 +71,11 @@ void main() { hasPersonalDiet: false, ); - await tester.pumpWidget( - _wrap( - SizedBox( - width: 360, - child: ConsultationProgressPlank(progress: progress), - ), + await _pump( + tester, + SizedBox( + width: 360, + child: ConsultationProgressPlank(progress: progress), ), ); diff --git a/test/features/consultations/presentation/widgets/personal_diet_status_chip_test.dart b/test/features/consultations/presentation/widgets/personal_diet_status_chip_test.dart index 50786729..73d5e99f 100644 --- a/test/features/consultations/presentation/widgets/personal_diet_status_chip_test.dart +++ b/test/features/consultations/presentation/widgets/personal_diet_status_chip_test.dart @@ -15,6 +15,11 @@ Widget _wrap(Widget child) { ); } +Future _pump(WidgetTester tester, Widget child) async { + await tester.pumpWidget(_wrap(child)); + await tester.pump(); +} + Widget _chip( ChosenPlanStateEnum state, { bool hasPersonalDiet = true, @@ -32,9 +37,7 @@ Widget _chip( void main() { group('PersonalDietStatusChip', () { testWidgets('notRequired + active ничего не показывает', (tester) async { - await tester.pumpWidget( - _wrap(_chip(ChosenPlanStateEnum.stateInited, hasPersonalDiet: false)), - ); + await _pump(tester, _chip(ChosenPlanStateEnum.stateInited, hasPersonalDiet: false)); expect( find.descendant( @@ -47,7 +50,7 @@ void main() { }); testWidgets('proposed показывает personal_diet_proposed', (tester) async { - await tester.pumpWidget(_wrap(_chip(ChosenPlanStateEnum.stateStarted))); + await _pump(tester, _chip(ChosenPlanStateEnum.stateStarted)); final s = S.of(tester.element(find.byType(PersonalDietStatusChip))); @@ -55,12 +58,11 @@ void main() { }); testWidgets('proposed с названием показывает имя диеты', (tester) async { - await tester.pumpWidget( - _wrap( - _chip( - ChosenPlanStateEnum.stateStarted, - personalDietName: 'Индивидуальный план питания', - ), + await _pump( + tester, + _chip( + ChosenPlanStateEnum.stateStarted, + personalDietName: 'Индивидуальный план питания', ), ); @@ -75,7 +77,7 @@ void main() { testWidgets('notProposed показывает personal_diet_not_proposed', ( tester, ) async { - await tester.pumpWidget(_wrap(_chip(ChosenPlanStateEnum.statePaid))); + await _pump(tester, _chip(ChosenPlanStateEnum.statePaid)); final s = S.of(tester.element(find.byType(PersonalDietStatusChip))); @@ -83,9 +85,7 @@ void main() { }); testWidgets('canceled показывает orderCanceled', (tester) async { - await tester.pumpWidget( - _wrap(_chip(ChosenPlanStateEnum.stateCanceledByTheInitiator)), - ); + await _pump(tester, _chip(ChosenPlanStateEnum.stateCanceledByTheInitiator)); final s = S.of(tester.element(find.byType(PersonalDietStatusChip))); @@ -93,9 +93,7 @@ void main() { }); testWidgets('paymentFailed показывает payment_failed', (tester) async { - await tester.pumpWidget( - _wrap(_chip(ChosenPlanStateEnum.statePaymentFailed)), - ); + await _pump(tester, _chip(ChosenPlanStateEnum.statePaymentFailed)); final s = S.of(tester.element(find.byType(PersonalDietStatusChip))); diff --git a/test/features/payment/presentation/widgets/promo_code_modal_test.dart b/test/features/payment/presentation/widgets/promo_code_modal_test.dart index 38199b8b..98293381 100644 --- a/test/features/payment/presentation/widgets/promo_code_modal_test.dart +++ b/test/features/payment/presentation/widgets/promo_code_modal_test.dart @@ -34,6 +34,7 @@ void main() { testWidgets('показывает заголовок Есть промокод? и кнопки Применить/Пропустить', (tester) async { await tester.pumpWidget(createTestWidget()); + await tester.pump(); await tester.tap(find.text('Open')); await tester.pumpAndSettle(); @@ -44,6 +45,7 @@ void main() { testWidgets('Применить с пустым полем показывает ошибку и не закрывает', (tester) async { await tester.pumpWidget(createTestWidget()); + await tester.pump(); await tester.tap(find.text('Open')); await tester.pumpAndSettle(); @@ -64,6 +66,7 @@ void main() { }, ), ); + await tester.pump(); await tester.tap(find.text('Open')); await tester.pumpAndSettle(); @@ -78,6 +81,7 @@ void main() { testWidgets('Пропустить закрывает шторку', (tester) async { await tester.pumpWidget(createTestWidget()); + await tester.pump(); await tester.tap(find.text('Open')); await tester.pumpAndSettle(); @@ -101,6 +105,7 @@ void main() { onRemove: () async => true, ), ); + await tester.pump(); await tester.tap(find.text('Open')); await tester.pumpAndSettle(); @@ -128,6 +133,7 @@ void main() { }, ), ); + await tester.pump(); await tester.tap(find.text('Open')); await tester.pumpAndSettle(); @@ -156,6 +162,7 @@ void main() { }, ), ); + await tester.pump(); await tester.tap(find.text('Open')); await tester.pumpAndSettle(); diff --git a/test/features/payment/presentation/widgets/sbp_banks_bottom_sheet_test.dart b/test/features/payment/presentation/widgets/sbp_banks_bottom_sheet_test.dart index 627105ac..2cd80ddd 100644 --- a/test/features/payment/presentation/widgets/sbp_banks_bottom_sheet_test.dart +++ b/test/features/payment/presentation/widgets/sbp_banks_bottom_sheet_test.dart @@ -98,6 +98,7 @@ void main() { await tester.pumpWidget(createTestWidget(planId: planId)); await tester.pump(); + await tester.pump(); expect(find.byType(Loader), findsOneWidget); expect(find.text('Сбербанк'), findsNothing); diff --git a/test/features/payment/presentation/widgets/sbp_qr_bottom_sheet_test.dart b/test/features/payment/presentation/widgets/sbp_qr_bottom_sheet_test.dart index 1d09ec3f..84136f03 100644 --- a/test/features/payment/presentation/widgets/sbp_qr_bottom_sheet_test.dart +++ b/test/features/payment/presentation/widgets/sbp_qr_bottom_sheet_test.dart @@ -106,6 +106,7 @@ void main() { Future openSheet(WidgetTester tester, {double? amount}) async { await pumpApp(tester, amount: amount); + await tester.pump(); await tester.tap(find.text('open')); await tester.pump(); await tester.pump(); diff --git a/test/features/video_calls/widgets/video_call_name_label_test.dart b/test/features/video_calls/widgets/video_call_name_label_test.dart index 8562ea52..ede13cc1 100644 --- a/test/features/video_calls/widgets/video_call_name_label_test.dart +++ b/test/features/video_calls/widgets/video_call_name_label_test.dart @@ -19,6 +19,7 @@ void main() { testWidgets('VideoCallParticipantNameLabel renders consultant role above name', (tester) async { await tester.pumpWidget( MaterialApp( + locale: const Locale('en'), localizationsDelegates: const [S.delegate, ...GlobalMaterialLocalizations.delegates], supportedLocales: S.delegate.supportedLocales, home: const Scaffold( @@ -26,6 +27,7 @@ void main() { ), ), ); + await tester.pump(); expect(find.text('Alex'), findsOneWidget); expect(find.text('Eatvio consultant'), findsOneWidget);