Merge branch 'main' into krille/implement-jitsi
This commit is contained in:
commit
19d8ceae03
14 changed files with 59 additions and 36 deletions
|
|
@ -1,9 +1,13 @@
|
|||
import 'package:fluffychat/pages/sign_in/view_model/model/public_homeserver_data.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../data/environment_constants.dart';
|
||||
import '../utils/fluffy_chat_tester.dart';
|
||||
|
||||
Future<void> finalLogout(WidgetTester widgetTester) =>
|
||||
widgetTester.startFluffyChatTest().then((tester) => tester.logout());
|
||||
|
||||
extension AuthFlows on FluffyChatTester {
|
||||
Future<void> login() async {
|
||||
await waitFor('Sign in');
|
||||
|
|
@ -18,6 +22,7 @@ extension AuthFlows on FluffyChatTester {
|
|||
}
|
||||
|
||||
Future<void> logout() async {
|
||||
await ensureLoggedIn();
|
||||
await tapOn(Key('accounts_and_settings_buttons'));
|
||||
await tapOn('Settings');
|
||||
await scrollUntilVisible('Logout');
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||
import 'package:fluffychat/widgets/chat_settings_popup_menu.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../utils/fluffy_chat_tester.dart';
|
||||
import 'auth_flows.dart';
|
||||
import 'chat_flows.dart';
|
||||
|
||||
Future<void> basicMessaging(WidgetTester widgetTester) => widgetTester
|
||||
.startFluffyChatTest()
|
||||
|
|
@ -12,31 +11,13 @@ Future<void> basicMessaging(WidgetTester widgetTester) => widgetTester
|
|||
|
||||
extension on FluffyChatTester {
|
||||
Future<void> _basicMessaging() async {
|
||||
final shouldLogout = await ensureLoggedIn();
|
||||
await ensureLoggedIn();
|
||||
await ensureGroupChatCreated();
|
||||
|
||||
// Create a new group chat
|
||||
await tapOn(FloatingActionButton);
|
||||
await tapOn('Create group');
|
||||
await enterText(TextField, 'Test Group 01');
|
||||
await tapOn('Create a group and invite users');
|
||||
await waitFor('Invite contact');
|
||||
await goBack();
|
||||
|
||||
// Send a message
|
||||
await tapOn(ChatFlows.groupChatName);
|
||||
const testMessage = 'Hello from integration test!';
|
||||
await enterText(Key('chat_input_field'), testMessage);
|
||||
await tapOn(Key('send_button'));
|
||||
|
||||
// Ensure message is visible
|
||||
await waitFor(testMessage);
|
||||
|
||||
// Archive the chat
|
||||
await tapOn(ChatSettingsPopupMenu);
|
||||
await tapOn('Leave');
|
||||
await waitFor('Are you sure?');
|
||||
await tapOn('Leave');
|
||||
await waitFor(ChatList);
|
||||
|
||||
if (shouldLogout) await logout();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
35
integration_test/flows/chat_flows.dart
Normal file
35
integration_test/flows/chat_flows.dart
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import 'package:fluffychat/pages/chat_list/chat_list.dart';
|
||||
import 'package:fluffychat/widgets/chat_settings_popup_menu.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../utils/fluffy_chat_tester.dart';
|
||||
import 'auth_flows.dart';
|
||||
|
||||
Future<void> archiveChats(WidgetTester widgetTester) =>
|
||||
widgetTester.startFluffyChatTest().then((tester) => tester._archiveChats());
|
||||
|
||||
extension ChatFlows on FluffyChatTester {
|
||||
static const String groupChatName = 'Test Group 01';
|
||||
|
||||
Future<void> ensureGroupChatCreated() async {
|
||||
if (await isVisible(groupChatName)) return;
|
||||
await tapOn(FloatingActionButton);
|
||||
await tapOn('Create group');
|
||||
await enterText(TextField, groupChatName);
|
||||
await tapOn('Create a group and invite users');
|
||||
await waitFor('Invite contact');
|
||||
await goBack();
|
||||
await goBack();
|
||||
}
|
||||
|
||||
Future<void> _archiveChats() async {
|
||||
await ensureLoggedIn();
|
||||
await ensureGroupChatCreated();
|
||||
await tapOn(ChatSettingsPopupMenu);
|
||||
await tapOn('Leave');
|
||||
await waitFor('Are you sure?');
|
||||
await tapOn('Leave');
|
||||
await waitFor(ChatList);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,9 @@
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
|
||||
import 'flows/auth_flows.dart';
|
||||
import 'flows/basic_messaging.dart';
|
||||
import 'flows/chat_flows.dart';
|
||||
import 'flows/login_and_chat_backup.dart';
|
||||
|
||||
void main() {
|
||||
|
|
@ -10,5 +12,7 @@ void main() {
|
|||
group('FluffyChat Integration Tests', () {
|
||||
testWidgets('Login and logout flow', loginAndChatBackup);
|
||||
testWidgets('Basic Messaging', basicMessaging);
|
||||
testWidgets('Archive chats', archiveChats);
|
||||
testWidgets('Final logout', finalLogout);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,10 +67,7 @@ extension type FluffyChatTester(WidgetTester tester) {
|
|||
await tester.pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> goBack() async {
|
||||
_print('🔙 Going a page back');
|
||||
await tester.pageBack();
|
||||
}
|
||||
Future<void> goBack() => tapOn(find.byTooltip('Back'));
|
||||
|
||||
Future<void> enterText(Object object, String text, {int? index}) async {
|
||||
final finder = await _ensureVisible(object, index: index);
|
||||
|
|
|
|||
|
|
@ -2807,4 +2807,4 @@
|
|||
"skipSupportingFluffyChat": "FluffyChat unterstützen überspringen",
|
||||
"iDoNotWantToSupport": "Ich möchte nicht unterstützen",
|
||||
"iAlreadySupportFluffyChat": "I unterstütze FluffyChat bereits"
|
||||
}
|
||||
}
|
||||
|
|
@ -2790,7 +2790,6 @@
|
|||
"iAlreadySupportFluffyChat": "I already support FluffyChat",
|
||||
"setLowPriority": "Set low priority",
|
||||
"unsetLowPriority": "Unset low priority",
|
||||
"jitsiGroupCalls": "Jitsi group calls",
|
||||
"removeCallFromChat": "Remove call from chat",
|
||||
"removeCallFromChatDescription": "Do you want to remove the call from the chat for all members?",
|
||||
"removeCallForEveryone": "Remove call for everyone",
|
||||
|
|
@ -2799,4 +2798,4 @@
|
|||
"joinVoiceCall": "Join voice call",
|
||||
"joinVideoCall": "Join video call",
|
||||
"live": "Live"
|
||||
}
|
||||
}
|
||||
|
|
@ -2801,4 +2801,4 @@
|
|||
"iDoNotWantToSupport": "Ma ei soovi toetada",
|
||||
"setLowPriority": "Märgi vähetähtsaks",
|
||||
"unsetLowPriority": "Eemalda märkimine vähetähtsaks"
|
||||
}
|
||||
}
|
||||
|
|
@ -2807,4 +2807,4 @@
|
|||
"iAlreadySupportFluffyChat": "Tacaím le FluffyChat cheana féin",
|
||||
"setLowPriority": "Socraigh tosaíocht íseal",
|
||||
"unsetLowPriority": "Díshuiteáil tosaíocht íseal"
|
||||
}
|
||||
}
|
||||
|
|
@ -2801,4 +2801,4 @@
|
|||
"iAlreadySupportFluffyChat": "Xa apoiei a FluffyChat",
|
||||
"setLowPriority": "Establecer prioridade baixa",
|
||||
"unsetLowPriority": "Non establecer prioridade baixa"
|
||||
}
|
||||
}
|
||||
|
|
@ -2808,4 +2808,4 @@
|
|||
"iAlreadySupportFluffyChat": "Jeg støtter allerede FluffyChat",
|
||||
"setLowPriority": "Sett lav prioritet",
|
||||
"unsetLowPriority": "Fjern lav prioritet"
|
||||
}
|
||||
}
|
||||
|
|
@ -2800,4 +2800,4 @@
|
|||
"support": "Steunen",
|
||||
"setLowPriority": "Lage prioriteit instellen",
|
||||
"unsetLowPriority": "Lage prioriteit uitschakelen"
|
||||
}
|
||||
}
|
||||
|
|
@ -2801,4 +2801,4 @@
|
|||
"iAlreadySupportFluffyChat": "我已支持 FluffyChat",
|
||||
"setLowPriority": "设置低优先级",
|
||||
"unsetLowPriority": "取消设置低优先级"
|
||||
}
|
||||
}
|
||||
|
|
@ -553,6 +553,7 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
timeline?.cancelSubscriptions();
|
||||
timeline = null;
|
||||
inputFocus.removeListener(_inputFocusListener);
|
||||
if (currentlyTyping) room.setTyping(false);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
|
@ -1289,6 +1290,7 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
if (AppSettings.sendTypingNotifications.value) {
|
||||
typingCoolDown?.cancel();
|
||||
typingCoolDown = Timer(const Duration(seconds: 2), () {
|
||||
if (!mounted) return;
|
||||
typingCoolDown = null;
|
||||
currentlyTyping = false;
|
||||
room.setTyping(false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue