From 1d4113dbe9b5fdc3043a15dd73a34f27cf1c18fb Mon Sep 17 00:00:00 2001 From: Parag Gupta <103507835+Dante291@users.noreply.github.com> Date: Sun, 26 Nov 2023 22:55:19 +0530 Subject: [PATCH] Upgrading flutter to the latest stable version v3.16.0 (#2140) * Upgrading flutter to the latest stable version * fixing linting errors * fixing failing tests * fixing tests * fixing render overflow bug * fixing lint errors * fixing test * fixing test * fixing test * fixing edit event page test * fixing edit event page test * fixing edit event page test --- .github/workflows/pull-request.yml | 8 +- .github/workflows/push.yaml | 10 +- .../add_post_view_model.dart | 3 +- .../edit_profile_view_model.dart | 3 +- lib/widgets/pinned_post.dart | 2 +- pubspec.lock | 172 ++-- pubspec.yaml | 8 +- .../events/create_event_page_test.dart | 929 +++++++++--------- .../events/create_event_page_test.dart | 1 + .../events/edit_event_page_test.dart | 1 + .../events/explore_event_dialogue_test.dart | 6 +- .../change_password_page_test.dart | 2 + .../pre_auth_screens/login_test.dart | 2 + .../widgets/custom_list_tile_test.dart | 8 +- .../widgets/date_time_picker_test.dart | 6 +- .../widgets/lang_switch_test.dart | 2 +- 16 files changed, 592 insertions(+), 571 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index f409ec776..076958383 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -34,7 +34,7 @@ jobs: java-version: '12.0' - uses: subosito/flutter-action@v2 with: - flutter-version: '3.13.0' + flutter-version: '3.16.0' channel: 'stable' # or: 'beta', 'dev' or 'master' - name: Set default branch. run: git remote set-head origin --auto @@ -107,7 +107,7 @@ jobs: java-version: '12.0' - uses: subosito/flutter-action@v2 with: - flutter-version: '3.13.0' + flutter-version: '3.16.0' channel: 'stable' # or: 'beta', 'dev' or 'master' - name: Running pub get to fetch dependencies run: flutter pub get @@ -137,7 +137,7 @@ jobs: java-version: '12.0' - uses: subosito/flutter-action@v2 with: - flutter-version: '3.13.0' + flutter-version: '3.16.0' channel: 'stable' # or: 'beta', 'dev' or 'master' - name: Running pub get to fetch dependencies run: flutter pub get @@ -152,7 +152,7 @@ jobs: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: - flutter-version: '3.13.0' + flutter-version: '3.16.0' channel: 'stable' # or: 'beta', 'dev' or 'master' architecture: x64 - name: Building for ios diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 63a4898ae..4e1c64ab6 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -42,7 +42,7 @@ jobs: java-version: '12.0' - uses: subosito/flutter-action@v2 with: - flutter-version: '3.13.0' + flutter-version: '3.16.0' channel: 'stable' # or: 'beta', 'dev' or 'master' - name: Running pub get in talawa_lint run: cd talawa_lint && flutter pub get && cd .. @@ -84,7 +84,7 @@ jobs: java-version: '12.0' - uses: subosito/flutter-action@v2 with: - flutter-version: '3.13.0' + flutter-version: '3.16.0' channel: 'stable' - uses: dart-lang/setup-dart@v1 with: @@ -168,7 +168,7 @@ jobs: java-version: '12.0' - uses: subosito/flutter-action@v2 with: - flutter-version: '3.13.0' + flutter-version: '3.16.0' channel: 'stable' # or: 'beta', 'dev' or 'master' - name: Running pub get in talawa_lint run: cd talawa_lint && flutter pub get && cd .. @@ -198,7 +198,7 @@ jobs: java-version: '12.0' - uses: subosito/flutter-action@v2 with: - flutter-version: '3.13.0' + flutter-version: '3.16.0' channel: 'stable' # or: 'beta', 'dev' or 'master' - name: Running pub get in talawa_lint run: cd talawa_lint && flutter pub get && cd .. @@ -230,7 +230,7 @@ jobs: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: - flutter-version: '3.13.0' + flutter-version: '3.16.0' channel: 'stable' # or: 'beta', 'dev' or 'master' architecture: x64 - name: Building for ios diff --git a/lib/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart b/lib/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart index fb53e76a8..b0c696a29 100644 --- a/lib/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart +++ b/lib/view_model/after_auth_view_models/add_post_view_models/add_post_view_model.dart @@ -110,8 +110,7 @@ class AddPostViewModel extends BaseModel { Future convertToBase64(File file) async { try { final List bytes = await file.readAsBytes(); - String base64String = base64Encode(bytes); - base64String = base64String; + final String base64String = base64Encode(bytes); print(base64String); _imageInBase64 = base64String; return base64String; diff --git a/lib/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart b/lib/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart index aa2b9efa0..be1a52fdb 100644 --- a/lib/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart +++ b/lib/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart @@ -73,8 +73,7 @@ class EditProfilePageViewModel extends BaseModel { Future convertToBase64(File file) async { try { final List bytes = await file.readAsBytes(); - String base64String = base64Encode(bytes); - base64String = base64String; + final String base64String = base64Encode(bytes); print(base64String); imageFile = base64String as File?; return base64String; diff --git a/lib/widgets/pinned_post.dart b/lib/widgets/pinned_post.dart index c1bcab9d2..584305457 100644 --- a/lib/widgets/pinned_post.dart +++ b/lib/widgets/pinned_post.dart @@ -88,7 +88,7 @@ class PinnedPost extends StatelessWidget { return Container( child: pinnedPosts.isNotEmpty ? SizedBox( - height: SizeConfig.screenHeight! * 0.25, + height: SizeConfig.screenHeight! * 0.28, child: ListView.builder( itemCount: pinnedPosts.length, shrinkWrap: true, diff --git a/pubspec.lock b/pubspec.lock index 36fc275cb..76b24f5dc 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -93,10 +93,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.0.1" build_resolvers: dependency: transitive description: @@ -133,10 +133,10 @@ packages: dependency: transitive description: name: built_value - sha256: a8de5955205b4d1dbbbc267daddf2178bd737e4bab8987c04a500478c9651e74 + sha256: "69acb7007eb2a31dc901512bfe0f7b767168be34cb734835d54c070bfa74c1b2" url: "https://pub.dev" source: hosted - version: "8.6.3" + version: "8.8.0" cached_network_image: dependency: "direct main" description: @@ -205,10 +205,10 @@ packages: dependency: transitive description: name: code_builder - sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677" + sha256: b2151ce26a06171005b379ecff6e08d34c470180ffe16b8e14b6d52be292b55f url: "https://pub.dev" source: hosted - version: "4.7.0" + version: "4.8.0" collection: dependency: transitive description: @@ -261,10 +261,10 @@ packages: dependency: transitive description: name: cross_file - sha256: fd832b5384d0d6da4f6df60b854d33accaaeb63aa9e10e736a87381f08dee2cb + sha256: "2f9d2cbccb76127ba28528cb3ae2c2326a122446a83de5a056aaa3880d3882c5" url: "https://pub.dev" source: hosted - version: "0.3.3+5" + version: "0.3.3+7" crypto: dependency: "direct main" description: @@ -333,10 +333,10 @@ packages: dependency: transitive description: name: dbus - sha256: "6f07cba3f7b3448d42d015bfd3d53fe12e5b36da2423f23838efc1d5fb31a263" + sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" url: "https://pub.dev" source: hosted - version: "0.7.8" + version: "0.7.10" device_info_plus: dependency: transitive description: @@ -490,18 +490,18 @@ packages: dependency: transitive description: name: flutter_hooks - sha256: "6a126f703b89499818d73305e4ce1e3de33b4ae1c5512e3b8eab4b986f46774c" + sha256: "7c8db779c2d1010aa7f9ea3fbefe8f86524fcb87b69e8b0af31e1a4b55422dec" url: "https://pub.dev" source: hosted - version: "0.18.6" + version: "0.20.3" flutter_local_notifications: dependency: "direct main" description: name: flutter_local_notifications - sha256: "6d11ea777496061e583623aaf31923f93a9409ef8fcaeeefdd6cd78bf4fe5bb3" + sha256: bb5cd63ff7c91d6efe452e41d0d0ae6348925c82eafd10ce170ef585ea04776e url: "https://pub.dev" source: hosted - version: "16.1.0" + version: "16.2.0" flutter_local_notifications_linux: dependency: transitive description: @@ -527,18 +527,18 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: f185ac890306b5779ecbd611f52502d8d4d63d27703ef73161ca0407e815f02c + sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da url: "https://pub.dev" source: hosted - version: "2.0.16" + version: "2.0.17" flutter_reaction_button: dependency: "direct main" description: name: flutter_reaction_button - sha256: e9ecf6ee0be8c88cfd8c06a638680aa78a359ed0c0d44b63002d7b68bdddc793 + sha256: "9fe67f6e6dac65c5ee864c2ab03550b25e7fc82b9a800c885a87f85abe2c03c6" url: "https://pub.dev" source: hosted - version: "3.0.0+2" + version: "3.0.0+3" flutter_speed_dial: dependency: "direct main" description: @@ -609,10 +609,10 @@ packages: dependency: transitive description: name: geocoding_ios - sha256: c85495ce8fb34e4fbd2dd8fc5f79263d622d9f88c4af948c965daf6b27a7f3a1 + sha256: "8f79e380abb640ef4d88baee8bb65390058c802601158d0813dc990b36b189d2" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" geocoding_platform_interface: dependency: transitive description: @@ -649,10 +649,10 @@ packages: dependency: transitive description: name: geolocator_platform_interface - sha256: b7aca62aa05d7e610c396a53a1936ff87fce2f735d76e93fde9269c341c46a25 + sha256: "6c8d494d6948757c56720b778af742f6973f31fca1f702a7539b8917e4a2468a" url: "https://pub.dev" source: hosted - version: "4.1.1" + version: "4.2.0" geolocator_web: dependency: transitive description: @@ -665,10 +665,10 @@ packages: dependency: transitive description: name: geolocator_windows - sha256: "8725beaa00db2b52f53d9811584cb4488240b250b04a09763e80945017f65c9c" + sha256: a92fae29779d5c6dc60e8411302f5221ade464968fe80a36d330e80a71f087af url: "https://pub.dev" source: hosted - version: "0.2.1" + version: "0.2.2" get_it: dependency: "direct main" description: @@ -705,10 +705,10 @@ packages: dependency: transitive description: name: google_maps_flutter_android - sha256: e6cb018169e49332f88d23b1d2119b09e8ab4e7d3a1b889a1b7b3fd113e034ba + sha256: "4023e79184c762e63efe04da629d876085e0c296a7ca26745fb5750d4acd0aa2" url: "https://pub.dev" source: hosted - version: "2.5.1" + version: "2.5.3" google_maps_flutter_ios: dependency: transitive description: @@ -729,10 +729,10 @@ packages: dependency: transitive description: name: google_maps_flutter_web - sha256: "05067c5aa762ebee44b7ef4902a311ed8cf891ef655e2798bae063aa3050c8d9" + sha256: f893d1542c6562bc8299ef768fbbe92ade83c220ab3209b9477ec9f81ad585e4 url: "https://pub.dev" source: hosted - version: "0.5.4+1" + version: "0.5.4+2" googleapis: dependency: "direct main" description: @@ -745,50 +745,50 @@ packages: dependency: transitive description: name: gql - sha256: e5225e3be4d7eb4027406ab07cb68ad3a089deb3f7f6dc46edbdec78f2e5549f + sha256: aa3e0be4548353007b6e6fd24fcad0ce8c1179f9cb2ae5239d392fddb84a5ce5 url: "https://pub.dev" source: hosted - version: "1.0.1-alpha+1696717343881" + version: "1.0.1-alpha+1700868214564" gql_dedupe_link: dependency: transitive description: name: gql_dedupe_link - sha256: "79625bc8029755ce6b26483adf0255c6b6114acc56e7ef81469a99f1ce2296db" + sha256: e97e3f9490add43ba96cf5cc02d9d10a3723965c0bcc7bb1e04ef4f2e7a31a00 url: "https://pub.dev" source: hosted - version: "2.0.4-alpha+1696717344020" + version: "2.0.4-alpha+1700868214643" gql_error_link: dependency: transitive description: name: gql_error_link - sha256: bfdb543137da89448cc5d003fd029c2e8718931d39d4a7dedb16f9169862fbb9 + sha256: "93901458f3c050e33386dedb0ca7173e08cebd7078e4e0deca4bf23ab7a71f63" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.0+1" gql_exec: dependency: transitive description: name: gql_exec - sha256: da419a3ebaae7672ed662c42d754ffba996347af7fe0ca031f1dd699334994d8 + sha256: "394944626fae900f1d34343ecf2d62e44eb984826189c8979d305f0ae5846e38" url: "https://pub.dev" source: hosted - version: "1.0.1-alpha+1696717343896" + version: "1.1.1-alpha+1699813812660" gql_http_link: dependency: transitive description: name: gql_http_link - sha256: "0789d397d46ce274942fcc73e18a080cd2584296dadc33d8ae53d0666d7fe981" + sha256: "1f922eed1b7078fdbfd602187663026f9f659fe9a9499e2207b5d5e01617f658" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.1+1" gql_link: dependency: transitive description: name: gql_link - sha256: bcbb09ae8b200f413aa2d21fbf6ce4c4ac1ac443e81c612f29ef1587f4c84122 + sha256: "48dbf63b4831d800a2ce9675c9fecea3c9f2801de92072c7644a4bc52aa26c13" url: "https://pub.dev" source: hosted - version: "1.0.1-alpha+1696717343909" + version: "1.0.1-alpha+1700868214578" gql_transform_link: dependency: transitive description: @@ -841,10 +841,10 @@ packages: dependency: transitive description: name: hotreloader - sha256: "728c0613556c1d153f7e7f4a367cffacc3f5a677d7f6497a1c2b35add4e6dacf" + sha256: "94ee21a60ea2836500799f3af035dc3212b1562027f1e0031c14e087f0231449" url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "4.1.0" html: dependency: transitive description: @@ -913,10 +913,10 @@ packages: dependency: transitive description: name: image_picker_android - sha256: "0c7b83bbe2980c8a8e36e974f055e11e51675784e13a4762889feed0f3937ff2" + sha256: d6a6e78821086b0b737009b09363018309bbc6de3fd88cc5c26bc2bb44a4957f url: "https://pub.dev" source: hosted - version: "0.8.8+1" + version: "0.8.8+2" image_picker_for_web: dependency: transitive description: @@ -929,10 +929,10 @@ packages: dependency: transitive description: name: image_picker_ios - sha256: c5538cacefacac733c724be7484377923b476216ad1ead35a0d2eadcdc0fc497 + sha256: "76ec722aeea419d03aa915c2c96bf5b47214b053899088c9abb4086ceecf97a7" url: "https://pub.dev" source: hosted - version: "0.8.8+2" + version: "0.8.8+4" image_picker_linux: dependency: transitive description: @@ -1017,10 +1017,10 @@ packages: dependency: "direct dev" description: name: lint - sha256: f4bd4dbaa39f4ae8836f2d1275f2f32bc68b3a8cce0a0735dd1f7a601f06682a + sha256: "77b3777e8e9adca8e942da1e835882ae3248dfa00488a2ebbdbc1f1a4aa3f4a7" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.2.0" logging: dependency: transitive description: @@ -1161,10 +1161,10 @@ packages: dependency: transitive description: name: path_provider_android - sha256: "6b8b19bd80da4f11ce91b2d1fb931f3006911477cec227cce23d3253d80df3f1" + sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.2.1" path_provider_foundation: dependency: transitive description: @@ -1201,50 +1201,58 @@ packages: dependency: "direct main" description: name: permission_handler - sha256: "284a66179cabdf942f838543e10413246f06424d960c92ba95c84439154fcac8" + sha256: "860c6b871c94c78e202dc69546d4d8fd84bd59faeb36f8fb9888668a53ff4f78" url: "https://pub.dev" source: hosted - version: "11.0.1" + version: "11.1.0" permission_handler_android: dependency: transitive description: name: permission_handler_android - sha256: ace7d15a3d1a4a0b91c041d01e5405df221edb9de9116525efc773c74e6fc790 + sha256: "2f1bec180ee2f5665c22faada971a8f024761f632e93ddc23310487df52dcfa6" url: "https://pub.dev" source: hosted - version: "11.0.5" + version: "12.0.1" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5" + sha256: "1a816084338ada8d574b1cb48390e6e8b19305d5120fe3a37c98825bacc78306" + url: "https://pub.dev" + source: hosted + version: "9.2.0" + permission_handler_html: + dependency: transitive + description: + name: permission_handler_html + sha256: d96ff56a757b7f04fa825c469d296c5aebc55f743e87bd639fef91a466a24da8 url: "https://pub.dev" source: hosted - version: "9.1.4" + version: "0.1.0+1" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - sha256: "6760eb5ef34589224771010805bea6054ad28453906936f843a8cc4d3a55c4a4" + sha256: d87349312f7eaf6ce0adaf668daf700ac5b06af84338bd8b8574dfbd93ffe1a1 url: "https://pub.dev" source: hosted - version: "3.12.0" + version: "4.0.2" permission_handler_windows: dependency: transitive description: name: permission_handler_windows - sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098 + sha256: "1e8640c1e39121128da6b816d236e714d2cf17fac5a105dd6acdd3403a628004" url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "0.2.0" petitparser: dependency: transitive description: name: petitparser - sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + sha256: eeb2d1428ee7f4170e2bd498827296a18d4e7fc462b71727d111c0ac7707cfa6 url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "6.0.1" platform: dependency: transitive description: @@ -1337,18 +1345,18 @@ packages: dependency: transitive description: name: quick_actions_android - sha256: f2ddc2c0cc5c001e87e62f6de06da18ebc75c6a06d26750f6f12276841c1585c + sha256: df67c20583e05f5038a24c47bfa1b7b2977703ec2d162663017c5f9ef8707699 url: "https://pub.dev" source: hosted - version: "1.0.8" + version: "1.0.9" quick_actions_ios: dependency: transitive description: name: quick_actions_ios - sha256: f086cf98884421188c7c5c13f61b62aeb5b6fb88f197a0601db45108b1444ea6 + sha256: "5a13ed27b6254184fdd4294e100e3172fa6ebfd8bea03e414634a0f760d49997" url: "https://pub.dev" source: hosted - version: "1.0.7" + version: "1.0.8" quick_actions_platform_interface: dependency: transitive description: @@ -1417,10 +1425,10 @@ packages: dependency: transitive description: name: shared_preferences_web - sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf + sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.2" shared_preferences_windows: dependency: transitive description: @@ -1502,10 +1510,10 @@ packages: dependency: transitive description: name: sqflite_common - sha256: "1b92f368f44b0dee2425bb861cfa17b6f6cf3961f762ff6f941d20b33355660a" + sha256: bb4738f15b23352822f4c42a531677e5c6f522e079461fd240ead29d8d8a54a6 url: "https://pub.dev" source: hosted - version: "2.5.0" + version: "2.5.0+2" stack_trace: dependency: transitive description: @@ -1741,10 +1749,10 @@ packages: dependency: transitive description: name: video_player_web - sha256: "9c34a243785feca23148bfcd772dbb803d63c9304488177ec4f3f4463802fcb7" + sha256: ab7a462b07d9ca80bed579e30fb3bce372468f1b78642e0911b10600f2c5cb5b url: "https://pub.dev" source: hosted - version: "2.0.17" + version: "2.1.2" visibility_detector: dependency: "direct main" description: @@ -1757,10 +1765,10 @@ packages: dependency: transitive description: name: vm_service - sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "11.10.0" + version: "13.0.0" watcher: dependency: transitive description: @@ -1789,18 +1797,18 @@ packages: dependency: transitive description: name: win32 - sha256: "350a11abd2d1d97e0cc7a28a81b781c08002aa2864d9e3f192ca0ffa18b06ed3" + sha256: "7c99c0e1e2fa190b48d25c81ca5e42036d5cac81430ef249027d97b0935c553f" url: "https://pub.dev" source: hosted - version: "5.0.9" + version: "5.1.0" win32_registry: dependency: transitive description: name: win32_registry - sha256: e4506d60b7244251bc59df15656a3093501c37fb5af02105a944d73eb95be4c9 + sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" xdg_directories: dependency: transitive description: @@ -1813,10 +1821,10 @@ packages: dependency: transitive description: name: xml - sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84" + sha256: af5e77e9b83f2f4adc5d3f0a4ece1c7f45a2467b695c2540381bac793e34e556 url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.4.2" yaml: dependency: transitive description: @@ -1826,5 +1834,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0-194.0.dev <3.13.0" - flutter: ">=3.10.0" + dart: ">=3.2.0 <3.13.0" + flutter: ">=3.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index 3e37ddb70..2fc3fbfff 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -41,10 +41,10 @@ dependencies: sdk: flutter flutter_braintree: ^3.0.0 flutter_cache_manager: ^3.3.1 - flutter_local_notifications: ^16.1.0 + flutter_local_notifications: ^16.2.0 flutter_localizations: sdk: flutter - flutter_reaction_button: ^3.0.0+2 + flutter_reaction_button: ^3.0.0+3 flutter_speed_dial: ^7.0.0 flutter_svg: ^2.0.9 font_awesome_flutter: ^10.6.0 @@ -63,7 +63,7 @@ dependencies: mockito: ^5.4.3 network_image_mock: ^2.1.1 path_provider: ^2.1.1 - permission_handler: ^11.0.1 + permission_handler: ^11.1.0 plugin_platform_interface: ^2.1.7 pointycastle: ^3.7.3 provider: ^6.1.1 @@ -90,7 +90,7 @@ dev_dependencies: hive_generator: ^2.0.1 json_serializable: ^6.7.1 - lint: ^2.1.2 + lint: ^2.2.0 mocktail_image_network: ^1.0.0 talawa_lint: diff --git a/test/views/after_auth_screens/events/create_event_page_test.dart b/test/views/after_auth_screens/events/create_event_page_test.dart index 39474d6c6..8aa7b6b2e 100644 --- a/test/views/after_auth_screens/events/create_event_page_test.dart +++ b/test/views/after_auth_screens/events/create_event_page_test.dart @@ -72,414 +72,339 @@ void main() { tearDown(() { unregisterServices(); }); + group('testing', () { + testWidgets("Checking tap Inkwell for setDate 1 datetime", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + final inkwellFinder = find.byType(InkWell); + expect(inkwellFinder, findsNWidgets(7)); + // tester.allElements.forEach((element) { + // print(element); + // }); + + ///returning the file variable to the + ///result of function multimediaPickerService.getPhotoFromGallery + ///when this function is called in the + ///view model of add_post_page. + final file = File('fakePath'); + + /// using the new instance of multimediaPickerService + /// so that when statement can be used again, + /// else it gives null point exception + final multimediaPickerService = locator(); + + /// when is function provided by mockito lib + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); - testWidgets("Checking tap Inkwell for setDate 1 datetime", (tester) async { - await tester.pumpWidget( - createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, - ), - ); - await tester.pump(); - final inkwellFinder = find.byType(InkWell); - expect(inkwellFinder, findsNWidgets(7)); - // tester.allElements.forEach((element) { - // print(element); - // }); - - ///returning the file variable to the - ///result of function multimediaPickerService.getPhotoFromGallery - ///when this function is called in the - ///view model of add_post_page. - final file = File('fakePath'); - - /// using the new instance of multimediaPickerService - /// so that when statement can be used again, - /// else it gives null point exception - final multimediaPickerService = locator(); - - /// when is function provided by mockito lib - when(multimediaPickerService.getPhotoFromGallery(camera: false)) - .thenAnswer((_) async { - return file; + await tester.tap(inkwellFinder.at(1)); + await tester.pump(); }); - await tester.tap(inkwellFinder.at(1)); - await tester.pump(); - }); + testWidgets("Checking tap Inkwell for setTime 1 datetime", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + final inkwellFinder = find.byType(InkWell); + expect(inkwellFinder, findsNWidgets(7)); + + ///returning the file variable to the + ///result of function multimediaPickerService.getPhotoFromGallery + ///when this function is called in the + ///view model of add_post_page. + final file = File('fakePath'); + + /// using the new instance of multimediaPickerService + /// so that when statement can be used again, + /// else it gives null point exception + final multimediaPickerService = locator(); + + /// when is function provided by mockito lib + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); - testWidgets("Checking tap Inkwell for setTime 1 datetime", (tester) async { - await tester.pumpWidget( - createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, - ), - ); - await tester.pump(); - final inkwellFinder = find.byType(InkWell); - expect(inkwellFinder, findsNWidgets(7)); - - ///returning the file variable to the - ///result of function multimediaPickerService.getPhotoFromGallery - ///when this function is called in the - ///view model of add_post_page. - final file = File('fakePath'); - - /// using the new instance of multimediaPickerService - /// so that when statement can be used again, - /// else it gives null point exception - final multimediaPickerService = locator(); - - /// when is function provided by mockito lib - when(multimediaPickerService.getPhotoFromGallery(camera: false)) - .thenAnswer((_) async { - return file; + await tester.tap(inkwellFinder.at(2)); + await tester.pump(); }); + testWidgets("Checking tap Inkwell for setDate 2 datetime", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + final inkwellFinder = find.byType(InkWell); + expect(inkwellFinder, findsNWidgets(7)); + + ///returning the file variable to the + ///result of function multimediaPickerService.getPhotoFromGallery + ///when this function is called in the + ///view model of add_post_page. + final file = File('fakePath'); + + /// using the new instance of multimediaPickerService + /// so that when statement can be used again, + /// else it gives null point exception + final multimediaPickerService = locator(); + + /// when is function provided by mockito lib + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); - await tester.tap(inkwellFinder.at(2)); - await tester.pump(); - }); - testWidgets("Checking tap Inkwell for setDate 2 datetime", (tester) async { - await tester.pumpWidget( - createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, - ), - ); - await tester.pump(); - final inkwellFinder = find.byType(InkWell); - expect(inkwellFinder, findsNWidgets(7)); - - ///returning the file variable to the - ///result of function multimediaPickerService.getPhotoFromGallery - ///when this function is called in the - ///view model of add_post_page. - final file = File('fakePath'); - - /// using the new instance of multimediaPickerService - /// so that when statement can be used again, - /// else it gives null point exception - final multimediaPickerService = locator(); - - /// when is function provided by mockito lib - when(multimediaPickerService.getPhotoFromGallery(camera: false)) - .thenAnswer((_) async { - return file; + await tester.tap(inkwellFinder.at(3)); + await tester.pump(); }); - await tester.tap(inkwellFinder.at(3)); - await tester.pump(); - }); - - testWidgets("Checking tap Inkwell for set time 2 datetime", (tester) async { - await tester.pumpWidget( - createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, - ), - ); - await tester.pump(); - final inkwellFinder = find.byType(InkWell); - expect(inkwellFinder, findsNWidgets(7)); - // tester.allElements.forEach((element) { - // print(element); - // }); + testWidgets("Checking tap Inkwell for set time 2 datetime", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + final inkwellFinder = find.byType(InkWell); + expect(inkwellFinder, findsNWidgets(7)); + // tester.allElements.forEach((element) { + // print(element); + // }); + + ///returning the file variable to the + ///result of function multimediaPickerService.getPhotoFromGallery + ///when this function is called in the + ///view model of add_post_page. + final file = File('fakePath'); + + /// using the new instance of multimediaPickerService + /// so that when statement can be used again, + /// else it gives null point exception + final multimediaPickerService = locator(); + + /// when is function provided by mockito lib + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); - ///returning the file variable to the - ///result of function multimediaPickerService.getPhotoFromGallery - ///when this function is called in the - ///view model of add_post_page. - final file = File('fakePath'); - - /// using the new instance of multimediaPickerService - /// so that when statement can be used again, - /// else it gives null point exception - final multimediaPickerService = locator(); - - /// when is function provided by mockito lib - when(multimediaPickerService.getPhotoFromGallery(camera: false)) - .thenAnswer((_) async { - return file; + await tester.tap(inkwellFinder.at(4)); + await tester.pump(); }); - await tester.tap(inkwellFinder.at(4)); - await tester.pump(); - }); + testWidgets('checks if the upload photo from button shows correct icon', + (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); - testWidgets('checks if the upload photo from button shows correct icon', - (tester) async { - await tester.pumpWidget( - createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, - ), - ); - await tester.pump(); + /// using the key of icon button + /// because their are many icon button + + final finder = find.byKey(const Key('txt_btn_cep')); - /// using the key of icon button - /// because their are many icon button + expect(finder, findsOneWidget); - final finder = find.byKey(const Key('txt_btn_cep')); + ///returning the file variable to the + ///result of function multimediaPickerService.getPhotoFromGallery + ///when this function is called in the + ///view model of add_post_page. + final file = File('fakePath'); - expect(finder, findsOneWidget); + /// using the new instance of multimediaPickerService + /// so that when statement can be used again, + /// else it gives null point exception + final multimediaPickerServices = locator(); - ///returning the file variable to the - ///result of function multimediaPickerService.getPhotoFromGallery - ///when this function is called in the - ///view model of add_post_page. - final file = File('fakePath'); + /// when is function provided by mockito lib + when(multimediaPickerServices.getPhotoFromGallery()) + .thenAnswer((_) async { + return file; + }); - /// using the new instance of multimediaPickerService - /// so that when statement can be used again, - /// else it gives null point exception - final multimediaPickerServices = locator(); + await tester.tap(finder); + await tester.pump(); - /// when is function provided by mockito lib - when(multimediaPickerServices.getPhotoFromGallery()).thenAnswer((_) async { - return file; + expect(finder, findsOneWidget); }); - await tester.tap(finder); - await tester.pump(); + testWidgets( + 'checks if the uploaded photo from gallery button is removed after pressing remove button', + (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); - expect(finder, findsOneWidget); - }); + /// using the key of icon button + /// because their are many icon button - testWidgets( - 'checks if the uploaded photo from gallery button is removed after pressing remove button', - (tester) async { - await tester.pumpWidget( - createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, - ), - ); - await tester.pump(); + final finder = find.byKey(const Key('txt_btn_cep')); - /// using the key of icon button - /// because their are many icon button + final cancelBtn = find.byIcon(Icons.cancel); - final finder = find.byKey(const Key('txt_btn_cep')); + expect(finder, findsOneWidget); - final cancelBtn = find.byIcon(Icons.cancel); + ///returning the file variable to the + ///result of function multimediaPickerService.getPhotoFromGallery + ///when this function is called in the + ///view model of add_post_page. + final file = File('fakePath'); - expect(finder, findsOneWidget); + /// using the new instance of multimediaPickerService + /// so that when statement can be used again, + /// else it gives null point exception + final multimediaPickerService = locator(); - ///returning the file variable to the - ///result of function multimediaPickerService.getPhotoFromGallery - ///when this function is called in the - ///view model of add_post_page. - final file = File('fakePath'); + /// when is function provided by mockito lib + when(multimediaPickerService.getPhotoFromGallery(camera: false)) + .thenAnswer((_) async { + return file; + }); - /// using the new instance of multimediaPickerService - /// so that when statement can be used again, - /// else it gives null point exception - final multimediaPickerService = locator(); + await tester.tap(finder); + await tester.pump(); - /// when is function provided by mockito lib - when(multimediaPickerService.getPhotoFromGallery(camera: false)) - .thenAnswer((_) async { - return file; + await tester.tap(cancelBtn); + await tester.pump(); }); - await tester.tap(finder); - await tester.pump(); - - await tester.tap(cancelBtn); - await tester.pump(); - }); - - testWidgets("Testing Keep public section", (tester) async { - await tester.pumpWidget( - createEventScreen( - theme: TalawaTheme.lightTheme, - ), - ); - await tester.pumpAndSettle(); - final appLocalization = AppLocalizations.of( - navigationService.navigatorKey.currentContext!, - ); - final keepPublicText = find.descendant( - of: find.byType(Row), - matching: find.text( - appLocalization!.strictTranslate('Keep Public'), - ), - ); - final switches = find.descendant( - of: find.byType(Row), - matching: find.byType(Switch), - ); - expect(keepPublicText, findsOneWidget); - expect(switches, findsNWidgets(2)); - expect( - (tester.widget(keepPublicText) as Text?)?.style!.fontSize, - 16, - ); - expect((tester.firstWidget(switches) as Switch).value, true); - await tester.tap(switches.first); - await tester.pumpAndSettle(); - expect((tester.firstWidget(switches) as Switch).value, false); - }); - - testWidgets("Testing Keep Registerable section", (tester) async { - await tester.pumpWidget( - createEventScreen( - theme: TalawaTheme.lightTheme, - ), - ); - await tester.pumpAndSettle(); - final appLocalization = AppLocalizations.of( - navigationService.navigatorKey.currentContext!, - ); - final keepRegisterableText = find.descendant( - of: find.byType(Row), - matching: find.text( - appLocalization!.strictTranslate('Keep Registerable'), - ), - ); - final switches = find.descendant( - of: find.byType(Row), - matching: find.byType(Switch), - ); - expect(keepRegisterableText, findsOneWidget); - expect(switches, findsNWidgets(2)); - expect( - (tester.widget(keepRegisterableText) as Text?)?.style!.fontSize, - 16, - ); - expect((tester.widgetList(switches).toList()[1] as Switch).value, true); - await tester.ensureVisible(switches.at(1)); - await tester.tap(switches.at(1)); - await tester.pumpAndSettle(); - expect((tester.widgetList(switches).toList()[1] as Switch).value, false); - }); - - // testWidgets("Checking tap Inkwell work for admin list", (tester) async { - // await tester.pumpWidget( - // createEventScreen( - // themeMode: ThemeMode.dark, - // theme: TalawaTheme.darkTheme, - // ), - // ); - // await tester.pump(); - // final inkwellFinder = find.byType(InkWell); - // expect(inkwellFinder, findsNWidgets(8)); - - // ///returning the file variable to the - // ///result of function multimediaPickerService.getPhotoFromGallery - // ///when this function is called in the - // ///view model of add_post_page. - // final file = File('fakePath'); - - // /// using the new instance of multimediaPickerService - // /// so that when statement can be used again, - // /// else it gives null point exception - // final multimediaPickerService = locator(); - - // /// when is function provided by mockito lib - // when(multimediaPickerService.getPhotoFromGallery(camera: false)) - // .thenAnswer((_) async { - // return file; - // }); - - // await tester.ensureVisible(find.byKey(const Key('inwell_cep1'))); - // await tester.pumpAndSettle(); - - // await tester.tap(find.byKey(const Key('inwell_cep1'))); - // await tester.pump(); - - // //TODO: implement Rest of the test when the _adminCheckedMap or _memberCheckedMap return true for some id - // //TODO: for not it return false for all the ordMember.id - // // - // // orgMembersList.forEach((orgMember) { - // // if (isAdmin) { - // // _adminCheckedMap.putIfAbsent(orgMember.id!, () => false); - // // } else { - // // _memberCheckedMap.putIfAbsent(orgMember.id!, () => false); - // // } - // // _memberCheckedMap.putIfAbsent(orgMember.id!, () => false); - // // }); - // }); - - testWidgets("Checking tap Inkwell for second add to bottom sheet", - (tester) async { - await tester.pumpWidget( - createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, - ), - ); - await tester.pump(); - final inkwellFinder = find.byType(InkWell); - expect(inkwellFinder, findsNWidgets(7)); - - await tester.ensureVisible(find.byKey(const Key('inwell_cep2'))); - await tester.pump(); - - // await tester.tap(find.byKey(const Key('text_btn_ambs'))); - await tester.tap( - find.byKey( - const Key('inwell_cep2'), - ), - ); - await tester.pump(); - - await tester.pump(); - await tester.ensureVisible(find.byKey(const Key('text_btn_ambs1'))); - await tester.pumpAndSettle(); - - await tester.tap(find.byKey(const Key('text_btn_ambs1'))); - await tester.pump(); - }); - group('setState Coverage completion', () { - testWidgets('Tap on DataTimeTile date', (tester) async { + testWidgets("Testing Keep public section", (tester) async { await tester.pumpWidget( createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, + theme: TalawaTheme.lightTheme, ), ); - await tester.pump(); - - await tester.tap(find.byKey(const Key('EventDateTimeTileDate')).first); - await tester.pump(); - - await tester.ensureVisible(find.byKey(const Key('key for test cep'))); - await tester.pump(); - - expect(find.byType(DatePickerDialog), findsOneWidget); - expect(find.byType(CalendarDatePicker), findsOneWidget); - - await tester.tap(find.text('OK')); await tester.pumpAndSettle(); - + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final keepPublicText = find.descendant( + of: find.byType(Row), + matching: find.text( + appLocalization!.strictTranslate('Keep Public'), + ), + ); + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(keepPublicText, findsOneWidget); + expect(switches, findsNWidgets(2)); expect( - find.text(DateTime.now().toString().split(' ').first), - findsNWidgets(2), + (tester.widget(keepPublicText) as Text?)?.style!.fontSize, + 16, ); + expect((tester.firstWidget(switches) as Switch).value, true); + await tester.ensureVisible(switches.first); + await tester.tap(switches.first); + await tester.pumpAndSettle(); + expect((tester.firstWidget(switches) as Switch).value, false); }); - testWidgets('Tap on DataTimeTile time', (tester) async { + + testWidgets("Testing Keep Registerable section", (tester) async { await tester.pumpWidget( createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, + theme: TalawaTheme.lightTheme, ), ); await tester.pumpAndSettle(); - - await tester.tap(find.byKey(const Key('EventDateTimeTileTime')).first); - await tester.pump(); - - expect(find.byType(TimePickerDialog), findsOneWidget); - - await tester.tap(find.text('OK')); - await tester.pump(); + final appLocalization = AppLocalizations.of( + navigationService.navigatorKey.currentContext!, + ); + final keepRegisterableText = find.descendant( + of: find.byType(Row), + matching: find.text( + appLocalization!.strictTranslate('Keep Registerable'), + ), + ); + final switches = find.descendant( + of: find.byType(Row), + matching: find.byType(Switch), + ); + expect(keepRegisterableText, findsOneWidget); + expect(switches, findsNWidgets(2)); expect( - find.text(DateFormat.jm().format(DateTime.now())), - findsNWidgets(2), + (tester.widget(keepRegisterableText) as Text?)?.style!.fontSize, + 16, ); + expect((tester.widgetList(switches).toList()[1] as Switch).value, true); + await tester.ensureVisible(switches.at(1)); + await tester.tap(switches.at(1)); + await tester.pumpAndSettle(); + expect((tester.widgetList(switches).toList()[1] as Switch).value, false); }); - testWidgets('Tap on DataTimeTile date', (tester) async { + + // testWidgets("Checking tap Inkwell work for admin list", (tester) async { + // await tester.pumpWidget( + // createEventScreen( + // themeMode: ThemeMode.dark, + // theme: TalawaTheme.darkTheme, + // ), + // ); + // await tester.pump(); + // final inkwellFinder = find.byType(InkWell); + // expect(inkwellFinder, findsNWidgets(8)); + + // ///returning the file variable to the + // ///result of function multimediaPickerService.getPhotoFromGallery + // ///when this function is called in the + // ///view model of add_post_page. + // final file = File('fakePath'); + + // /// using the new instance of multimediaPickerService + // /// so that when statement can be used again, + // /// else it gives null point exception + // final multimediaPickerService = locator(); + + // /// when is function provided by mockito lib + // when(multimediaPickerService.getPhotoFromGallery(camera: false)) + // .thenAnswer((_) async { + // return file; + // }); + + // await tester.ensureVisible(find.byKey(const Key('inwell_cep1'))); + // await tester.pumpAndSettle(); + + // await tester.tap(find.byKey(const Key('inwell_cep1'))); + // await tester.pump(); + + // //TODO: implement Rest of the test when the _adminCheckedMap or _memberCheckedMap return true for some id + // //TODO: for not it return false for all the ordMember.id + // // + // // orgMembersList.forEach((orgMember) { + // // if (isAdmin) { + // // _adminCheckedMap.putIfAbsent(orgMember.id!, () => false); + // // } else { + // // _memberCheckedMap.putIfAbsent(orgMember.id!, () => false); + // // } + // // _memberCheckedMap.putIfAbsent(orgMember.id!, () => false); + // // }); + // }); + + testWidgets("Checking tap Inkwell for second add to bottom sheet", + (tester) async { await tester.pumpWidget( createEventScreen( themeMode: ThemeMode.dark, @@ -487,55 +412,55 @@ void main() { ), ); await tester.pump(); + final inkwellFinder = find.byType(InkWell); + expect(inkwellFinder, findsNWidgets(7)); - await tester.tap(find.byKey(const Key('EventDateTimeTileDate')).last); - await tester.pump(); - - await tester.ensureVisible(find.byKey(const Key('key for test cep'))); + await tester.ensureVisible(find.byKey(const Key('inwell_cep2'))); await tester.pump(); - expect(find.byType(DatePickerDialog), findsOneWidget); - expect(find.byType(CalendarDatePicker), findsOneWidget); - - await tester.tap(find.text('OK')); - await tester.pumpAndSettle(); - expect( - find.text(DateTime.now().toString().split(' ').first), - findsNWidgets(2), - ); - }); - testWidgets('Tap on DataTimeTile time', (tester) async { - await tester.pumpWidget( - createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, + // await tester.tap(find.byKey(const Key('text_btn_ambs'))); + await tester.tap( + find.byKey( + const Key('inwell_cep2'), ), ); - await tester.pumpAndSettle(); - - await tester.tap(find.byKey(const Key('EventDateTimeTileTime')).last); await tester.pump(); - expect(find.byType(TimePickerDialog), findsOneWidget); + await tester.pump(); + await tester.ensureVisible(find.byKey(const Key('text_btn_ambs1'))); + await tester.pumpAndSettle(); - await tester.tap(find.text('OK')); + await tester.tap(find.byKey(const Key('text_btn_ambs1'))); await tester.pump(); - expect( - find.text(DateFormat.jm().format(DateTime.now())), - findsNWidgets(2), - ); }); - }); + group('setState Coverage completion', () { + testWidgets('Tap on DataTimeTile date', (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); - group("Tests for integration with view model and services", () { - late final CreateEventViewModel cachedViewModel; + await tester.tap(find.byKey(const Key('EventDateTimeTileDate')).first); + await tester.pump(); - testWidgets("setup MockCreateEventViewModel", (tester) async { - cachedViewModel = getAndRegisterCreateEventModel(); - }); + await tester.ensureVisible(find.byKey(const Key('key for test cep'))); + await tester.pump(); + + expect(find.byType(DatePickerDialog), findsOneWidget); + expect(find.byType(CalendarDatePicker), findsOneWidget); + + await tester.tap(find.text('OK')); + await tester.pumpAndSettle(); - testWidgets("Check if AppBar buttons work", (tester) async { - mockNetworkImages(() async { + expect( + find.text(DateTime.now().toString().split(' ').first), + findsNWidgets(2), + ); + }); + testWidgets('Tap on DataTimeTile time', (tester) async { await tester.pumpWidget( createEventScreen( themeMode: ThemeMode.dark, @@ -544,21 +469,74 @@ void main() { ); await tester.pumpAndSettle(); - expect(find.byType(CreateEventPage), findsOneWidget); + await tester.tap(find.byKey(const Key('EventDateTimeTileTime')).first); + await tester.pump(); - await tester.tap(find.text("Add")); - await tester.pumpAndSettle(); + expect(find.byType(TimePickerDialog), findsOneWidget); - await tester.tap(find.byIcon(Icons.close)); + await tester.tap(find.text('OK')); + await tester.pump(); + expect( + find.text(DateFormat.jm().format(DateTime.now())), + findsNWidgets(2), + ); + }); + testWidgets('Tap on DataTimeTile date', (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); + + await tester.tap(find.byKey(const Key('EventDateTimeTileDate')).last); + await tester.pump(); + + await tester.ensureVisible(find.byKey(const Key('key for test cep'))); + await tester.pump(); + + expect(find.byType(DatePickerDialog), findsOneWidget); + expect(find.byType(CalendarDatePicker), findsOneWidget); + + await tester.tap(find.text('OK')); await tester.pumpAndSettle(); + expect( + find.text(DateTime.now().toString().split(' ').first), + findsNWidgets(2), + ); + }); + testWidgets('Tap on DataTimeTile time', (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + await tester.tap(find.byKey(const Key('EventDateTimeTileTime')).last); + await tester.pump(); + + expect(find.byType(TimePickerDialog), findsOneWidget); - // expect(find.byType(CreateEventPage), findsNothing); + await tester.tap(find.text('OK')); + await tester.pump(); + expect( + find.text(DateFormat.jm().format(DateTime.now())), + findsNWidgets(2), + ); }); }); - testWidgets( - "Check if data coming from view model show up correctly", - (tester) async { + group("Tests for integration with view model and services", () { + late final CreateEventViewModel cachedViewModel; + + testWidgets("setup MockCreateEventViewModel", (tester) async { + cachedViewModel = getAndRegisterCreateEventModel(); + }); + + testWidgets("Check if AppBar buttons work", (tester) async { mockNetworkImages(() async { await tester.pumpWidget( createEventScreen( @@ -567,74 +545,99 @@ void main() { ), ); await tester.pumpAndSettle(); - }); - }, - ); - testWidgets("Check if bottom sheet unticking works", (tester) async { - await tester.pumpWidget( - createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, - ), - ); - await tester.pump(); + expect(find.byType(CreateEventPage), findsOneWidget); - await tester.ensureVisible(find.byKey(const Key('inwell_cep2'))); - await tester.pump(); + await tester.tap(find.text("Add")); + await tester.pumpAndSettle(); - // await tester.tap(find.byKey(const Key('text_btn_ambs'))); - await tester.tap( - find.byKey( - const Key('inwell_cep2'), - ), - ); - await tester.pump(); + await tester.tap(find.byIcon(Icons.close)); + await tester.pumpAndSettle(); - await tester.pump(); - await tester.ensureVisible(find.byKey(const Key('text_btn_ambs1'))); - await tester.pumpAndSettle(); + // expect(find.byType(CreateEventPage), findsNothing); + }); + }); - await tester.tap(find.byType(CheckboxListTile)); - expect(cachedViewModel.memberCheckedMap['fakeUser1'], false); - await tester.pumpAndSettle(); - await tester.tap(find.byType(CheckboxListTile)); - expect(cachedViewModel.memberCheckedMap['fakeUser1'], true); - await tester.pump(); - }); + testWidgets( + "Check if data coming from view model show up correctly", + (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + }); + }, + ); - testWidgets( - "Check if deleting members and admins works", - (tester) async { - mockNetworkImages(() async { - await tester.pumpWidget( - createEventScreen( - themeMode: ThemeMode.dark, - theme: TalawaTheme.darkTheme, - ), - ); - await tester.pumpAndSettle(); + testWidgets("Check if bottom sheet unticking works", (tester) async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pump(); - //expect(find.text("p s"), findsOneWidget); - expect(find.text("r p"), findsOneWidget); + await tester.ensureVisible(find.byKey(const Key('inwell_cep2'))); + await tester.pump(); - //await tester.ensureVisible(find.text("p s")); - // await tester.pumpAndSettle(); - // await tester.tap(find.byIcon(Icons.cancel_rounded).at(0)); - // await tester.pumpAndSettle(const Duration(seconds: 1)); + // await tester.tap(find.byKey(const Key('text_btn_ambs'))); + await tester.tap( + find.byKey( + const Key('inwell_cep2'), + ), + ); + await tester.pump(); - //expect(cachedViewModel.selectedAdmins, []); - expect(find.text("r p"), findsOneWidget); + await tester.pump(); + await tester.ensureVisible(find.byKey(const Key('text_btn_ambs1'))); + await tester.pumpAndSettle(); - await tester.ensureVisible(find.text("r p")); - await tester.pumpAndSettle(); - await tester.tap(find.byIcon(Icons.cancel_rounded).at(0)); - await tester.pumpAndSettle(const Duration(seconds: 1)); + await tester.tap(find.byType(CheckboxListTile)); + expect(cachedViewModel.memberCheckedMap['fakeUser1'], false); + await tester.pumpAndSettle(); + await tester.tap(find.byType(CheckboxListTile)); + expect(cachedViewModel.memberCheckedMap['fakeUser1'], true); + await tester.pump(); + }); - //expect(cachedViewModel.selectedAdmins, []); - expect(cachedViewModel.selectedMembers, []); - }); - }, - ); + testWidgets( + "Check if deleting members and admins works", + (tester) async { + mockNetworkImages(() async { + await tester.pumpWidget( + createEventScreen( + themeMode: ThemeMode.dark, + theme: TalawaTheme.darkTheme, + ), + ); + await tester.pumpAndSettle(); + + //expect(find.text("p s"), findsOneWidget); + expect(find.text("r p"), findsOneWidget); + + //await tester.ensureVisible(find.text("p s")); + // await tester.pumpAndSettle(); + // await tester.tap(find.byIcon(Icons.cancel_rounded).at(0)); + // await tester.pumpAndSettle(const Duration(seconds: 1)); + + //expect(cachedViewModel.selectedAdmins, []); + expect(find.text("r p"), findsOneWidget); + + await tester.ensureVisible(find.text("r p")); + await tester.pumpAndSettle(); + await tester.tap(find.byIcon(Icons.cancel_rounded).at(0)); + await tester.pumpAndSettle(const Duration(seconds: 1)); + + //expect(cachedViewModel.selectedAdmins, []); + expect(cachedViewModel.selectedMembers, []); + }); + }, + ); + }); }); } diff --git a/test/widget_tests/after_auth_screens/events/create_event_page_test.dart b/test/widget_tests/after_auth_screens/events/create_event_page_test.dart index 0e6b14d39..3dc4692aa 100644 --- a/test/widget_tests/after_auth_screens/events/create_event_page_test.dart +++ b/test/widget_tests/after_auth_screens/events/create_event_page_test.dart @@ -364,6 +364,7 @@ void main() { 16, ); expect((tester.firstWidget(switches) as Switch).value, true); + await tester.ensureVisible(switches.first); await tester.tap(switches.first); await tester.pumpAndSettle(); expect((tester.firstWidget(switches) as Switch).value, false); diff --git a/test/widget_tests/after_auth_screens/events/edit_event_page_test.dart b/test/widget_tests/after_auth_screens/events/edit_event_page_test.dart index 0f3250c5c..c2eb5df00 100644 --- a/test/widget_tests/after_auth_screens/events/edit_event_page_test.dart +++ b/test/widget_tests/after_auth_screens/events/edit_event_page_test.dart @@ -484,6 +484,7 @@ void main() { 16, ); expect((tester.firstWidget(switches) as Switch).value, true); + await tester.ensureVisible(switches.first); await tester.tap(switches.first); await tester.pumpAndSettle(); expect((tester.firstWidget(switches) as Switch).value, false); 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 57426ff71..804c168d1 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 @@ -96,8 +96,10 @@ void main() { }); testWidgets('Testing the Cancel button', (tester) async { await prepareDatePicker(tester, (date) async { - expect(find.text('CANCEL'), findsOneWidget); - await tester.tap(find.text('CANCEL')); + final cancelBtnFinder = find.byKey(const ValueKey('CancelButton')); + expect(cancelBtnFinder, findsOneWidget); + await tester.ensureVisible(cancelBtnFinder); + await tester.tap(cancelBtnFinder); await tester.pumpAndSettle(); expect( find.textContaining( diff --git a/test/widget_tests/pre_auth_screens/change_password_page_test.dart b/test/widget_tests/pre_auth_screens/change_password_page_test.dart index 17b36eb7b..f7ea14828 100644 --- a/test/widget_tests/pre_auth_screens/change_password_page_test.dart +++ b/test/widget_tests/pre_auth_screens/change_password_page_test.dart @@ -168,6 +168,7 @@ void main() { //inputting a invalid pass in the field await tester.enterText(passInputFieldWidget, 'nontext'); //submitting the field with invalid input + await tester.ensureVisible(findChangePassButton); await tester.tap(findChangePassButton); await tester.pumpAndSettle(const Duration(milliseconds: 500)); //testing the invalidPassSubmission widget appears @@ -291,6 +292,7 @@ void main() { //inputting a invalid pass in the field await tester.enterText(passInputFieldWidget, 'nontext'); //submitting the field with invalid input + await tester.ensureVisible(findRecoverButton); await tester.tap(findRecoverButton); await tester.pumpAndSettle(const Duration(milliseconds: 500)); //testing the invalidPassSubmission widget appears diff --git a/test/widget_tests/pre_auth_screens/login_test.dart b/test/widget_tests/pre_auth_screens/login_test.dart index ac44a74f0..75268cd74 100644 --- a/test/widget_tests/pre_auth_screens/login_test.dart +++ b/test/widget_tests/pre_auth_screens/login_test.dart @@ -125,6 +125,7 @@ void main() { //inputting a non email text in the field await tester.enterText(emailInputFieldWidget, 'non-url text'); //submitting the field with non url input + await tester.ensureVisible(findLoginButton); await tester.tap(findLoginButton); await tester.pumpAndSettle(const Duration(milliseconds: 500)); //testing the invalidEmailSubmission widget appears @@ -171,6 +172,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(findLoginButton); await tester.tap(findLoginButton); await tester.pumpAndSettle(const Duration(milliseconds: 500)); //testing the invalidPasswordSubmission widget appears diff --git a/test/widget_tests/widgets/custom_list_tile_test.dart b/test/widget_tests/widgets/custom_list_tile_test.dart index f2ce33f69..a069faf13 100644 --- a/test/widget_tests/widgets/custom_list_tile_test.dart +++ b/test/widget_tests/widgets/custom_list_tile_test.dart @@ -258,6 +258,7 @@ void main() { expect(find.byKey(_key), findsOneWidget); // test to see if onTap of Inkwell works + await tester.ensureVisible(find.byType(InkWell)); await tester.tap(find.byType(InkWell)); await tester.pump(); expect(executed, true); @@ -303,8 +304,11 @@ void main() { optionSubtitleWidget.style, Theme.of(navigationService.navigatorKey.currentContext!) .textTheme - .bodySmall - ?.copyWith(color: Colors.black, fontSize: 18), + .bodyMedium + ?.copyWith( + color: Colors.black, + fontSize: 18, + ), ); // Testing SizedBox for option when trailing icon button is null (fallback for creater info) diff --git a/test/widget_tests/widgets/date_time_picker_test.dart b/test/widget_tests/widgets/date_time_picker_test.dart index c37c65b2c..584e7b855 100644 --- a/test/widget_tests/widgets/date_time_picker_test.dart +++ b/test/widget_tests/widgets/date_time_picker_test.dart @@ -71,11 +71,11 @@ void main() { testWidgets('Check if cancelling the time picker works', (tester) async { await tester .pumpWidget(dateTimePicker(checkProp: cancelTime, isTimeType: true)); - + await tester.ensureVisible(find.text('Open')); await tester.tap(find.text('Open')); await tester.pump(); await tester.pump(const Duration(seconds: 1)); - await tester.tap(find.textContaining('CANCEL')); + await tester.tap(find.textContaining('Cancel')); expect(testTime, cancelTime); }); @@ -109,7 +109,7 @@ void main() { await tester.tap(find.text('Open')); await tester.pump(); await tester.pump(const Duration(seconds: 1)); - await tester.tap(find.textContaining('CANCEL')); + await tester.tap(find.textContaining('Cancel')); expect(testDate, cancelDate); }); diff --git a/test/widget_tests/widgets/lang_switch_test.dart b/test/widget_tests/widgets/lang_switch_test.dart index 3b5594770..9c920cbbd 100644 --- a/test/widget_tests/widgets/lang_switch_test.dart +++ b/test/widget_tests/widgets/lang_switch_test.dart @@ -16,7 +16,7 @@ import '../../helpers/test_locator.dart'; Widget createLanguageTile() { return BaseView( - onModelReady: (_) => _.initialize(), + onModelReady: (model) => model.initialize(), builder: (_, __, ___) => MaterialApp( localizationsDelegates: [ const AppLocalizationsDelegate(isTest: true),