TF-3609 Add integration test for case display email address info dialog in EmailView
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../base/core_robot.dart';
|
||||
|
||||
class EmailAddressDialogRobot extends CoreRobot {
|
||||
EmailAddressDialogRobot(super.$);
|
||||
|
||||
Future<void> tapCloseDialogButton() async {
|
||||
await $(#email_address_dialog_close_button).tap();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/material_text_button.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/email_view_back_button.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
@@ -60,4 +62,18 @@ class EmailRobot extends CoreRobot {
|
||||
Future<void> tapArchiveMessageOptionInContextMenu() async {
|
||||
await $(#archiveMessage_action).tap();
|
||||
}
|
||||
|
||||
Future<void> tapSenderEmailAddress(String email) async {
|
||||
await $(MaterialTextButton)
|
||||
.which<MaterialTextButton>((widget) => widget.label.contains(email))
|
||||
.first
|
||||
.tap();
|
||||
}
|
||||
|
||||
Future<void> tapRecipientEmailAddress(String email) async {
|
||||
await $(TMailButtonWidget)
|
||||
.which<TMailButtonWidget>((widget) => widget.text.contains(email))
|
||||
.first
|
||||
.tap();
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
import '../../base/base_test_scenario.dart';
|
||||
import '../../models/provisioning_email.dart';
|
||||
import '../../robots/email_address_dialog_robot.dart';
|
||||
import '../../robots/email_robot.dart';
|
||||
import '../../robots/thread_robot.dart';
|
||||
|
||||
class DisplayEmailAddressInfoDialogScenario extends BaseTestScenario {
|
||||
|
||||
const DisplayEmailAddressInfoDialogScenario(super.$);
|
||||
|
||||
@override
|
||||
Future<void> runTestLogic() async {
|
||||
const subject = 'Email address info dialog';
|
||||
const emailUser = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||
final threadRobot = ThreadRobot($);
|
||||
final emailRobot = EmailRobot($);
|
||||
final emailAddressDialogRobot = EmailAddressDialogRobot($);
|
||||
final appLocalizations = AppLocalizations();
|
||||
|
||||
await provisionEmail(
|
||||
[
|
||||
ProvisioningEmail(
|
||||
toEmail: emailUser,
|
||||
subject: subject,
|
||||
content: subject,
|
||||
),
|
||||
],
|
||||
requestReadReceipt: false,
|
||||
);
|
||||
await $.pumpAndSettle();
|
||||
|
||||
await threadRobot.openEmailWithSubject(subject);
|
||||
await $.pumpAndSettle();
|
||||
|
||||
await emailRobot.tapSenderEmailAddress(emailUser);
|
||||
await $.pumpAndSettle();
|
||||
await _expectEmailAddressInfoDialogVisible(appLocalizations);
|
||||
|
||||
await emailAddressDialogRobot.tapCloseDialogButton();
|
||||
await $.pumpAndSettle();
|
||||
|
||||
await emailRobot.tapRecipientEmailAddress(emailUser);
|
||||
await $.pumpAndSettle();
|
||||
|
||||
await _expectEmailAddressInfoDialogVisible(appLocalizations);
|
||||
}
|
||||
|
||||
Future<void> _expectEmailAddressInfoDialogVisible(
|
||||
AppLocalizations appLocalizations,
|
||||
) async {
|
||||
await expectViewVisible($(appLocalizations.copy_email_address));
|
||||
await expectViewVisible($(appLocalizations.quickCreatingRule));
|
||||
await expectViewVisible($(appLocalizations.compose_email));
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import '../../../base/test_base.dart';
|
||||
import '../../../scenarios/email_detailed/display_email_address_info_dialog_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should see email address info dialog when open detailed email and click email address if sender or recipient',
|
||||
scenarioBuilder: ($) => DisplayEmailAddressInfoDialogScenario($),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user