refactor: Switch from maestro to flutter integration tests

This commit is contained in:
Christian Kußowski 2026-03-19 16:25:20 +01:00
commit 0a42f28cf1
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
34 changed files with 495 additions and 727 deletions

View file

@ -0,0 +1,44 @@
import 'package:fluffychat/pages/sign_in/view_model/model/public_homeserver_data.dart';
import 'package:flutter/material.dart';
import '../data/environment_constants.dart';
import '../utils/fluffy_chat_tester.dart';
extension AuthFlows on FluffyChatTester {
Future<void> login() async {
await waitFor('Sign in');
await tapOn('Sign in');
await enterText(TextField, 'http://$homeserver', index: 0);
await tapOn(RadioListTile<PublicHomeserverData>, index: 0);
await tapOn('Continue');
await waitFor('Log in to http://$homeserver');
await enterText(TextField, user1Name, index: 0);
await enterText(TextField, user1Pw, index: 1);
await tapOn('Login');
}
Future<void> logout() async {
await tapOn(Key('accounts_and_settings_buttons'));
await tapOn('Settings');
await scrollUntilVisible('Logout');
await tapOn('Logout');
await tapOn(Key('ok_cancel_alert_dialog_ok_button'));
await waitFor('Sign in');
}
Future<void> skipNoNotificationsDialog() async {
if (await isVisible('Push notifications not available')) {
await tapOn('Do not show again');
}
}
Future<bool> ensureLoggedIn() async {
if (await isVisible('Sign in') == false) return false;
await login();
await tapOn(CloseButton);
await tapOn('Skip');
await skipNoNotificationsDialog();
return true;
}
}

View file

@ -0,0 +1,42 @@
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> basicMessaging(WidgetTester widgetTester) => widgetTester
.startFluffyChatTest()
.then((tester) => tester._basicMessaging());
extension on FluffyChatTester {
Future<void> _basicMessaging() async {
final shouldLogout = await ensureLoggedIn();
// 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
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();
}
}

View file

@ -0,0 +1,23 @@
import 'package:flutter_test/flutter_test.dart';
import '../utils/fluffy_chat_tester.dart';
import 'auth_flows.dart';
Future<void> loginAndChatBackup(WidgetTester widgetTester) => widgetTester
.startFluffyChatTest()
.then((tester) => tester._loginAndChatBackup());
extension on FluffyChatTester {
Future<void> _loginAndChatBackup() async {
await login();
// Skip bootstrap
await tapOn('Copy to clipboard');
await tapOn('Next');
await tapOn('Close');
await skipNoNotificationsDialog();
await logout();
}
}