TF-3611 E2E Trash mailbox empty and recover
This commit is contained in:
@@ -125,4 +125,16 @@ class MailboxMenuRobot extends CoreRobot {
|
|||||||
getBinding<QuotasController>()?.reloadQuota();
|
getBinding<QuotasController>()?.reloadQuota();
|
||||||
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> tapRecoverDeletedMessages() async {
|
||||||
|
await $(AppLocalizations().recoverDeletedMessages).tap();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> tapConfirmRecoverDeletedMessages() async {
|
||||||
|
if (await $.native.isPermissionDialogVisible(timeout: const Duration(seconds: 2))) {
|
||||||
|
await $.native.grantPermissionWhenInUse();
|
||||||
|
}
|
||||||
|
await $(AppLocalizations().restore).tap();
|
||||||
|
await $.pumpAndSettle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -82,4 +82,8 @@ class ThreadRobot extends CoreRobot {
|
|||||||
await $(name).tap();
|
await $(name).tap();
|
||||||
await $.pumpAndSettle();
|
await $.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> confirmEmptyTrash() async {
|
||||||
|
await $(AppLocalizations().delete_all).tap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||||
|
import 'package:tmail_ui_user/features/base/widget/clean_messages_banner.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 EmptyAndRecoverTrashScenario extends BaseTestScenario {
|
||||||
|
const EmptyAndRecoverTrashScenario(super.$);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> runTestLogic() async {
|
||||||
|
const toEmail = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||||
|
const subject = 'trash and recover';
|
||||||
|
|
||||||
|
final threadRobot = ThreadRobot($);
|
||||||
|
final mailboxMenuRobot = MailboxMenuRobot($);
|
||||||
|
final appLocalizations = AppLocalizations();
|
||||||
|
|
||||||
|
await provisionEmail(
|
||||||
|
[ProvisioningEmail(
|
||||||
|
toEmail: toEmail,
|
||||||
|
subject: subject,
|
||||||
|
content: '',
|
||||||
|
)],
|
||||||
|
folderLocationRole: PresentationMailbox.roleTrash,
|
||||||
|
);
|
||||||
|
|
||||||
|
await threadRobot.openMailbox();
|
||||||
|
await mailboxMenuRobot.openFolderByName(
|
||||||
|
appLocalizations.trashMailboxDisplayName,
|
||||||
|
);
|
||||||
|
await threadRobot.tapEmptyTrashBanner();
|
||||||
|
await threadRobot.confirmEmptyTrash();
|
||||||
|
await _expectTrashBannerInvisible();
|
||||||
|
|
||||||
|
await threadRobot.openMailbox();
|
||||||
|
await mailboxMenuRobot.longPressMailboxWithName(
|
||||||
|
appLocalizations.trashMailboxDisplayName,
|
||||||
|
);
|
||||||
|
await mailboxMenuRobot.tapRecoverDeletedMessages();
|
||||||
|
await mailboxMenuRobot.tapConfirmRecoverDeletedMessages();
|
||||||
|
await threadRobot.openMailbox();
|
||||||
|
await mailboxMenuRobot.openFolderByName(
|
||||||
|
appLocalizations.recoveredMailboxDisplayName,
|
||||||
|
);
|
||||||
|
await _expectEmailWithSubjectVisible(subject);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectTrashBannerInvisible() async {
|
||||||
|
await $(#clean_message_banner_not_visible).waitUntilExists();
|
||||||
|
expect($(CleanMessagesBanner).visible, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectEmailWithSubjectVisible(String subject) async {
|
||||||
|
await expectViewVisible($(subject));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import '../../base/test_base.dart';
|
||||||
|
import '../../scenarios/mailbox/empty_and_recover_trash_scenario.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestBase().runPatrolTest(
|
||||||
|
description: 'Should empty and recover trash successfully',
|
||||||
|
scenarioBuilder: ($) => EmptyAndRecoverTrashScenario($),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -237,7 +237,9 @@ class ThreadView extends GetWidget<ThreadController>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink(
|
||||||
|
key: Key('clean_message_banner_not_visible'),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
if (!controller.responsiveUtils.isDesktop(context))
|
if (!controller.responsiveUtils.isDesktop(context))
|
||||||
|
|||||||
Reference in New Issue
Block a user