TF-3563 Add integration test for case download attachment in EmailView
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/widgets/attachment_item_widget.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/email_view_back_button.dart';
|
import 'package:tmail_ui_user/features/email/presentation/widgets/email_view_back_button.dart';
|
||||||
import 'package:tmail_ui_user/features/email/presentation/widgets/information_sender_and_receiver_builder.dart';
|
import 'package:tmail_ui_user/features/email/presentation/widgets/information_sender_and_receiver_builder.dart';
|
||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
@@ -77,4 +79,8 @@ class EmailRobot extends CoreRobot {
|
|||||||
Future<void> longPressSenderEmailAddress(String email) async {
|
Future<void> longPressSenderEmailAddress(String email) async {
|
||||||
await $(InformationSenderAndReceiverBuilder).$(email).longPress();
|
await $(InformationSenderAndReceiverBuilder).$(email).longPress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> onTapAttachmentItem() async {
|
||||||
|
await $(AttachmentItemWidget).$(InkWell).tap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/email_view.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/widgets/attachment_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/email_robot.dart';
|
||||||
|
import '../../robots/thread_robot.dart';
|
||||||
|
|
||||||
|
class ExportAttachmentScenario extends BaseTestScenario {
|
||||||
|
|
||||||
|
const ExportAttachmentScenario(super.$);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> runTestLogic() async {
|
||||||
|
const subject = 'export attachment';
|
||||||
|
const attachmentContent = 'attachment content';
|
||||||
|
const emailUser = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||||
|
final threadRobot = ThreadRobot($);
|
||||||
|
final emailRobot = EmailRobot($);
|
||||||
|
final appLocalizations = AppLocalizations();
|
||||||
|
|
||||||
|
final attachmentFile = await preparingTxtFile(attachmentContent);
|
||||||
|
await provisionEmail(
|
||||||
|
[
|
||||||
|
ProvisioningEmail(
|
||||||
|
toEmail: emailUser,
|
||||||
|
subject: subject,
|
||||||
|
content: subject,
|
||||||
|
attachmentPaths: [attachmentFile.path],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
requestReadReceipt: false,
|
||||||
|
);
|
||||||
|
await $.pumpAndSettle();
|
||||||
|
|
||||||
|
await threadRobot.openEmailWithSubject(subject);
|
||||||
|
await $.pumpAndSettle();
|
||||||
|
_expectAttachmentVisible();
|
||||||
|
|
||||||
|
await emailRobot.onTapAttachmentItem();
|
||||||
|
await $.pumpAndSettle();
|
||||||
|
|
||||||
|
await $.native.pressBack();
|
||||||
|
_expectEmailViewVisible();
|
||||||
|
_expectExportDialogLoadingInvisible(appLocalizations);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _expectAttachmentVisible() {
|
||||||
|
expect($(AttachmentItemWidget), findsOneWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _expectEmailViewVisible() {
|
||||||
|
expect($(EmailView).visible, isTrue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _expectExportDialogLoadingInvisible(AppLocalizations appLocalizations) {
|
||||||
|
expect($(appLocalizations.preparing_to_export).visible, isFalse);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import '../../base/test_base.dart';
|
||||||
|
import '../../scenarios/email_detailed/export_attachment_scenario.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestBase().runPatrolTest(
|
||||||
|
description: 'Should auto preview attachment when export attachment successfully',
|
||||||
|
scenarioBuilder: ($) => ExportAttachmentScenario($),
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user