Skip to content

Commit 19b541f

Browse files
committed
Add tests
1 parent bf8715a commit 19b541f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

packages/features/landing_page_screen/test/widget/landing_page_test.dart

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,38 @@ void main() {
137137
},
138138
);
139139

140+
testWidgets(
141+
'Should open PocketPaint widget trough edit icon and return back to Landing page',
142+
(tester) async {
143+
when(database.projectDAO).thenReturn(dao);
144+
when(dao.getProjects()).thenAnswer((_) => Future.value([]));
145+
await tester.pumpWidget(sut);
146+
await tester.pumpAndSettle();
147+
verify(database.projectDAO);
148+
verify(dao.getProjects());
149+
150+
final editButton = find.byKey(const Key('myEditIcon'));
151+
await tester.tap(editButton);
152+
await tester.pumpAndSettle();
153+
154+
expect(find.byType(TopAppBar), findsOneWidget);
155+
expect(find.byType(NavigationBar), findsOneWidget);
156+
157+
final titleFinder = find.widgetWithText(TopAppBar, 'Pocket Paint');
158+
expect(titleFinder, findsOneWidget);
159+
160+
final overflowMenuButtonFinder = find.widgetWithIcon(
161+
PopupMenuButton<OverflowMenuOption>,
162+
Icons.more_vert,
163+
);
164+
expect(overflowMenuButtonFinder, findsOneWidget);
165+
166+
await tester.pageBack();
167+
await tester.pumpAndSettle();
168+
expect(find.text('My Projects'), findsOneWidget);
169+
},
170+
);
171+
140172
testWidgets(
141173
'Should have "My Projects" section',
142174
(tester) async {

0 commit comments

Comments
 (0)