diff --git a/backend-docker/docker-compose.yaml b/backend-docker/docker-compose.yaml index cb60e165d..f39626420 100644 --- a/backend-docker/docker-compose.yaml +++ b/backend-docker/docker-compose.yaml @@ -2,7 +2,7 @@ version: "3" services: tmail-backend: - image: linagora/tmail-backend:memory-1.0.0 + image: linagora/tmail-backend:memory-1.0.3-rc1 container_name: tmail-backend volumes: - ./jwt_publickey:/root/conf/jwt_publickey diff --git a/backend-docker/mailetcontainer.xml b/backend-docker/mailetcontainer.xml index 383173ef8..93bc729a5 100644 --- a/backend-docker/mailetcontainer.xml +++ b/backend-docker/mailetcontainer.xml @@ -88,9 +88,6 @@ - - ContactAttribute1 - diff --git a/integration_test/robots/email_robot.dart b/integration_test/robots/email_robot.dart index 2ada2436b..3edc413f1 100644 --- a/integration_test/robots/email_robot.dart +++ b/integration_test/robots/email_robot.dart @@ -1,4 +1,5 @@ import 'package:flutter_test/flutter_test.dart'; +import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; import '../base/core_robot.dart'; @@ -9,4 +10,9 @@ class EmailRobot extends CoreRobot { await $(#forward_email_button).tap(); await $.pump(const Duration(seconds: 2)); } + + Future tapDownloadAllButton() async { + await $(AppLocalizations().downloadAll).tap(); + await $.pumpAndSettle(); + } } \ No newline at end of file diff --git a/integration_test/scenarios/download_all_attachments_scenario.dart b/integration_test/scenarios/download_all_attachments_scenario.dart new file mode 100644 index 000000000..c1d197e97 --- /dev/null +++ b/integration_test/scenarios/download_all_attachments_scenario.dart @@ -0,0 +1,57 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:patrol/patrol.dart'; + +import '../base/base_scenario.dart'; +import '../models/provisioning_email.dart'; +import '../robots/email_robot.dart'; +import '../robots/thread_robot.dart'; +import '../utils/scenario_utils_mixin.dart'; +import 'login_with_basic_auth_scenario.dart'; + +class DownloadAllAttachmentsScenario extends BaseScenario with ScenarioUtilsMixin { + DownloadAllAttachmentsScenario( + super.$, { + required this.loginWithBasicAuthScenario, + required this.attachmentContents, + }); + + final LoginWithBasicAuthScenario loginWithBasicAuthScenario; + final List attachmentContents; + + @override + Future execute() async { + const subject = 'download all attachments subject'; + final threadRobot = ThreadRobot($); + final emailRobot = EmailRobot($); + + await loginWithBasicAuthScenario.execute(); + + // Prepare attachment files + final attachmentFiles = await Future.wait( + attachmentContents.map( + (attachmentContent) => preparingTxtFile(attachmentContent), + ), + ); + + // Provisioning email + await provisionEmail( + [ProvisioningEmail( + toEmail: loginWithBasicAuthScenario.email, + subject: subject, + content: 'download all attachments content', + attachmentPaths: attachmentFiles.map((file) => file.path).toList(), + )], + requestReadReceipt: false, + ); + await $.pumpAndSettle(); + + await threadRobot.openEmailWithSubject(subject); + await $.pumpAndSettle(); + await emailRobot.tapDownloadAllButton(); + await _expectNativeSaveButtonVisible(); + } + + Future _expectNativeSaveButtonVisible() async { + await expectLater($.native.tap(Selector(text: 'SAVE')), completes); + } +} \ No newline at end of file diff --git a/integration_test/tests/attachments/download_all_attachments_test.dart b/integration_test/tests/attachments/download_all_attachments_test.dart new file mode 100644 index 000000000..03ac21e06 --- /dev/null +++ b/integration_test/tests/attachments/download_all_attachments_test.dart @@ -0,0 +1,24 @@ +import '../../base/test_base.dart'; +import '../../scenarios/download_all_attachments_scenario.dart'; +import '../../scenarios/login_with_basic_auth_scenario.dart'; + +void main() { + TestBase().runPatrolTest( + description: 'Should see save dialog when download all attachments successfully', + test: ($) async { + final loginWithBasicAuthScenario = LoginWithBasicAuthScenario($, + username: const String.fromEnvironment('USERNAME'), + hostUrl: const String.fromEnvironment('BASIC_AUTH_URL'), + email: const String.fromEnvironment('BASIC_AUTH_EMAIL'), + password: const String.fromEnvironment('PASSWORD'), + ); + + final downloadAllAttachmentsScenario = DownloadAllAttachmentsScenario($, + loginWithBasicAuthScenario: loginWithBasicAuthScenario, + attachmentContents: ['file1', 'file2', 'file3'], + ); + + await downloadAllAttachmentsScenario.execute(); + } + ); +} \ No newline at end of file diff --git a/integration_test/utils/scenario_utils_mixin.dart b/integration_test/utils/scenario_utils_mixin.dart index 0e9bbcfcb..f9292937c 100644 --- a/integration_test/utils/scenario_utils_mixin.dart +++ b/integration_test/utils/scenario_utils_mixin.dart @@ -30,6 +30,7 @@ mixin ScenarioUtilsMixin { Future provisionEmail( List provisioningEmails, { bool refreshEmailView = true, + bool requestReadReceipt = true, }) async { ComposerBindings().dependencies(); @@ -61,6 +62,7 @@ mixin ScenarioUtilsMixin { sentMailboxId: mailboxDashBoardController.mapDefaultMailboxIdByRole[PresentationMailbox.roleSent], identity: identity, attachments: attachments, + hasRequestReadReceipt: requestReadReceipt, ), ).last; }));