TF-3570 Add integration test for case mark as spam email in EmailView
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -52,4 +52,8 @@ class EmailRobot extends CoreRobot {
|
|||||||
Future<void> tapEmailDetailedDeleteEmailButton() async {
|
Future<void> tapEmailDetailedDeleteEmailButton() async {
|
||||||
await $(#email_detailed_delete_email_button).tap();
|
await $(#email_detailed_delete_email_button).tap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> tapMarkAsSpamOptionInContextMenu() async {
|
||||||
|
await $(#moveToSpam_action).tap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -44,14 +44,14 @@ class DeleteEmailScenario extends BaseTestScenario {
|
|||||||
|
|
||||||
await threadRobot.openMailbox();
|
await threadRobot.openMailbox();
|
||||||
await mailboxMenuRobot.openFolderByName(appLocalizations.trashMailboxDisplayName);
|
await mailboxMenuRobot.openFolderByName(appLocalizations.trashMailboxDisplayName);
|
||||||
await _expectEmailWithSubjectInDestinationFolderVisible(subject);
|
await _expectEmailWithSubjectInTrashFolderVisible(subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _expectEmailViewInvisible() {
|
void _expectEmailViewInvisible() {
|
||||||
expect($(EmailView).visible, isFalse);
|
expect($(EmailView).visible, isFalse);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _expectEmailWithSubjectInDestinationFolderVisible(String subject) async {
|
Future<void> _expectEmailWithSubjectInTrashFolderVisible(String subject) async {
|
||||||
await expectViewVisible($(subject));
|
await expectViewVisible($(subject));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/email_view.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 MarkAsSpamEmailScenario extends BaseTestScenario {
|
||||||
|
|
||||||
|
const MarkAsSpamEmailScenario(super.$);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> runTestLogic() async {
|
||||||
|
const subject = 'Mark as spam 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.tapMarkAsSpamOptionInContextMenu();
|
||||||
|
await $.pumpAndSettle(duration: const Duration(seconds: 3));
|
||||||
|
_expectEmailViewInvisible();
|
||||||
|
|
||||||
|
await threadRobot.openMailbox();
|
||||||
|
await mailboxMenuRobot.openFolderByName(appLocalizations.spamMailboxDisplayName);
|
||||||
|
await _expectEmailWithSubjectInSpamFolderVisible(subject);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _expectEmailDetailedMoreButtonVisible() {
|
||||||
|
expect($(#email_detailed_more_button), findsOneWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _expectEmailViewInvisible() {
|
||||||
|
expect($(EmailView).visible, isFalse);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectEmailWithSubjectInSpamFolderVisible(String subject) async {
|
||||||
|
await expectViewVisible($(subject));
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
import '../../base/test_base.dart';
|
||||||
|
import '../../scenarios/email_detailed/mark_as_spam_email_scenario.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestBase().runPatrolTest(
|
||||||
|
description: 'Should see email in Spam folder when open detailed email and mark as spam email successfully',
|
||||||
|
scenarioBuilder: ($) => MarkAsSpamEmailScenario($),
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user