From 78c0335c6d1f847df897ea860471da2bf6da88f6 Mon Sep 17 00:00:00 2001 From: yashovardhan99 Date: Sun, 10 Mar 2019 19:00:45 +0530 Subject: [PATCH 1/2] Added first sample test --- test/app_test.dart | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/app_test.dart diff --git a/test/app_test.dart b/test/app_test.dart new file mode 100644 index 0000000..032033b --- /dev/null +++ b/test/app_test.dart @@ -0,0 +1,9 @@ +import 'package:allisto_app/main.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('app should work', (tester) async { + await tester.pumpWidget(new Allisto()); + expect(find.text('Allisto'), findsOneWidget); + }); +} From 09fe9198c13dc27a064e4a5e79b49c9cccbcc0c5 Mon Sep 17 00:00:00 2001 From: yashovardhan99 Date: Sun, 10 Mar 2019 19:30:49 +0530 Subject: [PATCH 2/2] Added new widget tests for home screen and renamed and grouped for readibility --- test/app_test.dart | 9 --------- test/home_screen_test.dart | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) delete mode 100644 test/app_test.dart create mode 100644 test/home_screen_test.dart diff --git a/test/app_test.dart b/test/app_test.dart deleted file mode 100644 index 032033b..0000000 --- a/test/app_test.dart +++ /dev/null @@ -1,9 +0,0 @@ -import 'package:allisto_app/main.dart'; -import 'package:flutter_test/flutter_test.dart'; - -void main() { - testWidgets('app should work', (tester) async { - await tester.pumpWidget(new Allisto()); - expect(find.text('Allisto'), findsOneWidget); - }); -} diff --git a/test/home_screen_test.dart b/test/home_screen_test.dart new file mode 100644 index 0000000..1492879 --- /dev/null +++ b/test/home_screen_test.dart @@ -0,0 +1,26 @@ +import 'package:allisto_app/pages/home_page.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + group("Home screen is displayed correctly", () { + testWidgets('Home screen has text Allisto', (tester) async { + await tester.pumpWidget(new MaterialApp(home: HomePage(),)); + expect(find.text('Allisto'), findsOneWidget); + }); + testWidgets('Home screen has mic button', (tester) async { + await tester.pumpWidget(new MaterialApp(home: HomePage(),)); + expect(find.widgetWithIcon(FloatingActionButton, Icons.mic_none), + findsOneWidget); + }); + testWidgets('Home screen has dashboard button', (tester) async { + await tester.pumpWidget(new MaterialApp(home: HomePage(),)); + expect(find.widgetWithIcon(IconButton, Icons.dashboard), findsOneWidget); + }); + testWidgets('Home screen has contact button', (tester) async { + await tester.pumpWidget(new MaterialApp(home: HomePage(),)); + expect(find.widgetWithIcon(IconButton, Icons.perm_contact_calendar), + findsOneWidget); + }); + }); +}