TF-3349 Add integration test for forward email
This commit is contained in:
@@ -10,8 +10,8 @@ services:
|
|||||||
- ./mailetcontainer.xml:/root/conf/mailetcontainer.xml
|
- ./mailetcontainer.xml:/root/conf/mailetcontainer.xml
|
||||||
- ./imapserver.xml:/root/conf/imapserver.xml
|
- ./imapserver.xml:/root/conf/imapserver.xml
|
||||||
- ./jmap.properties:/root/conf/jmap.properties
|
- ./jmap.properties:/root/conf/jmap.properties
|
||||||
- ../provisioning/integration_test/search_email_with_sort_order/provisioning.sh:/root/conf/integration_test/search_email_with_sort_order/provisioning.sh
|
- ../provisioning/integration_test/provisioning.sh:/root/conf/integration_test/provisioning.sh
|
||||||
- ../provisioning/integration_test/search_email_with_sort_order/eml:/root/conf/integration_test/search_email_with_sort_order/eml
|
- ../provisioning/integration_test/eml:/root/conf/integration_test/eml
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
import '../base/core_robot.dart';
|
||||||
|
|
||||||
|
class EmailRobot extends CoreRobot {
|
||||||
|
EmailRobot(super.$);
|
||||||
|
|
||||||
|
Future<void> onTapForwardEmail() async {
|
||||||
|
await $(#forward_email_button).tap();
|
||||||
|
await $.pump(const Duration(seconds: 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:core/presentation/views/text/text_field_builder.dart';
|
import 'package:core/presentation/views/text/text_field_builder.dart';
|
||||||
import 'package:tmail_ui_user/features/search/email/presentation/search_email_view.dart';
|
import 'package:tmail_ui_user/features/search/email/presentation/search_email_view.dart';
|
||||||
|
import 'package:tmail_ui_user/features/thread/presentation/widgets/email_tile_builder.dart';
|
||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
import '../base/core_robot.dart';
|
import '../base/core_robot.dart';
|
||||||
@@ -39,4 +40,27 @@ class SearchRobot extends CoreRobot {
|
|||||||
await $.waitUntilVisible($(AppLocalizations().showingResultsFor));
|
await $.waitUntilVisible($(AppLocalizations().showingResultsFor));
|
||||||
await $(AppLocalizations().showingResultsFor).tap();
|
await $(AppLocalizations().showingResultsFor).tap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> scrollToDateTimeButtonFilter() async {
|
||||||
|
await $.scrollUntilVisible(
|
||||||
|
finder: $(#mobile_dateTime_search_filter_button),
|
||||||
|
view: $(#search_filter_list_view),
|
||||||
|
scrollDirection: AxisDirection.right,
|
||||||
|
delta: 300,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> openDateTimeBottomDialog() async {
|
||||||
|
await $(#mobile_dateTime_search_filter_button).tap();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> selectDateTime(String dateTimeType) async {
|
||||||
|
await $(find.text(dateTimeType)).tap();
|
||||||
|
await $.pump(const Duration(seconds: 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> openEmail(String subject) async {
|
||||||
|
await $(find.byType(EmailTileBuilder)).first.tap();
|
||||||
|
await $.pump(const Duration(seconds: 2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:rich_text_composer/rich_text_composer.dart';
|
||||||
|
import 'package:tmail_ui_user/features/composer/presentation/composer_controller.dart';
|
||||||
|
import 'package:tmail_ui_user/features/composer/presentation/composer_view.dart';
|
||||||
|
import 'package:tmail_ui_user/features/composer/presentation/view/mobile/mobile_editor_view.dart';
|
||||||
|
import 'package:tmail_ui_user/features/email/presentation/email_view.dart';
|
||||||
|
import 'package:tmail_ui_user/features/search/email/presentation/search_email_view.dart';
|
||||||
|
|
||||||
|
import '../base/base_scenario.dart';
|
||||||
|
import '../robots/composer_robot.dart';
|
||||||
|
import '../robots/email_robot.dart';
|
||||||
|
import '../robots/search_robot.dart';
|
||||||
|
import '../robots/thread_robot.dart';
|
||||||
|
import 'login_with_basic_auth_scenario.dart';
|
||||||
|
|
||||||
|
class ForwardEmailScenario extends BaseScenario {
|
||||||
|
const ForwardEmailScenario(
|
||||||
|
super.$,
|
||||||
|
{
|
||||||
|
required this.loginWithBasicAuthScenario,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
final LoginWithBasicAuthScenario loginWithBasicAuthScenario;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> execute() async {
|
||||||
|
await loginWithBasicAuthScenario.execute();
|
||||||
|
|
||||||
|
final threadRobot = ThreadRobot($);
|
||||||
|
await threadRobot.openSearchView();
|
||||||
|
await _expectSearchViewVisible();
|
||||||
|
|
||||||
|
final searchRobot = SearchRobot($);
|
||||||
|
await searchRobot.enterQueryString('Forward email');
|
||||||
|
await _expectSuggestionSearchListViewVisible();
|
||||||
|
await searchRobot.tapOnShowAllResultsText();
|
||||||
|
await _expectSearchResultEmailListVisible();
|
||||||
|
|
||||||
|
await searchRobot.openEmail('Fwd: Forward email');
|
||||||
|
await _expectEmailViewVisible();
|
||||||
|
await _expectForwardEmailButtonVisible();
|
||||||
|
|
||||||
|
final emailRobot = EmailRobot($);
|
||||||
|
await emailRobot.onTapForwardEmail();
|
||||||
|
await _expectComposerViewVisible();
|
||||||
|
|
||||||
|
final composerRobot = ComposerRobot($);
|
||||||
|
await composerRobot.grantContactPermission();
|
||||||
|
await _expectMobileEditorViewVisible();
|
||||||
|
|
||||||
|
await _expectForwardEmailContentDisplayedCorrectly();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectSearchViewVisible() async {
|
||||||
|
await expectViewVisible($(SearchEmailView));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectSuggestionSearchListViewVisible() async {
|
||||||
|
await expectViewVisible($(#suggestion_search_list_view));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectSearchResultEmailListVisible() async {
|
||||||
|
await expectViewVisible($(#search_email_list_notification_listener));
|
||||||
|
await $.pump(const Duration(seconds: 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectEmailViewVisible() async {
|
||||||
|
await expectViewVisible($(EmailView));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectForwardEmailButtonVisible() async {
|
||||||
|
await expectViewVisible($(#forward_email_button));
|
||||||
|
await $.pump(const Duration(seconds: 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectComposerViewVisible() async {
|
||||||
|
await expectViewVisible($(ComposerView));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectMobileEditorViewVisible() async {
|
||||||
|
await expectViewVisible($(#mobile_editor));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectForwardEmailContentDisplayedCorrectly() async {
|
||||||
|
ComposerController? composerController;
|
||||||
|
await $(ComposerView)
|
||||||
|
.which<ComposerView>((widget) {
|
||||||
|
composerController = widget.controller;
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.$(MobileEditorView)
|
||||||
|
.$(HtmlEditor)
|
||||||
|
.$(InAppWebView).tap();
|
||||||
|
|
||||||
|
await composerController?.htmlEditorApi?.requestFocusLastChild();
|
||||||
|
|
||||||
|
final contentHtml = await composerController?.htmlEditorApi?.getText();
|
||||||
|
|
||||||
|
expect(contentHtml, contains('Subject'));
|
||||||
|
expect(contentHtml, contains('From'));
|
||||||
|
expect(contentHtml, contains('To'));
|
||||||
|
expect(contentHtml, contains('Cc'));
|
||||||
|
expect(contentHtml, contains('Bcc'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import '../../base/test_base.dart';
|
||||||
|
import '../../scenarios/forward_email_scenario.dart';
|
||||||
|
import '../../scenarios/login_with_basic_auth_scenario.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestBase().runPatrolTest(
|
||||||
|
description: 'Should see HTML content contain enough: Subject, From, To, Cc, Bcc, Reply to',
|
||||||
|
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 forwardEmailScenario = ForwardEmailScenario(
|
||||||
|
$,
|
||||||
|
loginWithBasicAuthScenario: loginWithBasicAuthScenario,
|
||||||
|
);
|
||||||
|
|
||||||
|
await forwardEmailScenario.execute();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
Return-Path: <emma@example.com>
|
||||||
|
MIME-Version: 1.0
|
||||||
|
References: <Mime4j.4c.b3b452d18f0d0ef9.192d67aaafc@example.com>
|
||||||
|
Subject: Fwd: Forward email to Bob
|
||||||
|
From: emma@example.com
|
||||||
|
To: "bob@example.com" <bob@example.com>
|
||||||
|
Cc: "alice@example.com" <alice@example.com>
|
||||||
|
Bcc: "brian@example.com" <brian@example.com>
|
||||||
|
Reply-To: emma@example.com
|
||||||
|
Date: Tue, 17 Dec 2024 16:31:00 +0000
|
||||||
|
Message-ID: <Mime4j.4e.728b2b72b23cc182.192d67ae03c@example.com>
|
||||||
|
User-Agent: Twake-Mail/0.13.2 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15;
|
||||||
|
rv:131.0) Gecko/20100101 Firefox/131.0
|
||||||
|
Content-Type: multipart/alternative;
|
||||||
|
boundary="-=Part.4f.450e1cfbcd355387.192d67ae03d.c367d8042fea24dd=-"
|
||||||
|
|
||||||
|
---=Part.4f.450e1cfbcd355387.192d67ae03d.c367d8042fea24dd=-
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
Accept-Language: fr-FR, en-US, vi-VN, ru-RU, ar-TN, it-IT
|
||||||
|
Content-Language: en-US
|
||||||
|
|
||||||
|
Forward email to Bob
|
||||||
|
|
||||||
|
Invite you in to a meeting: Event OPEN TECH TALK: INNOVATION FOR THE TWAKE WORKPLACE
|
||||||
|
|
||||||
|
Our 3rd Open Tech Talk in 2024!
|
||||||
|
|
||||||
|
► Topic: "Enhancing Multi-Tenancy Security"
|
||||||
|
► Topic: "Bringing Desktop Synchronization into TDrive"
|
||||||
|
► Topic: "Websocket: Real-time Update
|
||||||
|
|
||||||
|
We are waiting for you!
|
||||||
|
|
||||||
|
---=Part.4f.450e1cfbcd355387.192d67ae03d.c367d8042fea24dd=-
|
||||||
|
Content-Type: text/html; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
Accept-Language: fr-FR, en-US, vi-VN, ru-RU, ar-TN, it-IT
|
||||||
|
Content-Language: en-US
|
||||||
|
|
||||||
|
|
||||||
|
---=Part.4f.450e1cfbcd355387.192d67ae03d.c367d8042fea24dd=---
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Define users and folders
|
||||||
|
users=("alice" "bob" "brian" "charlotte" "david" "emma")
|
||||||
|
bobFolders=("Search Emails" "Forward Emails")
|
||||||
|
|
||||||
|
# Add users
|
||||||
|
for user in "${users[@]}"; do
|
||||||
|
james-cli AddUser "$user@example.com" "$user"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Create folders for user Bob
|
||||||
|
for folderName in "${bobFolders[@]}"; do
|
||||||
|
echo "Creating $folderName folder for user bob"
|
||||||
|
james-cli CreateMailbox \#private "bob@example.com" "$folderName" &
|
||||||
|
done
|
||||||
|
|
||||||
|
# For test search email with sort order
|
||||||
|
# Import emails into 'Search Emails' folder for user Bob
|
||||||
|
for eml in {0..4}; do
|
||||||
|
echo "Importing $eml.eml into 'Search Emails' folder for user bob"
|
||||||
|
james-cli ImportEml \#private "bob@example.com" "Search Emails" "/root/conf/integration_test/eml/search_email_with_sort_order/$eml.eml" &
|
||||||
|
done
|
||||||
|
|
||||||
|
# For test forward email
|
||||||
|
# Import emails into 'Forward Emails' folder for user Bob
|
||||||
|
echo "Importing 0.eml into 'Forward Emails' folder for user bob"
|
||||||
|
james-cli ImportEml \#private "bob@example.com" "Forward Emails" "/root/conf/integration_test/eml/forward_email/0.eml"
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Define users and folders
|
|
||||||
users=("alice" "bob" "brian" "charlotte" "david" "emma")
|
|
||||||
|
|
||||||
# Add users
|
|
||||||
for user in "${users[@]}"; do
|
|
||||||
james-cli AddUser "$user@example.com" "$user"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Create search folder for user Bob
|
|
||||||
james-cli CreateMailbox \#private "bob@example.com" "search"
|
|
||||||
|
|
||||||
# Import emails into search folder for user Bob
|
|
||||||
for eml in {0..4}; do
|
|
||||||
echo "Importing $eml.eml into search folder for user bob"
|
|
||||||
james-cli ImportEml \#private "bob@example.com" "search" "/root/conf/integration_test/search_email_with_sort_order/eml/$eml.eml" &
|
|
||||||
done
|
|
||||||
@@ -41,7 +41,7 @@ export BOB="bob"
|
|||||||
export ALICE="alice"
|
export ALICE="alice"
|
||||||
export DOMAIN="example.com"
|
export DOMAIN="example.com"
|
||||||
|
|
||||||
docker exec tmail-backend ./root/conf/integration_test/search_email_with_sort_order/provisioning.sh
|
docker exec tmail-backend ./root/conf/integration_test/provisioning.sh
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export BOB="bob"
|
|||||||
export ALICE="alice"
|
export ALICE="alice"
|
||||||
export DOMAIN="example.com"
|
export DOMAIN="example.com"
|
||||||
|
|
||||||
docker exec tmail-backend ./root/conf/integration_test/search_email_with_sort_order/provisioning.sh
|
docker exec tmail-backend ./root/conf/integration_test/provisioning.sh
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user