TF-3570 Add integration test for case archive email in EmailView
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -56,4 +56,8 @@ class EmailRobot extends CoreRobot {
|
||||
Future<void> tapMarkAsSpamOptionInContextMenu() async {
|
||||
await $(#moveToSpam_action).tap();
|
||||
}
|
||||
|
||||
Future<void> tapArchiveMessageOptionInContextMenu() async {
|
||||
await $(#archiveMessage_action).tap();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
import '../../base/base_test_scenario.dart';
|
||||
import '../../models/provisioning_email.dart';
|
||||
import '../../robots/email_robot.dart';
|
||||
import '../../robots/mailbox_menu_robot.dart';
|
||||
import '../../robots/thread_robot.dart';
|
||||
|
||||
class ArchiveEmailScenario extends BaseTestScenario {
|
||||
|
||||
const ArchiveEmailScenario(super.$);
|
||||
|
||||
@override
|
||||
Future<void> runTestLogic() async {
|
||||
const subject = 'Archive email';
|
||||
const emailUser = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||
final threadRobot = ThreadRobot($);
|
||||
final emailRobot = EmailRobot($);
|
||||
final mailboxMenuRobot = MailboxMenuRobot($);
|
||||
final appLocalizations = AppLocalizations();
|
||||
|
||||
await provisionEmail(
|
||||
[
|
||||
ProvisioningEmail(
|
||||
toEmail: emailUser,
|
||||
subject: subject,
|
||||
content: subject,
|
||||
),
|
||||
],
|
||||
requestReadReceipt: false,
|
||||
);
|
||||
await $.pumpAndSettle();
|
||||
|
||||
await threadRobot.openEmailWithSubject(subject);
|
||||
await $.pumpAndSettle();
|
||||
_expectEmailDetailedMoreButtonVisible();
|
||||
|
||||
await emailRobot.tapEmailDetailedMoreButton();
|
||||
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||
|
||||
await emailRobot.tapArchiveMessageOptionInContextMenu();
|
||||
await $.pumpAndSettle(duration: const Duration(seconds: 3));
|
||||
|
||||
await emailRobot.onTapBackButton();
|
||||
await $.pumpAndSettle();
|
||||
|
||||
await threadRobot.openMailbox();
|
||||
await mailboxMenuRobot.openFolderByName(appLocalizations.archiveMailboxDisplayName);
|
||||
await _expectEmailWithSubjectInArchiveFolderVisible(subject);
|
||||
}
|
||||
|
||||
void _expectEmailDetailedMoreButtonVisible() {
|
||||
expect($(#email_detailed_more_button), findsOneWidget);
|
||||
}
|
||||
|
||||
Future<void> _expectEmailWithSubjectInArchiveFolderVisible(String subject) async {
|
||||
await expectViewVisible($(subject));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../scenarios/email_detailed/archive_email_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should see email in Archive folder when open detailed email and archive email successfully',
|
||||
scenarioBuilder: ($) => ArchiveEmailScenario($),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user