From 4160729bd64f76407ffb69ad25cdd2812d5ace9d Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 24 Apr 2025 03:05:26 +0700 Subject: [PATCH] TF-3691 Add integration test for case search snippets with html escape Signed-off-by: dab246 --- ...ch_snippets_with_html_escape_scenario.dart | 36 +++++++++++++++++++ ...search_snippets_with_html_escape_test.dart | 9 +++++ 2 files changed, 45 insertions(+) create mode 100644 integration_test/scenarios/search/search_snippets_with_html_escape_scenario.dart create mode 100644 integration_test/tests/search/search_snippets_with_html_escape_test.dart diff --git a/integration_test/scenarios/search/search_snippets_with_html_escape_scenario.dart b/integration_test/scenarios/search/search_snippets_with_html_escape_scenario.dart new file mode 100644 index 000000000..b7ddb78a7 --- /dev/null +++ b/integration_test/scenarios/search/search_snippets_with_html_escape_scenario.dart @@ -0,0 +1,36 @@ +import 'package:flutter_test/flutter_test.dart'; + +import '../../base/base_test_scenario.dart'; +import '../../models/provisioning_email.dart'; +import '../../robots/search_robot.dart'; +import '../../robots/thread_robot.dart'; + +class SearchSnippetsWithHtmlEscapeScenario extends BaseTestScenario { + SearchSnippetsWithHtmlEscapeScenario(super.$); + + @override + Future runTestLogic() async { + const email = String.fromEnvironment('BASIC_AUTH_EMAIL'); + const subject = ''; + + final threadRobot = ThreadRobot($); + final searchRobot = SearchRobot($); + + await provisionEmail( + [ProvisioningEmail(toEmail: email, subject: subject, content: subject)], + requestReadReceipt: false, + ); + await $.pumpAndSettle(); + + await threadRobot.tapOnSearchField(); + await searchRobot.enterKeyword(subject); + await searchRobot.tapOnShowAllResultsText(); + await $.pumpAndSettle(); + + await _expectEmailWithSubjectUnescapedVisible(subject); + } + + Future _expectEmailWithSubjectUnescapedVisible(String subject) async { + await expectViewVisible($(find.text(subject))); + } +} diff --git a/integration_test/tests/search/search_snippets_with_html_escape_test.dart b/integration_test/tests/search/search_snippets_with_html_escape_test.dart new file mode 100644 index 000000000..29e382745 --- /dev/null +++ b/integration_test/tests/search/search_snippets_with_html_escape_test.dart @@ -0,0 +1,9 @@ +import '../../base/test_base.dart'; +import '../../scenarios/search/search_snippets_with_html_escape_scenario.dart'; + +void main() { + TestBase().runPatrolTest( + description: 'Should see email with subject escaped when search email successfully', + scenarioBuilder: ($) => SearchSnippetsWithHtmlEscapeScenario($), + ); +} \ No newline at end of file