fixup! TF-3649 Fix reply to own sent email

This commit is contained in:
DatDang
2025-04-15 11:46:36 +07:00
committed by Dat H. Pham
parent 6cac72b09e
commit 43aee1d286
4 changed files with 64 additions and 1 deletions
-1
View File
@@ -12,7 +12,6 @@ Accepted
## Decision ## Decision
- PresentationEmailExtension._handleReply is modified
- When `isSender` is `true`, all "To" recipients will be kept - When `isSender` is `true`, all "To" recipients will be kept
## Consequences ## Consequences
@@ -198,4 +198,14 @@ mixin ScenarioUtilsMixin {
}, },
); );
} }
bool isMatchingEmailList(List<EmailAddress> emailList, Set<String> allowedEmails) {
if (emailList.length != allowedEmails.length) {
return false;
}
final Set<String> emails = emailList.map((e) => e.email).whereType<String>().toSet();
return emails.length == allowedEmails.length && emails.containsAll(allowedEmails);
}
} }
@@ -0,0 +1,45 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:model/email/prefix_email_address.dart';
import 'package:tmail_ui_user/features/composer/presentation/widgets/recipient_composer_widget.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
import '../../base/base_test_scenario.dart';
import '../../robots/email_robot.dart';
import '../../robots/mailbox_menu_robot.dart';
import '../../robots/thread_robot.dart';
import '../send_email_scenario.dart';
class ReplyToOwnSentEmailScenario extends BaseTestScenario {
const ReplyToOwnSentEmailScenario(super.$);
@override
Future<void> runTestLogic() async {
final threadRobot = ThreadRobot($);
final mailboxMenuRobot = MailboxMenuRobot($);
final emailRobot = EmailRobot($);
final sendEmailScenario = SendEmailScenario($);
final appLocalizations = AppLocalizations();
await sendEmailScenario.runTestLogic();
await threadRobot.openMailbox();
await mailboxMenuRobot.openFolderByName(
appLocalizations.sentMailboxDisplayName,
);
await threadRobot.openEmailWithSubject('Test subject');
await emailRobot.onTapReplyEmail();
_expectToFieldContainListEmailAddressCorrectly();
}
void _expectToFieldContainListEmailAddressCorrectly() {
expect(
$(RecipientComposerWidget).which<RecipientComposerWidget>((widget) =>
widget.prefix == PrefixEmailAddress.to &&
isMatchingEmailList(
widget.listEmailAddress,
{'bob@example.com', 'alice@example.com'}
)
).visible,
isTrue,
);
}
}
@@ -0,0 +1,9 @@
import '../../base/test_base.dart';
import '../../scenarios/email/reply_to_own_sent_email_scenario.dart';
void main() {
TestBase().runPatrolTest(
description: 'Should all To recipients when reply to own sent email',
scenarioBuilder: ($) => ReplyToOwnSentEmailScenario($),
);
}