c6ace7a9b5
E2E Fix integration test Twake Mail v0.18.4
91 lines
2.6 KiB
Dart
91 lines
2.6 KiB
Dart
|
|
import 'package:core/presentation/resources/image_paths.dart';
|
|
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
|
import 'package:core/presentation/views/text/text_field_builder.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/label_mailbox_item_widget.dart';
|
|
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/mailbox_item_widget.dart';
|
|
import 'package:tmail_ui_user/features/mailbox_creator/presentation/mailbox_creator_view.dart';
|
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart';
|
|
|
|
import '../base/core_robot.dart';
|
|
import '../exceptions/mailbox/null_inbox_unread_count_exception.dart';
|
|
|
|
class MailboxMenuRobot extends CoreRobot {
|
|
MailboxMenuRobot(super.$);
|
|
|
|
Future<void> openAppGrid() async {
|
|
await $(#toggle_app_grid_button).tap();
|
|
}
|
|
|
|
Future<void> openFolderByName(String name) async {
|
|
await $(MailboxItemWidget)
|
|
.$(LabelMailboxItemWidget)
|
|
.$(find.text(name))
|
|
.tap();
|
|
}
|
|
|
|
Future<void> openSetting() async {
|
|
await $(#user_avatar).tap();
|
|
}
|
|
|
|
Future<void> longPressMailboxWithName(String name) async {
|
|
await $(name).longPress();
|
|
await $.pumpAndSettle();
|
|
}
|
|
|
|
Future<void> tapCreateNewSubFolder() async {
|
|
await $(AppLocalizations().newSubfolder).tap();
|
|
}
|
|
|
|
Future<void> enterNewSubFolderName(String name) async {
|
|
await $(MailboxCreatorView)
|
|
.$(TextFieldBuilder)
|
|
.enterText(name);
|
|
}
|
|
|
|
Future<void> confirmCreateNewSubFolder() async {
|
|
await $(MailboxCreatorView)
|
|
.$(AppLocalizations().done)
|
|
.tap();
|
|
}
|
|
|
|
Future<void> expandMailboxWithName(String name) async {
|
|
await $(MailboxItemWidget)
|
|
.which<MailboxItemWidget>((widget) {
|
|
return widget.mailboxNode.item.name?.name.toLowerCase() ==
|
|
name.toLowerCase();
|
|
})
|
|
.$(TMailButtonWidget)
|
|
.which<TMailButtonWidget>((widget) {
|
|
return widget.icon == ImagePaths().icArrowRight;
|
|
})
|
|
.tap();
|
|
}
|
|
|
|
Future<void> tapHideMailbox() async {
|
|
await $(AppLocalizations().hideFolder).tap();
|
|
}
|
|
|
|
Future<void> closeMenu() async {
|
|
await $.native.swipe(from: const Offset(0.9, 0.5), to: const Offset(0, 0.5));
|
|
}
|
|
|
|
int getCurrentInboxCount() {
|
|
final inboxCount = Get.find<MailboxDashBoardController>()
|
|
.selectedMailbox
|
|
.value
|
|
?.unreadEmails
|
|
?.value
|
|
.value
|
|
.toInt();
|
|
|
|
if (inboxCount == null) {
|
|
throw NullInboxUnreadCountException();
|
|
}
|
|
|
|
return inboxCount;
|
|
}
|
|
} |