TF-3454 Integration test download all attachments as ZIP
This commit is contained in:
@@ -2,7 +2,7 @@ version: "3"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
tmail-backend:
|
tmail-backend:
|
||||||
image: linagora/tmail-backend:memory-1.0.0
|
image: linagora/tmail-backend:memory-1.0.3-rc1
|
||||||
container_name: tmail-backend
|
container_name: tmail-backend
|
||||||
volumes:
|
volumes:
|
||||||
- ./jwt_publickey:/root/conf/jwt_publickey
|
- ./jwt_publickey:/root/conf/jwt_publickey
|
||||||
|
|||||||
@@ -88,9 +88,6 @@
|
|||||||
<mailet match="All" class="Sieve"/>
|
<mailet match="All" class="Sieve"/>
|
||||||
<mailet match="All" class="AddDeliveredToHeader"/>
|
<mailet match="All" class="AddDeliveredToHeader"/>
|
||||||
<mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
|
<mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
|
||||||
<mailet match="SenderIsLocal" class="com.linagora.tmail.mailets.ContactsCollection">
|
|
||||||
<attribute>ContactAttribute1</attribute>
|
|
||||||
</mailet>
|
|
||||||
<mailet match="All" class="com.linagora.tmail.mailets.TmailLocalDelivery"/>
|
<mailet match="All" class="com.linagora.tmail.mailets.TmailLocalDelivery"/>
|
||||||
</processor>
|
</processor>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
import '../base/core_robot.dart';
|
import '../base/core_robot.dart';
|
||||||
|
|
||||||
@@ -9,4 +10,9 @@ class EmailRobot extends CoreRobot {
|
|||||||
await $(#forward_email_button).tap();
|
await $(#forward_email_button).tap();
|
||||||
await $.pump(const Duration(seconds: 2));
|
await $.pump(const Duration(seconds: 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> tapDownloadAllButton() async {
|
||||||
|
await $(AppLocalizations().downloadAll).tap();
|
||||||
|
await $.pumpAndSettle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -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<String> attachmentContents;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> 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<void> _expectNativeSaveButtonVisible() async {
|
||||||
|
await expectLater($.native.tap(Selector(text: 'SAVE')), completes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ mixin ScenarioUtilsMixin {
|
|||||||
Future<void> provisionEmail(
|
Future<void> provisionEmail(
|
||||||
List<ProvisioningEmail> provisioningEmails, {
|
List<ProvisioningEmail> provisioningEmails, {
|
||||||
bool refreshEmailView = true,
|
bool refreshEmailView = true,
|
||||||
|
bool requestReadReceipt = true,
|
||||||
}) async {
|
}) async {
|
||||||
ComposerBindings().dependencies();
|
ComposerBindings().dependencies();
|
||||||
|
|
||||||
@@ -61,6 +62,7 @@ mixin ScenarioUtilsMixin {
|
|||||||
sentMailboxId: mailboxDashBoardController.mapDefaultMailboxIdByRole[PresentationMailbox.roleSent],
|
sentMailboxId: mailboxDashBoardController.mapDefaultMailboxIdByRole[PresentationMailbox.roleSent],
|
||||||
identity: identity,
|
identity: identity,
|
||||||
attachments: attachments,
|
attachments: attachments,
|
||||||
|
hasRequestReadReceipt: requestReadReceipt,
|
||||||
),
|
),
|
||||||
).last;
|
).last;
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user