TF-4053 Add E2E test for test case move folder content
This commit is contained in:
@@ -180,4 +180,12 @@ class MailboxMenuRobot extends CoreRobot {
|
|||||||
await $(AppLocalizations().mark_as_read).tap();
|
await $(AppLocalizations().mark_as_read).tap();
|
||||||
await $.pumpAndSettle();
|
await $.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> tapMoveFolderContentAction(String mailboxName) async {
|
||||||
|
await $(AppLocalizations().moveFolderContent).tap();
|
||||||
|
await $.pumpAndTrySettle();
|
||||||
|
|
||||||
|
await $(mailboxName).tap();
|
||||||
|
await $.pumpAndTrySettle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:model/extensions/presentation_mailbox_extension.dart';
|
||||||
|
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/trailing_mailbox_item_widget.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
import '../../base/base_test_scenario.dart';
|
||||||
|
import '../../models/provisioning_email.dart';
|
||||||
|
import '../../robots/mailbox_menu_robot.dart';
|
||||||
|
import '../../robots/thread_robot.dart';
|
||||||
|
|
||||||
|
class MoveFolderContentScenario extends BaseTestScenario {
|
||||||
|
const MoveFolderContentScenario(super.$);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> runTestLogic() async {
|
||||||
|
const email = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||||
|
const emailSubject = 'Move folder content';
|
||||||
|
|
||||||
|
final threadRobot = ThreadRobot($);
|
||||||
|
final mailboxMenuRobot = MailboxMenuRobot($);
|
||||||
|
final appLocalizations = AppLocalizations();
|
||||||
|
|
||||||
|
final listEmails = List.generate(
|
||||||
|
40,
|
||||||
|
(_) => ProvisioningEmail(
|
||||||
|
toEmail: email,
|
||||||
|
subject: emailSubject,
|
||||||
|
content: '',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
await provisionEmail(listEmails);
|
||||||
|
await $.pumpAndTrySettle(duration: const Duration(seconds: 2));
|
||||||
|
|
||||||
|
await threadRobot.openMailbox();
|
||||||
|
await $.pumpAndTrySettle();
|
||||||
|
_expectInboxUnreadCountVisible();
|
||||||
|
|
||||||
|
await mailboxMenuRobot.longPressMailboxWithName(
|
||||||
|
appLocalizations.inboxMailboxDisplayName,
|
||||||
|
);
|
||||||
|
await mailboxMenuRobot.tapMoveFolderContentAction(
|
||||||
|
appLocalizations.templatesMailboxDisplayName,
|
||||||
|
);
|
||||||
|
await $.pumpAndTrySettle(duration: const Duration(seconds: 3));
|
||||||
|
|
||||||
|
await threadRobot.openMailbox();
|
||||||
|
await $.pumpAndTrySettle();
|
||||||
|
await mailboxMenuRobot.openFolderByName(
|
||||||
|
appLocalizations.templatesMailboxDisplayName,
|
||||||
|
);
|
||||||
|
await $.pumpAndTrySettle();
|
||||||
|
await _expectEmailWithSubjectVisible(emailSubject);
|
||||||
|
|
||||||
|
await threadRobot.openMailbox();
|
||||||
|
await $.pumpAndTrySettle();
|
||||||
|
await mailboxMenuRobot.openFolderByName(
|
||||||
|
appLocalizations.inboxMailboxDisplayName,
|
||||||
|
);
|
||||||
|
await $.pumpAndTrySettle();
|
||||||
|
await _expectEmailWithSubjectInVisible(emailSubject);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectEmailWithSubjectVisible(String subject) async {
|
||||||
|
await expectViewVisible($(subject));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectEmailWithSubjectInVisible(String subject) async {
|
||||||
|
await expectViewInvisible($(subject));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _expectInboxUnreadCountVisible() {
|
||||||
|
expect(
|
||||||
|
$(TrailingMailboxItemWidget).which<TrailingMailboxItemWidget>((widget) {
|
||||||
|
final mailbox = widget.mailboxNode.item;
|
||||||
|
return mailbox.role == PresentationMailbox.roleInbox &&
|
||||||
|
mailbox.countUnreadEmails > 0;
|
||||||
|
}),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import '../../base/test_base.dart';
|
||||||
|
import '../../scenarios/mailbox/move_folder_content_scenario.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestBase().runPatrolTest(
|
||||||
|
description: 'Should see all Inbox emails in the Templates folder when perform move folder content action successfully',
|
||||||
|
scenarioBuilder: ($) => MoveFolderContentScenario($),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -56,6 +56,7 @@ typedef MovingMailboxActionCallback = void Function(PresentationMailbox mailboxS
|
|||||||
typedef OnMoveFolderContentActionCallback = void Function(
|
typedef OnMoveFolderContentActionCallback = void Function(
|
||||||
PresentationMailbox currentMailbox,
|
PresentationMailbox currentMailbox,
|
||||||
PresentationMailbox destinationMailbox,
|
PresentationMailbox destinationMailbox,
|
||||||
|
String destinationMailboxName,
|
||||||
);
|
);
|
||||||
typedef DeleteMailboxActionCallback = void Function(PresentationMailbox mailbox);
|
typedef DeleteMailboxActionCallback = void Function(PresentationMailbox mailbox);
|
||||||
typedef AllowSubaddressingActionCallback = void Function(MailboxId, Map<String, List<String>?>?, MailboxActions);
|
typedef AllowSubaddressingActionCallback = void Function(MailboxId, Map<String, List<String>?>?, MailboxActions);
|
||||||
@@ -643,7 +644,7 @@ abstract class BaseMailboxController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
void moveFolderContentAction({
|
void moveFolderContentAction({
|
||||||
required BuildContext context,
|
required AppLocalizations appLocalizations,
|
||||||
required AccountId accountId,
|
required AccountId accountId,
|
||||||
required Session session,
|
required Session session,
|
||||||
required PresentationMailbox mailboxSelected,
|
required PresentationMailbox mailboxSelected,
|
||||||
@@ -667,6 +668,7 @@ abstract class BaseMailboxController extends BaseController
|
|||||||
onMoveFolderContentAction(
|
onMoveFolderContentAction(
|
||||||
mailboxSelected,
|
mailboxSelected,
|
||||||
destinationMailbox,
|
destinationMailbox,
|
||||||
|
destinationMailbox.getDisplayNameWithoutContext(appLocalizations),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,11 +179,11 @@ mixin MailboxActionHandlerMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
baseMailboxController.moveFolderContentAction(
|
baseMailboxController.moveFolderContentAction(
|
||||||
context: context,
|
appLocalizations: AppLocalizations.of(context),
|
||||||
accountId: accountId,
|
accountId: accountId,
|
||||||
session: session,
|
session: session,
|
||||||
mailboxSelected: mailboxSelected,
|
mailboxSelected: mailboxSelected,
|
||||||
onMoveFolderContentAction: (currentMailbox, destinationMailbox) {
|
onMoveFolderContentAction: (currentMailbox, destinationMailbox, appLocalizations) {
|
||||||
baseMailboxController.consumeState(
|
baseMailboxController.consumeState(
|
||||||
mailboxActionReactor.moveFolderContent(
|
mailboxActionReactor.moveFolderContent(
|
||||||
session: session,
|
session: session,
|
||||||
@@ -192,8 +192,7 @@ mixin MailboxActionHandlerMixin {
|
|||||||
moveAction: MoveAction.moving,
|
moveAction: MoveAction.moving,
|
||||||
mailboxId: currentMailbox.id,
|
mailboxId: currentMailbox.id,
|
||||||
destinationMailboxId: destinationMailbox.id,
|
destinationMailboxId: destinationMailbox.id,
|
||||||
destinationMailboxDisplayName:
|
destinationMailboxDisplayName: appLocalizations,
|
||||||
destinationMailbox.getDisplayName(context),
|
|
||||||
markAsRead: destinationMailbox.isSpam,
|
markAsRead: destinationMailbox.isSpam,
|
||||||
totalEmails: currentMailbox.countTotalEmails,
|
totalEmails: currentMailbox.countTotalEmails,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -37,6 +37,33 @@ extension PresentationMailboxExtension on PresentationMailbox {
|
|||||||
return name?.name ?? '';
|
return name?.name ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getDisplayNameWithoutContext(AppLocalizations appLocalizations) {
|
||||||
|
if (isDefault) {
|
||||||
|
switch(role!.value.toLowerCase()) {
|
||||||
|
case PresentationMailbox.inboxRole:
|
||||||
|
return appLocalizations.inboxMailboxDisplayName;
|
||||||
|
case PresentationMailbox.archiveRole:
|
||||||
|
return appLocalizations.archiveMailboxDisplayName;
|
||||||
|
case PresentationMailbox.draftsRole:
|
||||||
|
return appLocalizations.draftsMailboxDisplayName;
|
||||||
|
case PresentationMailbox.sentRole:
|
||||||
|
return appLocalizations.sentMailboxDisplayName;
|
||||||
|
case PresentationMailbox.outboxRole:
|
||||||
|
return appLocalizations.outboxMailboxDisplayName;
|
||||||
|
case PresentationMailbox.trashRole:
|
||||||
|
return appLocalizations.trashMailboxDisplayName;
|
||||||
|
case PresentationMailbox.spamRole:
|
||||||
|
case PresentationMailbox.junkRole:
|
||||||
|
return appLocalizations.spamMailboxDisplayName;
|
||||||
|
case PresentationMailbox.templatesRole:
|
||||||
|
return appLocalizations.templatesMailboxDisplayName;
|
||||||
|
case PresentationMailbox.recoveredRole:
|
||||||
|
return appLocalizations.recoveredMailboxDisplayName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return name?.name ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
String getMailboxIcon(ImagePaths imagePaths) {
|
String getMailboxIcon(ImagePaths imagePaths) {
|
||||||
if (hasRole()) {
|
if (hasRole()) {
|
||||||
switch(role!.value) {
|
switch(role!.value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user