TF-3493 Refactor integration test code for performance and maintainability
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -1,24 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../scenarios/app_grid_scenario.dart';
|
||||
import '../../scenarios/login_with_basic_auth_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should display and navigate app grid correctly when clicked',
|
||||
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 appGridScenario = AppGridScenario(
|
||||
$,
|
||||
loginWithBasicAuthScenario: loginWithBasicAuthScenario,
|
||||
);
|
||||
|
||||
await appGridScenario.execute();
|
||||
}
|
||||
scenarioBuilder: ($) => AppGridScenario($),
|
||||
);
|
||||
}
|
||||
@@ -1,24 +1,9 @@
|
||||
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();
|
||||
}
|
||||
scenarioBuilder: ($) => DownloadAllAttachmentsScenario($),
|
||||
);
|
||||
}
|
||||
@@ -1,23 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../scenarios/login_with_basic_auth_scenario.dart';
|
||||
import '../../scenarios/no_disposition_inline_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should see base64 inline image when attachment has no disposition but has cid',
|
||||
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 noDispositionInlineScenario = NoDispositionInlineScenario($,
|
||||
loginWithBasicAuthScenario: loginWithBasicAuthScenario,
|
||||
);
|
||||
|
||||
await noDispositionInlineScenario.execute();
|
||||
}
|
||||
scenarioBuilder: ($) => NoDispositionInlineScenario($),
|
||||
);
|
||||
}
|
||||
@@ -1,23 +1,9 @@
|
||||
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();
|
||||
},
|
||||
scenarioBuilder: ($) => ForwardEmailScenario($),
|
||||
);
|
||||
}
|
||||
@@ -1,24 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../scenarios/login_with_basic_auth_scenario.dart';
|
||||
import '../../scenarios/send_email_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should see success toast when send email 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 sendEmailScenario = SendEmailScenario($,
|
||||
loginWithBasicAuthScenario: loginWithBasicAuthScenario,
|
||||
additionalRecipient: const String.fromEnvironment('ADDITIONAL_MAIL_RECIPIENT'),
|
||||
subject: 'Test subject',
|
||||
content: 'Test content');
|
||||
|
||||
await sendEmailScenario.execute();
|
||||
},
|
||||
scenarioBuilder: ($) => SendEmailScenario($),
|
||||
);
|
||||
}
|
||||
@@ -4,15 +4,12 @@ import '../../scenarios/login_with_basic_auth_scenario.dart';
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should see thread view when login with basic auth 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'),
|
||||
);
|
||||
|
||||
await loginWithBasicAuthScenario.execute();
|
||||
}
|
||||
scenarioBuilder: ($) => 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'),
|
||||
),
|
||||
);
|
||||
}
|
||||
+1
-36
@@ -1,44 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../models/provisioning_email.dart';
|
||||
import '../../scenarios/login_with_basic_auth_scenario.dart';
|
||||
import '../../scenarios/search_email_by_date_time_and_sort_order_relevance_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should see list email displayed by date time `Last 7 days` and sort order `Relevance` when search email successfully',
|
||||
test: ($) async {
|
||||
const username = String.fromEnvironment('USERNAME');
|
||||
const password = String.fromEnvironment('PASSWORD');
|
||||
const hostUrl = String.fromEnvironment('BASIC_AUTH_URL');
|
||||
const email = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||
|
||||
final loginWithBasicAuthScenario = LoginWithBasicAuthScenario(
|
||||
$,
|
||||
username: username,
|
||||
password: password,
|
||||
hostUrl: hostUrl,
|
||||
email: email,
|
||||
);
|
||||
|
||||
const queryString = 'relevance';
|
||||
const listUsername = ['Alice', 'Brian', 'Charlotte', 'David', 'Emma'];
|
||||
|
||||
final listProvisioningEmail = listUsername
|
||||
.map((username) => ProvisioningEmail(
|
||||
toEmail: '${username.toLowerCase()}@example.com',
|
||||
subject: queryString,
|
||||
content: '$queryString to user $username',
|
||||
))
|
||||
.toList();
|
||||
|
||||
final searchEmailByDatetimeAndSortOrderRelevanceScenario = SearchEmailByDatetimeAndSortOrderRelevanceScenario(
|
||||
$,
|
||||
loginWithBasicAuthScenario: loginWithBasicAuthScenario,
|
||||
queryString: queryString,
|
||||
listProvisioningEmail: listProvisioningEmail,
|
||||
);
|
||||
|
||||
await searchEmailByDatetimeAndSortOrderRelevanceScenario.execute();
|
||||
},
|
||||
scenarioBuilder: ($) => SearchEmailByDatetimeAndSortOrderRelevanceScenario($),
|
||||
);
|
||||
}
|
||||
@@ -1,35 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../scenarios/login_with_basic_auth_scenario.dart';
|
||||
import '../../scenarios/search_email_with_sort_order_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should see list email displayed by sort order selected when search email successfully',
|
||||
test: ($) async {
|
||||
const username = String.fromEnvironment('USERNAME');
|
||||
const password = String.fromEnvironment('PASSWORD');
|
||||
const hostUrl = String.fromEnvironment('BASIC_AUTH_URL');
|
||||
const email = String.fromEnvironment('BASIC_AUTH_EMAIL');
|
||||
|
||||
final loginWithBasicAuthScenario = LoginWithBasicAuthScenario(
|
||||
$,
|
||||
username: username,
|
||||
password: password,
|
||||
hostUrl: hostUrl,
|
||||
email: email,
|
||||
);
|
||||
|
||||
const queryString = 'hello';
|
||||
const listUsername = ['Alice', 'Brian', 'Charlotte', 'David', 'Emma'];
|
||||
|
||||
final searchEmailWithSortOrderScenario = SearchEmailWithSortOrderScenario(
|
||||
$,
|
||||
loginWithBasicAuthScenario: loginWithBasicAuthScenario,
|
||||
queryString: queryString,
|
||||
listUsername: listUsername
|
||||
);
|
||||
|
||||
await searchEmailWithSortOrderScenario.execute();
|
||||
},
|
||||
scenarioBuilder: ($) => SearchEmailWithSortOrderScenario($),
|
||||
);
|
||||
}
|
||||
@@ -1,36 +1,9 @@
|
||||
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();
|
||||
}
|
||||
scenarioBuilder: ($) => SearchResultHighlightsScenario($),
|
||||
);
|
||||
}
|
||||
@@ -1,36 +1,9 @@
|
||||
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();
|
||||
}
|
||||
scenarioBuilder: ($) => SearchSuggestionHighlightsScenario($),
|
||||
);
|
||||
}
|
||||
@@ -1,25 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../scenarios/login_with_basic_auth_scenario.dart';
|
||||
import '../../scenarios/web_socket_update_ui_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should see thread view updated per web socket message',
|
||||
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 webSocketUpdateUiScenario = WebSocketUpdateUiScenario($,
|
||||
loginWithBasicAuthScenario: loginWithBasicAuthScenario,
|
||||
subject: 'web socket subject',
|
||||
content: 'web socket content',
|
||||
);
|
||||
|
||||
await webSocketUpdateUiScenario.execute();
|
||||
}
|
||||
scenarioBuilder: ($) => WebSocketUpdateUiScenario($),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user