-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TF-3514 Add integration test for reply email with content contain ima…
…ge base64 Signed-off-by: dab246 <[email protected]>
- Loading branch information
Showing
11 changed files
with
9,339 additions
and
5,699 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
integration_test/scenarios/reply_email_with_content_contain_image_base64_data_scenario.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import 'package:core/presentation/resources/image_paths.dart'; | ||
import 'package:core/presentation/views/html_viewer/html_content_viewer_widget.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:model/email/prefix_email_address.dart'; | ||
import 'package:tmail_ui_user/features/composer/presentation/composer_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 'package:tmail_ui_user/features/thread/presentation/widgets/email_tile_builder.dart'; | ||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; | ||
|
||
import '../base/base_test_scenario.dart'; | ||
import '../robots/composer_robot.dart'; | ||
import '../robots/email_robot.dart'; | ||
import '../robots/search_robot.dart'; | ||
import '../robots/thread_robot.dart'; | ||
|
||
class ReplyEmailWithContentContainImageBase64DataScenario extends BaseTestScenario { | ||
const ReplyEmailWithContentContainImageBase64DataScenario(super.$); | ||
|
||
@override | ||
Future<void> runTestLogic() async { | ||
const emailSubject = 'Mail with base64'; | ||
const emailUser = String.fromEnvironment('BASIC_AUTH_EMAIL'); | ||
|
||
final threadRobot = ThreadRobot($); | ||
final searchRobot = SearchRobot($); | ||
final emailRobot = EmailRobot($); | ||
final composerRobot = ComposerRobot($); | ||
final imagePaths = ImagePaths(); | ||
final appLocalizations = AppLocalizations(); | ||
|
||
await threadRobot.openSearchView(); | ||
await _expectSearchViewVisible(); | ||
|
||
await searchRobot.enterQueryString(emailSubject); | ||
await searchRobot.tapOnShowAllResultsText(); | ||
await _expectSearchResultEmailListVisible(); | ||
|
||
await searchRobot.openEmailWithSubject(emailSubject); | ||
await _expectEmailViewVisible(); | ||
await _expectReplyEmailButtonVisible(); | ||
|
||
await emailRobot.onTapReplyEmail(); | ||
await _expectComposerViewVisible(); | ||
|
||
await composerRobot.grantContactPermission(); | ||
|
||
await composerRobot.addRecipientIntoField( | ||
prefixEmailAddress: PrefixEmailAddress.to, | ||
email: emailUser, | ||
); | ||
|
||
await composerRobot.sendEmail(imagePaths); | ||
await _expectSendEmailSuccessToast(appLocalizations); | ||
await Future.delayed(const Duration(seconds: 3)); | ||
|
||
await emailRobot.onTapBackButton(); | ||
await $.pumpAndSettle(duration: const Duration(seconds: 3)); | ||
await _expectEmailCidWithSubject(emailSubject); | ||
|
||
await threadRobot.openEmailWithSubject( | ||
'${appLocalizations.prefix_reply_email} $emailSubject' | ||
); | ||
await _expectEmailViewVisible(); | ||
await Future.delayed(const Duration(seconds: 3)); | ||
await _ensureHtmlContentViewerVisible(); | ||
await _expectEmailViewWithCidImage(); | ||
} | ||
|
||
Future<void> _expectSearchViewVisible() async { | ||
await expectViewVisible($(SearchEmailView)); | ||
} | ||
|
||
Future<void> _expectSearchResultEmailListVisible() async { | ||
await expectViewVisible($(#search_email_list_notification_listener)); | ||
} | ||
|
||
Future<void> _expectEmailViewVisible() async { | ||
await expectViewVisible($(EmailView)); | ||
} | ||
|
||
Future<void> _expectReplyEmailButtonVisible() async { | ||
await expectViewVisible($(#reply_email_button)); | ||
} | ||
|
||
Future<void> _expectComposerViewVisible() async { | ||
await expectViewVisible($(ComposerView)); | ||
} | ||
|
||
Future<void> _expectSendEmailSuccessToast(AppLocalizations appLocalizations) async { | ||
await expectViewVisible( | ||
$(find.text(appLocalizations.message_has_been_sent_successfully)), | ||
); | ||
} | ||
|
||
Future<void> _expectEmailCidWithSubject(String subject) => expectViewVisible( | ||
$(EmailTileBuilder) | ||
.which<EmailTileBuilder>( | ||
(widget) => widget.presentationEmail.subject?.contains(subject) == true | ||
), | ||
); | ||
|
||
Future<void> _ensureHtmlContentViewerVisible() async { | ||
await $(HtmlContentViewer).scrollTo(scrollDirection: AxisDirection.down); | ||
} | ||
|
||
Future<void> _expectEmailViewWithCidImage() async { | ||
HtmlContentViewer? htmlContentViewer; | ||
|
||
await $(HtmlContentViewer) | ||
.which<HtmlContentViewer>((view) { | ||
htmlContentViewer = view; | ||
return true; | ||
}) | ||
.first | ||
.tap(); | ||
|
||
final contentHtml = htmlContentViewer!.contentHtml; | ||
final cidCount = RegExp(r'cid').allMatches(contentHtml).length; | ||
expect(cidCount, 2); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
integration_test/tests/compose/reply_email_with_content_contain_image_base64_data_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import '../../base/test_base.dart'; | ||
import '../../scenarios/reply_email_with_content_contain_image_base64_data_scenario.dart'; | ||
|
||
void main() { | ||
TestBase().runPatrolTest( | ||
description: 'Should see inline image with cid when reply email with content contain image base64 data', | ||
scenarioBuilder: ($) => ReplyEmailWithContentContainImageBase64DataScenario($), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.