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 $.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($),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user