TF-3579 E2E Mailbox mark as read
This commit is contained in:
@@ -175,4 +175,9 @@ class MailboxMenuRobot extends CoreRobot {
|
||||
Future<void> tapAddNewFolderButton() async {
|
||||
await $(#add_new_folder_button).tap();
|
||||
}
|
||||
|
||||
Future<void> tapMarkAsRead() async {
|
||||
await $(AppLocalizations().mark_as_read).tap();
|
||||
await $.pumpAndSettle();
|
||||
}
|
||||
}
|
||||
@@ -113,13 +113,18 @@ class ThreadRobot extends CoreRobot {
|
||||
}
|
||||
|
||||
Future<void> moveEmailToMailboxWithName(String mailboxName) async {
|
||||
await $(#move_selected_email_to_mailbox_button).tap();
|
||||
await $(#moreAction_selected_email_button).tap();
|
||||
await $.pumpAndTrySettle();
|
||||
|
||||
await $(#moveToMailbox_action).tap();
|
||||
await $.pumpAndTrySettle();
|
||||
|
||||
await $(mailboxName).tap();
|
||||
await $.pumpAndSettle();
|
||||
await $.pumpAndTrySettle();
|
||||
}
|
||||
|
||||
Future<void> moveEmailToTrash() async {
|
||||
await $(#delete_selected_email_button).tap();
|
||||
await $.pumpAndSettle();
|
||||
await $(#moveToTrash_selected_email_button).tap();
|
||||
await $.pumpAndTrySettle();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:model/extensions/presentation_mailbox_extension.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/trailing_mailbox_item_widget.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 MarkMailboxAsReadScenario extends BaseTestScenario {
|
||||
const MarkMailboxAsReadScenario(super.$);
|
||||
|
||||
@override
|
||||
Future<void> runTestLogic() async {
|
||||
const email = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||
|
||||
final threadRobot = ThreadRobot($);
|
||||
final mailboxMenuRobot = MailboxMenuRobot($);
|
||||
|
||||
await provisionEmail([ProvisioningEmail(
|
||||
toEmail: email,
|
||||
subject: 'placeholder email',
|
||||
content: ''
|
||||
)]);
|
||||
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||
await threadRobot.openMailbox();
|
||||
await $.pumpAndTrySettle();
|
||||
_expectInboxUnreadCountVisible();
|
||||
|
||||
await mailboxMenuRobot.longPressMailboxWithName(
|
||||
AppLocalizations().inboxMailboxDisplayName,
|
||||
);
|
||||
await mailboxMenuRobot.tapMarkAsRead();
|
||||
await threadRobot.openMailbox();
|
||||
await $.pumpAndTrySettle();
|
||||
_expectInboxUnreadCountInvisible();
|
||||
}
|
||||
|
||||
void _expectInboxUnreadCountVisible() {
|
||||
expect(
|
||||
$(TrailingMailboxItemWidget).which<TrailingMailboxItemWidget>((widget) {
|
||||
final mailbox = widget.mailboxNode.item;
|
||||
return mailbox.role == PresentationMailbox.roleInbox &&
|
||||
mailbox.countUnReadEmailsAsString.isNotEmpty;
|
||||
}),
|
||||
findsOneWidget,
|
||||
);
|
||||
}
|
||||
|
||||
void _expectInboxUnreadCountInvisible() {
|
||||
expect(
|
||||
$(TrailingMailboxItemWidget)
|
||||
.which<TrailingMailboxItemWidget>((widget) {
|
||||
final mailbox = widget.mailboxNode.item;
|
||||
return mailbox.role == PresentationMailbox.roleInbox
|
||||
&& mailbox.countUnReadEmailsAsString.isNotEmpty;
|
||||
}
|
||||
),
|
||||
findsNothing,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../scenarios/mailbox/mark_mailbox_as_read_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should not see unread counter when mark mailbox as read',
|
||||
scenarioBuilder: ($) => MarkMailboxAsReadScenario($),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user