Add E2E test for case show full recipient field when expand all

This commit is contained in:
dab246
2025-11-20 10:47:35 +07:00
committed by Dat H. Pham
parent 6f6284c21f
commit 2fe9021c7f
14 changed files with 90 additions and 3 deletions
+5 -1
View File
@@ -121,10 +121,14 @@ class ComposerRobot extends CoreRobot {
await $(#save_as_draft_popup_item).tap();
}
Future<void> tapRecipientExpandButton() async {
Future<void> tapToRecipientExpandButton() async {
await $(#prefix_to_recipient_expand_button).tap();
}
Future<void> tapCcRecipientExpandButton() async {
await $(#prefix_cc_recipient_expand_button).tap();
}
Future<void> tapFromFieldPopupMenu() async {
await $(FromComposerMobileWidget).$(InkWell).tap();
}
@@ -55,7 +55,7 @@ class ChangeIdentityInDraftEmailScenario extends BaseTestScenario {
await composerRobot.addSubject(subject);
await composerRobot.addContent(subject);
await composerRobot.tapRecipientExpandButton();
await composerRobot.tapToRecipientExpandButton();
await $.pumpAndSettle();
await _expectIdentityVisible(identity1);
@@ -81,7 +81,7 @@ class ChangeIdentityInDraftEmailScenario extends BaseTestScenario {
await composerRobot.grantContactPermission();
await composerRobot.tapRecipientExpandButton();
await composerRobot.tapToRecipientExpandButton();
await $.pumpAndSettle();
await _expectIdentityVisible(identity2);
}
@@ -0,0 +1,73 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:model/email/prefix_email_address.dart';
import 'package:tmail_ui_user/features/composer/presentation/composer_view.dart';
import '../../base/base_test_scenario.dart';
import '../../robots/composer_robot.dart';
import '../../robots/thread_robot.dart';
class ShowFullRecipientFieldsWhenExpandAllScenario extends BaseTestScenario {
const ShowFullRecipientFieldsWhenExpandAllScenario(super.$);
@override
Future<void> runTestLogic() async {
const email = String.fromEnvironment('BASIC_AUTH_EMAIL');
const subject = 'Show full recipient fields';
final threadRobot = ThreadRobot($);
final composerRobot = ComposerRobot($);
await threadRobot.openComposer();
await _expectComposerViewVisible();
await composerRobot.grantContactPermission();
await $.pumpAndTrySettle();
await composerRobot.tapToRecipientExpandButton();
await _expectAllRecipientFieldsVisible();
await composerRobot.addRecipientIntoField(
prefixEmailAddress: PrefixEmailAddress.cc,
email: email,
);
await composerRobot.addSubject(subject);
await _expectAllRecipientFieldsInvisible();
await $.pumpAndTrySettle();
await composerRobot.expandRecipientsFields();
await composerRobot.tapCcRecipientExpandButton();
await _expectAllRecipientFieldsVisible();
}
Future<void> _expectComposerViewVisible() =>
expectViewVisible($(ComposerView));
Future<void> _expectAllRecipientFieldsVisible() async {
await expectViewVisible(
$(#prefix_to_recipient_composer_widget),
);
await expectViewVisible(
$(#prefix_cc_recipient_composer_widget),
);
await expectViewVisible(
$(#prefix_bcc_recipient_composer_widget),
);
await expectViewVisible(
$(#prefix_replyTo_recipient_composer_widget),
);
}
Future<void> _expectAllRecipientFieldsInvisible() async {
await expectViewInvisible(
$(#prefix_to_recipient_composer_widget),
);
await expectViewInvisible(
$(#prefix_cc_recipient_composer_widget),
);
await expectViewInvisible(
$(#prefix_bcc_recipient_composer_widget),
);
await expectViewInvisible(
$(#prefix_replyTo_recipient_composer_widget),
);
}
}
@@ -0,0 +1,10 @@
import '../../base/test_base.dart';
import '../../scenarios/composer/show_full_recipient_fields_when_expand_all_scenario.dart';
void main() {
TestBase().runPatrolTest(
description:
'Should see all recipient fields when expand all recipients in composer',
scenarioBuilder: ($) => ShowFullRecipientFieldsWhenExpandAllScenario($),
);
}