TF-4373 Add E2E test for test case delete thread to trash on mobile
This commit is contained in:
@@ -42,4 +42,17 @@ mixin SettingScenarioMixin on BaseScenario {
|
|||||||
) async {
|
) async {
|
||||||
await expectViewVisible($(find.text(appLocalizations.language)));
|
await expectViewVisible($(find.text(appLocalizations.language)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> goToSettingToEnableThread({
|
||||||
|
required ThreadRobot threadRobot,
|
||||||
|
required SettingRobot settingRobot,
|
||||||
|
required MailboxMenuRobot mailboxMenuRobot,
|
||||||
|
}) async {
|
||||||
|
await threadRobot.openMailbox();
|
||||||
|
await mailboxMenuRobot.openSetting();
|
||||||
|
await settingRobot.openPreferencesMenuItem();
|
||||||
|
await settingRobot.switchOnThreadSetting();
|
||||||
|
await settingRobot.backToSettingsFromFirstLevel();
|
||||||
|
await settingRobot.closeSettings();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,4 +95,8 @@ class EmailRobot extends CoreRobot {
|
|||||||
.$(InkWell)
|
.$(InkWell)
|
||||||
.tap();
|
.tap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> tapDeleteThreadButton() async {
|
||||||
|
await $(#delete_thread_button).tap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
import '../../base/base_test_scenario.dart';
|
||||||
|
import '../../mixin/generate_email_scenario_mixin.dart';
|
||||||
|
import '../../mixin/setting_scenario_mixin.dart';
|
||||||
|
import '../../robots/email_robot.dart';
|
||||||
|
import '../../robots/mailbox_menu_robot.dart';
|
||||||
|
import '../../robots/setting_robot.dart';
|
||||||
|
import '../../robots/thread_robot.dart';
|
||||||
|
|
||||||
|
class DeleteThreadToTrashScenario extends BaseTestScenario
|
||||||
|
with GenerateEmailScenarioMixin, SettingScenarioMixin {
|
||||||
|
const DeleteThreadToTrashScenario(super.$);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> runTestLogic() async {
|
||||||
|
const subject = 'Delete thread to trash';
|
||||||
|
const emailUser = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||||
|
|
||||||
|
final threadRobot = ThreadRobot($);
|
||||||
|
final settingRobot = SettingRobot($);
|
||||||
|
final mailboxMenuRobot = MailboxMenuRobot($);
|
||||||
|
final emailRobot = EmailRobot($);
|
||||||
|
final appLocalizations = AppLocalizations();
|
||||||
|
|
||||||
|
await goToSettingToEnableThread(
|
||||||
|
threadRobot: threadRobot,
|
||||||
|
settingRobot: settingRobot,
|
||||||
|
mailboxMenuRobot: mailboxMenuRobot,
|
||||||
|
);
|
||||||
|
|
||||||
|
await generateEmailWithSubject(emailUser: emailUser, subject: subject);
|
||||||
|
|
||||||
|
await threadRobot.openEmailWithSubject(subject);
|
||||||
|
await $.pumpAndSettle();
|
||||||
|
|
||||||
|
await emailRobot.tapDeleteThreadButton();
|
||||||
|
await $.pumpAndSettle();
|
||||||
|
|
||||||
|
await _expectDeleteThreadSuccessToast(appLocalizations);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectDeleteThreadSuccessToast(
|
||||||
|
AppLocalizations appLocalizations,
|
||||||
|
) async {
|
||||||
|
await expectViewVisible(
|
||||||
|
$(find.text(appLocalizations.moved_to_trash)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import '../../base/test_base.dart';
|
||||||
|
import '../../scenarios/email_detailed/delete_thread_to_trash_scenario.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestBase().runPatrolTest(
|
||||||
|
description:
|
||||||
|
'Should see toast message success when open detailed email and delete thread successfully',
|
||||||
|
scenarioBuilder: ($) => DeleteThreadToTrashScenario($),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -68,6 +68,7 @@ class ThreadDetailAppBar extends StatelessWidget {
|
|||||||
onTapActionCallback: (_) => onThreadActionClick?.call(EmailActionType.moveToMailbox),
|
onTapActionCallback: (_) => onThreadActionClick?.call(EmailActionType.moveToMailbox),
|
||||||
),
|
),
|
||||||
_ThreadDetailAppBarButton(
|
_ThreadDetailAppBarButton(
|
||||||
|
key: const Key('delete_thread_button'),
|
||||||
icon: imagePaths.icDeleteComposer,
|
icon: imagePaths.icDeleteComposer,
|
||||||
iconColor: threadDetailCanPermanentlyDelete
|
iconColor: threadDetailCanPermanentlyDelete
|
||||||
? AppColor.redFF3347
|
? AppColor.redFF3347
|
||||||
@@ -183,6 +184,7 @@ class ThreadDetailAppBar extends StatelessWidget {
|
|||||||
|
|
||||||
class _ThreadDetailAppBarButton extends StatelessWidget {
|
class _ThreadDetailAppBarButton extends StatelessWidget {
|
||||||
const _ThreadDetailAppBarButton({
|
const _ThreadDetailAppBarButton({
|
||||||
|
super.key,
|
||||||
required this.icon,
|
required this.icon,
|
||||||
required this.tooltipMessage,
|
required this.tooltipMessage,
|
||||||
required this.onTapActionCallback,
|
required this.onTapActionCallback,
|
||||||
|
|||||||
Reference in New Issue
Block a user