11import 'package:card_swiper/card_swiper.dart' ;
22import 'package:codephile/data/constants/strings.dart' ;
33import 'package:codephile/data/services/local/storage_service.dart' ;
4- import 'package:codephile/presentation/home/home_screen.dart' ;
54import 'package:codephile/presentation/onboarding/onboarding_screen.dart' ;
65import 'package:codephile/presentation/onboarding/widgets/onboarding_widgets.dart' ;
76import 'package:flutter/material.dart' ;
@@ -24,6 +23,7 @@ void widgetTests() {
2423
2524 testWidgets ('contains sub-widgets' , (tester) async {
2625 await pumpScreen (tester, () => OnboardingScreen ());
26+ await tester.pumpAndSettle (const Duration (seconds: 5 ));
2727
2828 expect (find.byType (BackgroundDecoration ), findsOneWidget);
2929 expect (find.byType (NextButton ), findsOneWidget);
@@ -43,6 +43,7 @@ void widgetTests() {
4343
4444 testWidgets ("contains first feature's data" , (tester) async {
4545 await pumpScreen (tester, () => OnboardingScreen ());
46+ await tester.pumpAndSettle (const Duration (seconds: 5 ));
4647
4748 expect (find.text (pages[0 ].title), findsOneWidget);
4849 expect (find.text (pages[0 ].description), findsOneWidget);
@@ -59,6 +60,7 @@ void widgetTests() {
5960
6061 testWidgets ('pressing NextButton takes user to next page' , (tester) async {
6162 await pumpScreen (tester, () => OnboardingScreen ());
63+ await tester.pumpAndSettle (const Duration (seconds: 5 ));
6264
6365 for (var i = 0 ; i < pages.length; i++ ) {
6466 // Finds i^th feature's data
@@ -73,12 +75,11 @@ void widgetTests() {
7375 ),
7476 findsOneWidget,
7577 );
76-
77- await tester.tap (find.byType (NextButton ));
78- await tester.pumpAndSettle ();
78+ if (i != pages.length - 1 ) {
79+ await tester.tap (find.byType (NextButton ));
80+ await tester.pumpAndSettle (const Duration (seconds: 5 ));
81+ }
7982 }
80-
81- expect (find.byType (HomeScreen ), findsOneWidget);
8283 });
8384 });
8485}
0 commit comments