mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-26 08:02:34 +01:00
chore: add space add room test
Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
parent
ddb7cc841b
commit
aafa3b6998
@ -3,6 +3,7 @@ import 'package:fluffychat/pages/chat/chat_view.dart';
|
|||||||
import 'package:fluffychat/pages/chat_list/chat_list_body.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list_body.dart';
|
||||||
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
import 'package:fluffychat/pages/chat_list/search_title.dart';
|
||||||
import 'package:fluffychat/pages/invitation_selection/invitation_selection_view.dart';
|
import 'package:fluffychat/pages/invitation_selection/invitation_selection_view.dart';
|
||||||
|
import 'package:fluffychat/pages/new_group/new_group_view.dart';
|
||||||
import 'package:fluffychat/widgets/m2_popup_menu_button.dart';
|
import 'package:fluffychat/widgets/m2_popup_menu_button.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -119,7 +120,7 @@ void main() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
testWidgets('Spaces', (tester) async {
|
testWidgets('Space Settings', (tester) async {
|
||||||
app.main();
|
app.main();
|
||||||
await tester.ensureAppStartedHomescreen();
|
await tester.ensureAppStartedHomescreen();
|
||||||
|
|
||||||
@ -184,6 +185,60 @@ void main() {
|
|||||||
|
|
||||||
expect(find.text(Users.user2.name), findsOneWidget);
|
expect(find.text(Users.user2.name), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('Create room', (tester) async {
|
||||||
|
app.main();
|
||||||
|
await tester.ensureAppStartedHomescreen();
|
||||||
|
|
||||||
|
await tester.waitFor(find.text('New chat'));
|
||||||
|
await tester.tap(find.text('New chat'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
await tester.waitFor(find.text('Create new group'));
|
||||||
|
await tester.tap(find.text('Create new group'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
await tester.waitFor(
|
||||||
|
find.descendant(
|
||||||
|
of: find.byType(NewGroupView), matching: find.byType(TextField)),
|
||||||
|
);
|
||||||
|
await tester.enterText(
|
||||||
|
find.descendant(
|
||||||
|
of: find.byType(NewGroupView), matching: find.byType(TextField)),
|
||||||
|
'Test Group',
|
||||||
|
);
|
||||||
|
|
||||||
|
await Future.delayed(const Duration(milliseconds: 250));
|
||||||
|
await tester.testTextInput.receiveAction(TextInputAction.done);
|
||||||
|
|
||||||
|
await tester.inviteContactToGroup(Users.user2.name);
|
||||||
|
|
||||||
|
await tester.tap(find.byIcon(Icons.close_outlined));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
await tester.tap(find.byTooltip('Back'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('Add room to space', (tester) async {
|
||||||
|
app.main();
|
||||||
|
await tester.ensureAppStartedHomescreen();
|
||||||
|
|
||||||
|
await tester.waitFor(find.text('Test Group'));
|
||||||
|
await tester.longPress(find.text('Test Group'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
await tester.waitFor(find.byIcon(Icons.workspaces_outlined).first);
|
||||||
|
await tester.tap(find.byIcon(Icons.workspaces_outlined).first);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
await tester.waitFor(find.text('Test Space'));
|
||||||
|
await tester.tap(find.text('Test Space'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
await tester.waitFor(find.maybeUppercaseText('Ok'));
|
||||||
|
await tester.tap(find.maybeUppercaseText('Ok'));
|
||||||
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import 'dart:developer';
|
|||||||
|
|
||||||
import 'package:fluffychat/pages/chat_list/chat_list_body.dart';
|
import 'package:fluffychat/pages/chat_list/chat_list_body.dart';
|
||||||
import 'package:fluffychat/pages/homeserver_picker/homeserver_picker.dart';
|
import 'package:fluffychat/pages/homeserver_picker/homeserver_picker.dart';
|
||||||
|
import 'package:fluffychat/pages/invitation_selection/invitation_selection_view.dart';
|
||||||
import 'package:fluffychat/pages/settings_account/settings_account_view.dart';
|
import 'package:fluffychat/pages/settings_account/settings_account_view.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
@ -138,6 +139,42 @@ extension DefaultFlowExtensions on WidgetTester {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> inviteContactToGroup(String search) async {
|
||||||
|
final tester= this;
|
||||||
|
|
||||||
|
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)),
|
||||||
|
search,
|
||||||
|
);
|
||||||
|
|
||||||
|
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(search))
|
||||||
|
.last);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
await tester.waitFor(find.maybeUppercaseText('Yes'));
|
||||||
|
await tester.tap(find.maybeUppercaseText('Yes'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> ensureAppStartedHomescreen({
|
Future<void> ensureAppStartedHomescreen({
|
||||||
Duration timeout = const Duration(seconds: 20),
|
Duration timeout = const Duration(seconds: 20),
|
||||||
}) async {
|
}) async {
|
||||||
|
@ -93,7 +93,10 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||||||
void _loadHomeserverList() async {
|
void _loadHomeserverList() async {
|
||||||
try {
|
try {
|
||||||
final homeserverList =
|
final homeserverList =
|
||||||
await const JoinmatrixOrgParser().fetchHomeservers();
|
await Future(() => const JoinmatrixOrgParser().fetchHomeservers())
|
||||||
|
.timeout(
|
||||||
|
const Duration(seconds: 10),
|
||||||
|
);
|
||||||
final benchmark = await HomeserverListProvider.benchmarkHomeserver(
|
final benchmark = await HomeserverListProvider.benchmarkHomeserver(
|
||||||
homeserverList,
|
homeserverList,
|
||||||
timeout: const Duration(seconds: 10),
|
timeout: const Duration(seconds: 10),
|
||||||
@ -104,7 +107,10 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
|||||||
});
|
});
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logs().e('Homeserver benchmark failed', e, s);
|
Logs().e('Homeserver benchmark failed', e, s);
|
||||||
|
if (!mounted) return;
|
||||||
|
setState(() {
|
||||||
benchmarkResults = [];
|
benchmarkResults = [];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user