From ddb7cc841bc9fc020335b00a7934cc12e0dbb092 Mon Sep 17 00:00:00 2001 From: TheOneWithTheBraid Date: Fri, 13 Jan 2023 21:40:02 +0100 Subject: [PATCH] chore: add integration tests for spaces Signed-off-by: TheOneWithTheBraid --- integration_test/app_test.dart | 68 +++++++++++++++++++++++++ lib/pages/chat_list/chat_list_view.dart | 9 ---- lib/pages/new_space/new_space.dart | 2 +- 3 files changed, 69 insertions(+), 10 deletions(-) diff --git a/integration_test/app_test.dart b/integration_test/app_test.dart index 912e44cc..8007b9a8 100644 --- a/integration_test/app_test.dart +++ b/integration_test/app_test.dart @@ -2,6 +2,8 @@ import 'package:fluffychat/config/setting_keys.dart'; import 'package:fluffychat/pages/chat/chat_view.dart'; import 'package:fluffychat/pages/chat_list/chat_list_body.dart'; import 'package:fluffychat/pages/chat_list/search_title.dart'; +import 'package:fluffychat/pages/invitation_selection/invitation_selection_view.dart'; +import 'package:fluffychat/widgets/m2_popup_menu_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -116,6 +118,72 @@ void main() { await tester.pumpAndSettle(); }, ); + + testWidgets('Spaces', (tester) async { + app.main(); + await tester.ensureAppStartedHomescreen(); + + await tester.waitFor(find.byTooltip('Show menu')); + await tester.tap(find.byTooltip('Show menu')); + await tester.pumpAndSettle(); + + await tester.waitFor(find.byIcon(Icons.workspaces_outlined)); + await tester.tap(find.byIcon(Icons.workspaces_outlined)); + await tester.pumpAndSettle(); + + await tester.waitFor(find.byType(TextField)); + await tester.enterText(find.byType(TextField).last, 'Test Space'); + await tester.pumpAndSettle(); + + await tester.testTextInput.receiveAction(TextInputAction.done); + await tester.pumpAndSettle(); + + await tester.waitFor(find.text('Invite contact')); + + await tester.tap(find.text('Invite contact')); + await tester.pumpAndSettle(); + + await tester.waitFor( + find.descendant( + of: find.byType(InvitationSelectionView), + matching: find.byType(TextField)), + ); + await tester.enterText( + find.descendant( + of: find.byType(InvitationSelectionView), + matching: find.byType(TextField)), + Users.user2.name, + ); + + await Future.delayed(const Duration(milliseconds: 250)); + await tester.testTextInput.receiveAction(TextInputAction.done); + + await Future.delayed(const Duration(milliseconds: 1000)); + await tester.pumpAndSettle(); + + await tester.tap(find + .descendant( + of: find.descendant( + of: find.byType(InvitationSelectionView), + matching: find.byType(ListTile), + ), + matching: find.text(Users.user2.name)) + .last); + await tester.pumpAndSettle(); + + await tester.waitFor(find.maybeUppercaseText('Yes')); + await tester.tap(find.maybeUppercaseText('Yes')); + await tester.pumpAndSettle(); + + await tester.tap(find.byTooltip('Back')); + await tester.pumpAndSettle(); + + await tester.waitFor(find.text('Load 2 more participants')); + await tester.tap(find.text('Load 2 more participants')); + await tester.pumpAndSettle(); + + expect(find.text(Users.user2.name), findsOneWidget); + }); }, ); } diff --git a/lib/pages/chat_list/chat_list_view.dart b/lib/pages/chat_list/chat_list_view.dart index a3e42d9f..f86ca2b0 100644 --- a/lib/pages/chat_list/chat_list_view.dart +++ b/lib/pages/chat_list/chat_list_view.dart @@ -205,12 +205,3 @@ class ChatListView extends StatelessWidget { ); } } - -enum ChatListPopupMenuItemActions { - createGroup, - createSpace, - discover, - setStatus, - inviteContact, - settings, -} diff --git a/lib/pages/new_space/new_space.dart b/lib/pages/new_space/new_space.dart index 062b6336..071dd0ab 100644 --- a/lib/pages/new_space/new_space.dart +++ b/lib/pages/new_space/new_space.dart @@ -38,7 +38,7 @@ class NewSpaceController extends State { ), ); if (roomID.error == null) { - VRouter.of(context).toSegments(['rooms', roomID.result!, 'details']); + VRouter.of(context).toSegments(['spaces', roomID.result!]); } }