From 7493de56e8677b0f84a26e66158fec1cf4942c93 Mon Sep 17 00:00:00 2001 From: Shaik Azad <120930148+Azad99-9@users.noreply.github.com> Date: Mon, 22 Jan 2024 15:41:19 +0530 Subject: [PATCH] Made test warnings fatal (#2332) * made test warnings fatal * chore: fixed run_check_ignore * resolved requested changes * chore: dart format --- .../events/explore_event_dialogue.dart | 220 +++++------ lib/views/pre_auth_screens/set_url.dart | 342 +++++++++--------- .../pre_auth_screens/signup_details.dart | 6 +- test/flutter_test_config.dart | 8 + .../add_post_page_test.dart | 3 +- .../events/explore_event_dialogue_test.dart | 79 ++-- .../pre_auth_screens/set_url_page_test.dart | 8 +- .../pre_auth_screens/signup_details_test.dart | 3 + 8 files changed, 342 insertions(+), 327 deletions(-) create mode 100644 test/flutter_test_config.dart diff --git a/lib/views/after_auth_screens/events/explore_event_dialogue.dart b/lib/views/after_auth_screens/events/explore_event_dialogue.dart index 046314d38..4155a6762 100644 --- a/lib/views/after_auth_screens/events/explore_event_dialogue.dart +++ b/lib/views/after_auth_screens/events/explore_event_dialogue.dart @@ -1,6 +1,3 @@ -// ignore_for_file: talawa_api_doc -// ignore_for_file: talawa_good_doc_comments - import 'package:flutter/material.dart'; import 'package:talawa/locator.dart'; import 'package:talawa/services/size_config.dart'; @@ -22,26 +19,24 @@ class _ExploreEventDialogState extends State { @override Widget build(BuildContext context) { return AlertDialog( - insetPadding: EdgeInsets.all( - SizeConfig.screenWidth! * 0.027, + insetPadding: EdgeInsets.symmetric( + horizontal: SizeConfig.screenWidth! * 0.15, ), - actions: [ - Padding( - padding: const EdgeInsets.all(26), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, + content: SizedBox( + height: SizeConfig.screenHeight! * 0.33, + // width: SizeConfig.screenWidth! * 0.3, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 6), + child: Column( children: [ - Text( - AppLocalizations.of(context)!.strictTranslate('Start Date'), - ), - const SizedBox( - height: 5, - ), - GestureDetector( + datePicker( + context, key: const Key('StartDateSelector'), + title: 'Start Date', + date: _startDate, onTap: () async { final date = await customDatePicker(initialDate: _startDate); @@ -49,47 +44,12 @@ class _ExploreEventDialogState extends State { _startDate = date; }); }, - child: SizedBox( - // SizedBox is a box with a specified size. - height: SizeConfig.screenHeight! * 0.07, - width: SizeConfig.screenWidth! * 0.36, - child: Card( - color: Theme.of(context).colorScheme.primaryContainer, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - const Padding( - padding: EdgeInsets.symmetric(horizontal: 10), - child: Icon( - Icons.calendar_today, - size: 19, - ), - ), - Expanded( - // shows the start date of the event - child: Text( - "${_startDate.toLocal()}".split(' ')[0], - maxLines: 1, - ), - ), - ], - ), - ), - ), - ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - AppLocalizations.of(context)!.strictTranslate('End Date'), ), - const SizedBox( - height: 5, - ), - GestureDetector( + datePicker( + context, key: const Key('EndDateSelector'), + title: 'End Date', + date: _endDate, onTap: () async { final date = await customDatePicker(initialDate: _endDate); @@ -97,78 +57,98 @@ class _ExploreEventDialogState extends State { _endDate = date; }); }, - child: SizedBox( - height: SizeConfig.screenHeight! * 0.07, - width: SizeConfig.screenWidth! * 0.36, - child: Card( - color: Theme.of(context).colorScheme.primaryContainer, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - const Padding( - padding: EdgeInsets.symmetric(horizontal: 10), - child: Icon( - Icons.calendar_today, - size: 20, - ), - ), - Expanded( - // shows the end date of the event - child: Text( - "${_endDate.toLocal()}".split(' ')[0], - maxLines: 1, - ), - ), - ], - ), - ), - ), ), ], ), - ], - ), - ), - Padding( - padding: EdgeInsets.only( - right: SizeConfig.screenWidth! * 0.072, - ), - child: SizedBox( - width: SizeConfig.screenWidth! * 0.36, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, children: [ - Expanded( - // returns a button to cancel the event dialog - child: TextButton( - key: const Key('CancelButton'), - onPressed: () { - navigationService.pop(); - }, - child: Text( - AppLocalizations.of(context)!.strictTranslate('Cancel'), - style: Theme.of(context).textTheme.bodyMedium, - ), + TextButton( + key: const Key('CancelButton'), + onPressed: () { + navigationService.pop(); + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate('Cancel'), + style: Theme.of(context).textTheme.bodyMedium, ), ), - Expanded( - // returns a button to mark the event dialog as done. - child: TextButton( - key: const Key('DoneButton'), - onPressed: () { - navigationService.pop(); - }, - child: Text( - AppLocalizations.of(context)!.strictTranslate('Done'), - style: const TextStyle( - fontSize: 14, - color: Color(0xff4285F4), - ), + TextButton( + key: const Key('DoneButton'), + onPressed: () { + navigationService.pop(); + }, + child: Text( + AppLocalizations.of(context)!.strictTranslate('Done'), + style: const TextStyle( + fontSize: 14, + color: Color(0xff4285F4), ), ), ), ], ), + ], + ), + ), + ); + } + + /// Creates a column with a date picker. + /// + /// **params**: + /// * `context`: A `BuildContext` representing the build context. + /// * `title`: A `String` representing the title of the date picker. + /// * `onTap`: A `void Function()` callback triggered when the date picker is tapped. + /// * `date`: A `DateTime` representing the selected date for the date picker. + /// * `key`: A `Key` to identify and differentiate the date picker widget. + /// + /// **returns**: + /// * `Column`: Returns a `Column` widget containing the date picker elements. + Column datePicker( + BuildContext context, { + required String title, + required void Function()? onTap, + required DateTime date, + required Key key, + }) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + AppLocalizations.of(context)!.strictTranslate(title), + ), + const SizedBox( + height: 5, + ), + GestureDetector( + key: key, + onTap: onTap, + child: SizedBox( + height: SizeConfig.screenHeight! * 0.08, + child: Card( + color: Theme.of(context).colorScheme.primaryContainer, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + const Padding( + padding: EdgeInsets.symmetric(horizontal: 10), + child: Icon( + Icons.calendar_today, + size: 20, + ), + ), + Expanded( + // shows the end date of the event + child: Text( + "${date.toLocal()}".split(' ')[0], + // maxLines: 1, + ), + ), + ], + ), + ), ), ), ], diff --git a/lib/views/pre_auth_screens/set_url.dart b/lib/views/pre_auth_screens/set_url.dart index 5886b7832..a223c519c 100644 --- a/lib/views/pre_auth_screens/set_url.dart +++ b/lib/views/pre_auth_screens/set_url.dart @@ -37,189 +37,193 @@ class _SetUrlState extends State { return Scaffold( key: const Key('SetUrlScreenScaffold'), backgroundColor: Theme.of(context).scaffoldBackgroundColor, - body: Container( - margin: EdgeInsets.fromLTRB( - SizeConfig.screenWidth! * 0.06, - SizeConfig.safeBlockVertical! * 4, - SizeConfig.screenWidth! * 0.06, - 0.0, - ), - width: SizeConfig.screenWidth, - height: SizeConfig.screenHeight, - alignment: Alignment.center, - child: SingleChildScrollView( - child: Form( - key: model.formKey, - autovalidateMode: model.validate, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - alignment: Alignment.centerRight, - margin: EdgeInsets.only( - top: SizeConfig.safeBlockVertical! * 2, - ), - // QR code scanner for joining the organization. - child: IconButton( - icon: const Icon( - Icons.qr_code_scanner, - size: 30, - semanticLabel: 'Join Organisation with QR', + body: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + margin: EdgeInsets.fromLTRB( + SizeConfig.screenWidth! * 0.06, + SizeConfig.safeBlockVertical! * 4, + SizeConfig.screenWidth! * 0.06, + 0.0, + ), + width: SizeConfig.screenWidth, + height: SizeConfig.screenHeight, + alignment: Alignment.center, + child: SingleChildScrollView( + child: Form( + key: model.formKey, + autovalidateMode: model.validate, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + alignment: Alignment.centerRight, + margin: EdgeInsets.only( + top: SizeConfig.safeBlockVertical! * 2, + ), + // QR code scanner for joining the organization. + child: IconButton( + icon: const Icon( + Icons.qr_code_scanner, + size: 30, + semanticLabel: 'Join Organisation with QR', + ), + onPressed: () => model.scanQR(context), + // model.scanQR(context), ), - onPressed: () => model.scanQR(context), - // model.scanQR(context), - ), - ), - Padding( - padding: EdgeInsets.only( - top: SizeConfig.screenHeight! * 0.08, ), - child: CustomPaint( - key: const Key('LogoPainter'), - size: Size( - SizeConfig.screenWidth! * 0.6, - SizeConfig.screenWidth! * 0.6, + Padding( + padding: EdgeInsets.only( + top: SizeConfig.screenHeight! * 0.08, ), - painter: AppLogo(), + child: CustomPaint( + key: const Key('LogoPainter'), + size: Size( + SizeConfig.screenWidth! * 0.6, + SizeConfig.screenWidth! * 0.6, + ), + painter: AppLogo(), + ), + ), + CustomRichText( + key: const Key('UrlPageText'), + words: model.greeting, ), - ), - CustomRichText( - key: const Key('UrlPageText'), - words: model.greeting, - ), - //Form input for entering the organization URL - TextFormField( - key: const Key('UrlInputField'), - controller: model.url, - focusNode: model.urlFocus, - textInputAction: TextInputAction.done, - keyboardType: TextInputType.text, - enableSuggestions: true, - validator: (value) { - final String? msg = Validator.validateURL(value!); - if (msg == null) { - return null; - } + //Form input for entering the organization URL + TextFormField( + key: const Key('UrlInputField'), + controller: model.url, + focusNode: model.urlFocus, + textInputAction: TextInputAction.done, + keyboardType: TextInputType.text, + enableSuggestions: true, + validator: (value) { + final String? msg = Validator.validateURL(value!); + if (msg == null) { + return null; + } - return AppLocalizations.of(context)!.translate(msg); - }, - onFieldSubmitted: (value) => AppLocalizations.of(context)! - .translate(Validator.validateURL(value)), - decoration: InputDecoration( - labelText: - '${AppLocalizations.of(context)!.translate("Enter Community URL")} *', - labelStyle: Theme.of(context).textTheme.titleMedium, - suffixIcon: InkWell( - key: const Key('VerifyButton'), - onTap: () async { - model.urlFocus.unfocus(); - model.validate = AutovalidateMode.always; - model.formKey.currentState!.validate(); + return AppLocalizations.of(context)!.translate(msg); + }, + onFieldSubmitted: (value) => + AppLocalizations.of(context)! + .translate(Validator.validateURL(value)), + decoration: InputDecoration( + labelText: + '${AppLocalizations.of(context)!.translate("Enter Community URL")} *', + labelStyle: Theme.of(context).textTheme.titleMedium, + suffixIcon: InkWell( + key: const Key('VerifyButton'), + onTap: () async { + model.urlFocus.unfocus(); + model.validate = AutovalidateMode.always; + model.formKey.currentState!.validate(); - /// Checking url. If valid, than show the pop-up - await model.checkURLandShowPopUp(''); - }, - child: Container( - height: 48, - width: 48, - alignment: Alignment.center, - child: Text( - AppLocalizations.of(context)! - .strictTranslate("Verify"), - style: Theme.of(context).textTheme.bodyLarge, - textAlign: TextAlign.center, + /// Checking url. If valid, than show the pop-up + await model.checkURLandShowPopUp(''); + }, + child: Container( + height: 48, + width: 48, + alignment: Alignment.center, + child: Text( + AppLocalizations.of(context)! + .strictTranslate("Verify"), + style: Theme.of(context).textTheme.bodyLarge, + textAlign: TextAlign.center, + ), ), ), ), ), - ), - SizedBox( - height: SizeConfig.screenHeight! * 0.086, - ), - //Login button. - RaisedRoundedButton( - key: const Key('LoginButton'), - buttonLabel: AppLocalizations.of(context)! - .strictTranslate('Login'), - onTap: () async { - /// Checking url. If valid, than navigating to login route - await model.checkURLandNavigate('/login', ''); - }, - showArrow: true, - textColor: Theme.of(context) - .inputDecorationTheme - .focusedBorder! - .borderSide - .color, - backgroundColor: - Theme.of(context).colorScheme.secondaryContainer, - ), - SizedBox( - height: SizeConfig.screenHeight! * 0.0215, - ), - //Sign up button. - RaisedRoundedButton( - key: const Key('SignUpButton'), - buttonLabel: AppLocalizations.of(context)! - .strictTranslate('Sign Up'), - onTap: () => model.checkURLandNavigate( - '/selectOrg', - model.orgId, + SizedBox( + height: SizeConfig.screenHeight! * 0.086, ), - showArrow: true, - textColor: - Theme.of(context).colorScheme.secondaryContainer, - backgroundColor: Theme.of(context) - .inputDecorationTheme - .focusedBorder! - .borderSide - .color, - ), - SizedBox( - height: SizeConfig.screenHeight! * 0.06, - ), - //Gesture Detector which navigates to a different screen for changing the language. - GestureDetector( - key: const Key('ChangeLanguage'), - onTap: () { - navigationService.pop(); - }, - child: Padding( - padding: EdgeInsets.only( - bottom: SizeConfig.safeBlockVertical! * 2, + //Login button. + RaisedRoundedButton( + key: const Key('LoginButton'), + buttonLabel: AppLocalizations.of(context)! + .strictTranslate('Login'), + onTap: () async { + /// Checking url. If valid, than navigating to login route + await model.checkURLandNavigate('/login', ''); + }, + showArrow: true, + textColor: Theme.of(context) + .inputDecorationTheme + .focusedBorder! + .borderSide + .color, + backgroundColor: + Theme.of(context).colorScheme.secondaryContainer, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.0215, + ), + //Sign up button. + RaisedRoundedButton( + key: const Key('SignUpButton'), + buttonLabel: AppLocalizations.of(context)! + .strictTranslate('Sign Up'), + onTap: () => model.checkURLandNavigate( + '/selectOrg', + model.orgId, ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - CustomPaint( - size: Size( - SizeConfig.screenWidth! * 0.125, - SizeConfig.screenWidth! * 0.125 * 0.5, - ), //You can Replace [WIDTH] with your desired width for Custom Paint and height will be calculated automatically - painter: LanguageIcon(), - ), - const SizedBox( - width: 10, - ), - Text( - AppLocalizations.of(context)! - .strictTranslate('Change language'), - style: Theme.of(context) - .textTheme - .titleLarge! - .copyWith( - color: Theme.of(context) - .colorScheme - .onBackground - .withOpacity(0.8), - ), - ), - ], + showArrow: true, + textColor: + Theme.of(context).colorScheme.secondaryContainer, + backgroundColor: Theme.of(context) + .inputDecorationTheme + .focusedBorder! + .borderSide + .color, + ), + SizedBox( + height: SizeConfig.screenHeight! * 0.06, + ), + //Gesture Detector which navigates to a different screen for changing the language. + GestureDetector( + key: const Key('ChangeLanguage'), + onTap: () { + navigationService.pop(); + }, + child: Padding( + padding: EdgeInsets.only( + bottom: SizeConfig.safeBlockVertical! * 2, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CustomPaint( + size: Size( + SizeConfig.screenWidth! * 0.125, + SizeConfig.screenWidth! * 0.125 * 0.5, + ), + painter: LanguageIcon(), + ), + const SizedBox( + width: 10, + ), + Text( + AppLocalizations.of(context)! + .strictTranslate('Change language'), + style: Theme.of(context) + .textTheme + .titleLarge! + .copyWith( + color: Theme.of(context) + .colorScheme + .onBackground + .withOpacity(0.8), + ), + ), + ], + ), ), ), - ), - ], + ], + ), ), ), ), diff --git a/lib/views/pre_auth_screens/signup_details.dart b/lib/views/pre_auth_screens/signup_details.dart index 251185c04..06a39bb5c 100644 --- a/lib/views/pre_auth_screens/signup_details.dart +++ b/lib/views/pre_auth_screens/signup_details.dart @@ -1,6 +1,3 @@ -// ignore_for_file: talawa_api_doc -// ignore_for_file: talawa_good_doc_comments - import 'package:flutter/material.dart'; import 'package:talawa/locator.dart'; import 'package:talawa/models/organization/org_info.dart'; @@ -17,6 +14,8 @@ import 'package:talawa/widgets/signup_progress_indicator.dart'; class SignUpDetails extends StatefulWidget { const SignUpDetails({required Key key, required this.selectedOrg}) : super(key: key); + + /// Details of selected Organisation. final OrgInfo selectedOrg; @override _SignUpDetailsState createState() => _SignUpDetailsState(); @@ -48,6 +47,7 @@ class _SignUpDetailsState extends State { body: Padding( padding: EdgeInsets.only(top: SizeConfig.safeBlockVertical! * 6), child: SingleChildScrollView( + scrollDirection: Axis.vertical, child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ diff --git a/test/flutter_test_config.dart b/test/flutter_test_config.dart new file mode 100644 index 000000000..a63fb510e --- /dev/null +++ b/test/flutter_test_config.dart @@ -0,0 +1,8 @@ +import 'dart:async'; + +import 'package:flutter_test/flutter_test.dart'; + +Future testExecutable(FutureOr Function() testMain) async { + WidgetController.hitTestWarningShouldBeFatal = true; + await testMain(); +} diff --git a/test/views/after_auth_screens/add_post_page_test.dart b/test/views/after_auth_screens/add_post_page_test.dart index 249c696f3..4f42e79f6 100644 --- a/test/views/after_auth_screens/add_post_page_test.dart +++ b/test/views/after_auth_screens/add_post_page_test.dart @@ -325,7 +325,8 @@ void main() { await tester.tap(finder); await tester.pumpAndSettle(); - await tester.tap(cancelBtn); + final offSet = tester.getCenter(cancelBtn); + await tester.tapAt(offSet); await tester.pump(); }); }); diff --git a/test/widget_tests/after_auth_screens/events/explore_event_dialogue_test.dart b/test/widget_tests/after_auth_screens/events/explore_event_dialogue_test.dart index 804c168d1..c286ff262 100644 --- a/test/widget_tests/after_auth_screens/events/explore_event_dialogue_test.dart +++ b/test/widget_tests/after_auth_screens/events/explore_event_dialogue_test.dart @@ -64,8 +64,13 @@ void main() { await tester.tap(find.byKey(const Key('TextButtonKey'))); final date = customDatePicker(initialDate: startDate); + await tester.pumpAndSettle(); + + final okButton = find.text('OK'); + await tester.tap(okButton); await tester.pumpAndSettle(); + expect(find.text(startDate.toString().split(' ')[0]), findsOneWidget); await tester.ensureVisible(find.byKey(const Key('StartDateSelector'))); await tester.tap(find.byKey(const Key('StartDateSelector'))); @@ -96,9 +101,8 @@ void main() { }); testWidgets('Testing the Cancel button', (tester) async { await prepareDatePicker(tester, (date) async { - final cancelBtnFinder = find.byKey(const ValueKey('CancelButton')); + final cancelBtnFinder = find.text('Cancel').last; expect(cancelBtnFinder, findsOneWidget); - await tester.ensureVisible(cancelBtnFinder); await tester.tap(cancelBtnFinder); await tester.pumpAndSettle(); expect( @@ -111,11 +115,19 @@ void main() { }); testWidgets('Changing Date test', (tester) async { - await prepareDatePicker(tester, (date) async { + await prepareDatePicker(tester, (val) async { + expect(find.text('OK'), findsOneWidget); + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(); + + final date = customDatePicker(initialDate: startDate); + await tester.pumpAndSettle(); + await tester.tap(find.text('10')); await tester.pumpAndSettle(const Duration(seconds: 1)); await tester.tap(find.text('OK')); await tester.pumpAndSettle(const Duration(seconds: 1)); + expect( (await date).toString().split(' ')[0], DateTime(DateTime.now().year, DateTime.now().month, 10) @@ -137,6 +149,37 @@ void main() { group('Tests for Explore Event Dialogue', () { locator.registerSingleton(SizeConfig()); + testWidgets('Tap on StartDateSelector', (tester) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('TextButtonKey'))); + await tester.pump(); + + await tester.tap(find.byKey(const Key('StartDateSelector'))); + await tester.pump(); + + expect(find.byType(DatePickerDialog), findsOneWidget); + + await tester.tap(find.text('16')); + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(); + }); + testWidgets('Tap on EndDateSelector', (tester) async { + await tester.pumpWidget(createExploreEventDialog()); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('TextButtonKey'))); + await tester.pump(); + + await tester.tap(find.byKey(const Key('EndDateSelector'))); + await tester.pump(); + + expect(find.byType(DatePickerDialog), findsOneWidget); + + await tester.tap(find.text('16')); + await tester.tap(find.text('OK')); + await tester.pump(); + }); + testWidgets('Testing Explore Event dialog layout', (tester) async { await tester.pumpWidget(createExploreEventDialog()); await tester.pumpAndSettle(); @@ -230,35 +273,5 @@ void main() { await tester.tap(x); expect(find.byKey(const Key('TextButtonKey')), findsOneWidget); }); - testWidgets('Tap on StartDateSelector', (tester) async { - await tester.pumpWidget(createExploreEventDialog()); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(const Key('TextButtonKey'))); - await tester.pump(); - - await tester.tap(find.byKey(const Key('StartDateSelector'))); - await tester.pump(); - - expect(find.byType(CalendarDatePicker), findsOneWidget); - - await tester.tap(find.text('16')); - await tester.tap(find.text('OK')); - await tester.pumpAndSettle(); - }); - testWidgets('Tap on EndDateSelector', (tester) async { - await tester.pumpWidget(createExploreEventDialog()); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(const Key('TextButtonKey'))); - await tester.pump(); - - await tester.tap(find.byKey(const Key('EndDateSelector'))); - await tester.pump(); - - expect(find.byType(CalendarDatePicker), findsOneWidget); - - await tester.tap(find.text('16')); - await tester.tap(find.text('OK')); - await tester.pump(); - }); }); } diff --git a/test/widget_tests/pre_auth_screens/set_url_page_test.dart b/test/widget_tests/pre_auth_screens/set_url_page_test.dart index a5bbf3e66..65db66041 100644 --- a/test/widget_tests/pre_auth_screens/set_url_page_test.dart +++ b/test/widget_tests/pre_auth_screens/set_url_page_test.dart @@ -308,6 +308,7 @@ Future main() async { .buttonLabel, 'Login', ); + await tester.ensureVisible(loginButtonWidget); await tester.tap(loginButtonWidget); await tester.pumpAndSettle(); }); @@ -322,7 +323,10 @@ Future main() async { find.byKey(const Key('UrlInputField')), 'https:///graphql', ); - await tester.tap(find.byKey(const Key('LoginButton'))); + + final finder = find.byKey(const Key('LoginButton')); + await tester.ensureVisible(finder); + await tester.tap(finder); await tester.pumpAndSettle(); expect(find.byKey(const Key('UrlPageText')), findsOneWidget); }); @@ -641,6 +645,8 @@ Future main() async { .buttonLabel, 'Login', ); + + await tester.ensureVisible(loginButtonWidget); await tester.tap(loginButtonWidget); await tester.pumpAndSettle(); }); diff --git a/test/widget_tests/pre_auth_screens/signup_details_test.dart b/test/widget_tests/pre_auth_screens/signup_details_test.dart index 6bbdfede4..032b4af28 100644 --- a/test/widget_tests/pre_auth_screens/signup_details_test.dart +++ b/test/widget_tests/pre_auth_screens/signup_details_test.dart @@ -231,6 +231,7 @@ void main() { //inputting a invalid password text in the field await tester.enterText(passwordInputFieldWidget, 'test'); //submitting the field with invalid password input + await tester.ensureVisible(findSignUpButton); await tester.tap(findSignUpButton); await tester.pumpAndSettle(const Duration(milliseconds: 500)); //testing the invalidPasswordSubmission widget appears @@ -239,6 +240,7 @@ void main() { //without inputting text in the field await tester.enterText(passwordInputFieldWidget, ''); //submitting the field without input + await tester.ensureVisible(findSignUpButton); await tester.tap(findSignUpButton); await tester.pumpAndSettle(const Duration(milliseconds: 500)); //testing the nullPasswordSubmission widget appears @@ -247,6 +249,7 @@ void main() { //inputting a password with spaces in the field await tester.enterText(passwordInputFieldWidget, 'testing spaces'); //submitting the field with spaces input + await tester.ensureVisible(findSignUpButton); await tester.tap(findSignUpButton); await tester.pumpAndSettle(const Duration(milliseconds: 500)); //testing the spacePasswordSubmission widget appears