TF-3236 Add integration test to search snippet

This commit is contained in:
DatDang
2024-11-11 10:27:47 +07:00
committed by Dat H. Pham
parent ed2c0b1f6d
commit 1ece796185
8 changed files with 356 additions and 0 deletions
@@ -0,0 +1,36 @@
import '../../base/test_base.dart';
import '../../scenarios/login_with_basic_auth_scenario.dart';
import '../../scenarios/search_result_highlights_scenario.dart';
void main() {
TestBase().runPatrolTest(
description: 'Should see highlighted keyword in search result',
test: ($) async {
const keyword = 'Search snippet results';
const longContentWithSearchKeywordAtTheStart = "$keyword Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s";
const longContentWithSearchKeywordAtTheMiddle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. $keyword Lorem Ipsum has been the industry's standard dummy text ever since the 1500s";
const longContentWithSearchKeywordAtTheEnd = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s $keyword";
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 searchResultHighlightsScenario = SearchResultHighlightsScenario(
$,
loginWithBasicAuthScenario: loginWithBasicAuthScenario,
keyword: keyword,
longEmailContents: [
longContentWithSearchKeywordAtTheStart,
longContentWithSearchKeywordAtTheMiddle,
longContentWithSearchKeywordAtTheEnd
],
);
await searchResultHighlightsScenario.execute();
}
);
}
@@ -0,0 +1,36 @@
import '../../base/test_base.dart';
import '../../scenarios/login_with_basic_auth_scenario.dart';
import '../../scenarios/search_suggestion_highlights_scenario.dart';
void main() {
TestBase().runPatrolTest(
description: 'Should see highlighted keyword in search suggestion',
test: ($) async {
const keyword = 'Search snippet suggestions';
const longContentWithSearchKeywordAtTheStart = "$keyword Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s";
const longContentWithSearchKeywordAtTheMiddle = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. $keyword Lorem Ipsum has been the industry's standard dummy text ever since the 1500s";
const longContentWithSearchKeywordAtTheEnd = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s $keyword";
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 searchResultHighlightsScenario = SearchSuggestionHighlightsScenario(
$,
loginWithBasicAuthScenario: loginWithBasicAuthScenario,
keyword: keyword,
longEmailContents: [
longContentWithSearchKeywordAtTheStart,
longContentWithSearchKeywordAtTheMiddle,
longContentWithSearchKeywordAtTheEnd
],
);
await searchResultHighlightsScenario.execute();
}
);
}