TF-3570 Add integration test for case move email to folder in EmailView
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
|
||||
import 'package:flutter_test/flutter_test.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 '../base/core_robot.dart';
|
||||
|
||||
class DestinationPickerRobot extends CoreRobot {
|
||||
DestinationPickerRobot(super.$);
|
||||
|
||||
Future<void> selectFolderByName(String name) async {
|
||||
await $(MailboxItemWidget)
|
||||
.$(LabelMailboxItemWidget)
|
||||
.$(find.text(name))
|
||||
.tap();
|
||||
}
|
||||
}
|
||||
@@ -44,4 +44,8 @@ class EmailRobot extends CoreRobot {
|
||||
Future<void> tapEmailDetailedStarButton() async {
|
||||
await $(#email_detailed_star_button).tap();
|
||||
}
|
||||
|
||||
Future<void> tapEmailDetailedMoveEmailButton() async {
|
||||
await $(#email_detailed_move_email_button).tap();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
|
||||
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/destination_picker_robot.dart';
|
||||
import '../../robots/email_robot.dart';
|
||||
import '../../robots/mailbox_menu_robot.dart';
|
||||
import '../../robots/thread_robot.dart';
|
||||
|
||||
class MoveEmailToFolderScenario extends BaseTestScenario {
|
||||
|
||||
const MoveEmailToFolderScenario(super.$);
|
||||
|
||||
@override
|
||||
Future<void> runTestLogic() async {
|
||||
const subject = 'Move email to folder';
|
||||
const emailUser = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||
final threadRobot = ThreadRobot($);
|
||||
final emailRobot = EmailRobot($);
|
||||
final mailboxMenuRobot = MailboxMenuRobot($);
|
||||
final destinationPickerRobot = DestinationPickerRobot($);
|
||||
final appLocalizations = AppLocalizations();
|
||||
|
||||
await provisionEmail(
|
||||
[
|
||||
ProvisioningEmail(
|
||||
toEmail: emailUser,
|
||||
subject: subject,
|
||||
content: subject,
|
||||
),
|
||||
],
|
||||
requestReadReceipt: false,
|
||||
);
|
||||
await $.pumpAndSettle();
|
||||
|
||||
await threadRobot.openEmailWithSubject(subject);
|
||||
await $.pumpAndSettle();
|
||||
|
||||
await emailRobot.tapEmailDetailedMoveEmailButton();
|
||||
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||
|
||||
await destinationPickerRobot.selectFolderByName(appLocalizations.templatesMailboxDisplayName);
|
||||
await $.pumpAndSettle(duration: const Duration(seconds: 3));
|
||||
_expectEmailWithSubjectInCurrentFolderInvisible(subject);
|
||||
|
||||
await threadRobot.openMailbox();
|
||||
await mailboxMenuRobot.openFolderByName(appLocalizations.templatesMailboxDisplayName);
|
||||
await _expectEmailWithSubjectInDestinationFolderVisible(subject);
|
||||
}
|
||||
|
||||
void _expectEmailWithSubjectInCurrentFolderInvisible(String subject) {
|
||||
expect($(subject), findsNothing);
|
||||
}
|
||||
|
||||
Future<void> _expectEmailWithSubjectInDestinationFolderVisible(String subject) async {
|
||||
await expectViewVisible($(subject));
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../scenarios/email_detailed/move_email_to_folder_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should see email in destination folder when open detailed email and move email to destination folder successfully',
|
||||
scenarioBuilder: ($) => MoveEmailToFolderScenario($),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user