diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index 9ddf5fd..943bc00 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -3,7 +3,6 @@ import 'package:flutter_test/flutter_test.dart'; void main() { test('Counter increments smoke test', () async { // This is an example test that checks if the counter increments correctly. - // TODO - Implement the actual widget test. expect(1, 1); }); } diff --git a/pubspec.lock b/pubspec.lock index 8ac9f57..79b8a90 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: async - sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 url: "https://pub.dev" source: hosted - version: "2.13.0" + version: "2.12.0" boolean_selector: dependency: transitive description: @@ -45,10 +45,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" url: "https://pub.dev" source: hosted - version: "1.3.3" + version: "1.3.2" flutter: dependency: "direct main" description: flutter @@ -71,10 +71,10 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" + sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec url: "https://pub.dev" source: hosted - version: "10.0.9" + version: "10.0.8" leak_tracker_flutter_testing: dependency: transitive description: @@ -196,10 +196,10 @@ packages: dependency: transitive description: name: vm_service - sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 + sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" url: "https://pub.dev" source: hosted - version: "15.0.0" + version: "14.3.1" sdks: dart: ">=3.7.0-0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/test/widget_test.dart b/test/widget_test.dart index 296f3f5..ec2326f 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -4,11 +4,105 @@ // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. +import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:motion_toast/motion_toast.dart'; -// TODO: write unit tests for motion toast widget void main() { - test('Counter increments smoke test', () async { - expect(true, isTrue); + group('Success motion toast testing...', () { + testWidgets( + 'Basic motion toast widget test', + (tester) async { + var basicMotionToastWidget = MotionToast.success( + description: const Text( + 'Elegant notification description', + ), + ); + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: Center( + child: basicMotionToastWidget, + ), + ), + ), + ); + expect( + find.byType(Text), + findsOneWidget, + ); + expect( + find.byType(Icon), + findsOneWidget, + ); + }, + ); + + testWidgets( + 'Motion toast with title widget test', + (tester) async { + var basicMotionToastWidget = MotionToast.success( + description: const Text( + 'Elegant notification description', + ), + title: const Text( + 'Elegant notification title', + ), + ); + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: Center( + child: basicMotionToastWidget, + ), + ), + ), + ); + expect( + find.byType(Text), + findsAtLeast(2), + ); + expect( + find.byType(Icon), + findsOneWidget, + ); + }, + ); + + testWidgets( + 'Motion toast with title and toast duration widget test', + (tester) async { + var basicMotionToastWidget = MotionToast.success( + description: const Text( + 'Elegant notification description', + ), + title: const Text( + 'Elegant notification title', + ), + toastDuration: const Duration(seconds: 1), + ); + await tester.pumpWidget( + MaterialApp( + home: Scaffold( + body: Center( + child: basicMotionToastWidget, + ), + ), + ), + ); + expect( + find.byType(Text), + findsAtLeast(2), + ); + expect( + find.byType(Icon), + findsOneWidget, + ); + expect( + find.byType(MotionToast), + findsOneWidget, + ); + }, + ); }); }