-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TF-2528 Add integration test for search with sort by sender name
- Loading branch information
Showing
8 changed files
with
168 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
url.prefix=https://a872-222-252-23-73.ngrok-free.app | ||
url.prefix=https://b465-222-252-23-73.ngrok-free.app |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; | ||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; | ||
|
||
import '../base/core_robot.dart'; | ||
|
||
class SearchRobot extends CoreRobot { | ||
SearchRobot(super.$); | ||
|
||
Future<void> enterQueryString(String queryString) async { | ||
await $(#search_email_text_field).enterText(queryString); | ||
await ensureViewVisible($(#suggestion_search_list_view)); | ||
} | ||
|
||
Future<void> scrollToEndListSearchFilter() async { | ||
await $.scrollUntilVisible( | ||
finder: $(#mobile_sortBy_search_filter_button), | ||
view: $(#search_filter_list_view), | ||
scrollDirection: AxisDirection.right, | ||
delta: 300, | ||
); | ||
await ensureViewVisible($(#mobile_sortBy_search_filter_button)); | ||
} | ||
|
||
Future<void> openSortOrderBottomDialog() async { | ||
await $(#mobile_sortBy_search_filter_button).tap(); | ||
await ensureViewVisible($(#sort_filter_context_menu)); | ||
} | ||
|
||
Future<void> selectSenderAscending() async { | ||
await $(find.text(AppLocalizations().senderAscending)).tap(); | ||
await Future.delayed(const Duration(seconds: 2)); | ||
} | ||
|
||
Future<void> expectEmailListDisplayedInFullOrder({ | ||
required String queryString, | ||
required List<EmailAddress> recipientListSorted, | ||
}) async { | ||
expect( | ||
find.byType(ListTile), | ||
findsNWidgets(recipientListSorted.length), | ||
); | ||
|
||
for (var i = 0; i < recipientListSorted.length; i++) { | ||
final itemFinder = find.text('$queryString ${recipientListSorted[i].name}'); | ||
expect(itemFinder, findsOneWidget); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; | ||
import 'package:model/model.dart'; | ||
|
||
import '../base/base_scenario.dart'; | ||
import '../robots/composer_robot.dart'; | ||
import '../robots/search_robot.dart'; | ||
import '../robots/thread_robot.dart'; | ||
import 'login_with_basic_auth_scenario.dart'; | ||
|
||
class SearchEmailScenario extends BaseScenario { | ||
const SearchEmailScenario( | ||
super.$, | ||
{ | ||
required this.loginWithBasicAuthScenario, | ||
required this.queryString, | ||
required this.recipientListSorted, | ||
} | ||
); | ||
|
||
final LoginWithBasicAuthScenario loginWithBasicAuthScenario; | ||
final String queryString; | ||
final List<EmailAddress> recipientListSorted; | ||
|
||
@override | ||
Future<void> execute() async { | ||
await loginWithBasicAuthScenario.execute(); | ||
|
||
final threadRobot = ThreadRobot($); | ||
final composerRobot = ComposerRobot($); | ||
|
||
for (var i = 0; i < recipientListSorted.length; i++) { | ||
await threadRobot.openComposer(); | ||
await threadRobot.expectComposerViewVisible(); | ||
await Future.delayed(const Duration(seconds: 1)); | ||
await composerRobot.grantContactPermission(); | ||
await composerRobot.addRecipient(recipientListSorted[i].emailAddress); | ||
await composerRobot.addSubject('Subject'); | ||
await composerRobot.addContent('$queryString ${recipientListSorted[i].name}'); | ||
await composerRobot.sendEmail(); | ||
await composerRobot.expectSendEmailSuccessToast(); | ||
// Send each email after 3s | ||
await Future.delayed(const Duration(seconds: 2)); | ||
} | ||
|
||
await threadRobot.openSearchView(); | ||
await threadRobot.expectSearchViewVisible(); | ||
|
||
final searchRobot = SearchRobot($); | ||
|
||
await searchRobot.enterQueryString(queryString); | ||
await searchRobot.scrollToEndListSearchFilter(); | ||
await searchRobot.openSortOrderBottomDialog(); | ||
await searchRobot.selectSenderAscending(); | ||
|
||
await searchRobot.expectEmailListDisplayedInFullOrder( | ||
queryString: queryString, | ||
recipientListSorted: recipientListSorted, | ||
); | ||
} | ||
} |
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,32 @@ | ||
import 'package:jmap_dart_client/jmap/mail/email/email_address.dart'; | ||
|
||
import '../../base/test_base.dart'; | ||
import '../../scenarios/login_with_basic_auth_scenario.dart'; | ||
import '../../scenarios/search_email_scenario.dart'; | ||
|
||
void main() { | ||
TestBase().runPatrolTest( | ||
description: 'Should see list email sort by SenderName ascending when search 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 searchEmailScenario = SearchEmailScenario( | ||
$, | ||
loginWithBasicAuthScenario: loginWithBasicAuthScenario, | ||
queryString: 'Hello', | ||
recipientListSorted: [ | ||
EmailAddress('alice1', '[email protected]'), | ||
EmailAddress('alice2', '[email protected]'), | ||
EmailAddress('alice3', '[email protected]'), | ||
] | ||
); | ||
|
||
await searchEmailScenario.execute(); | ||
}, | ||
); | ||
} |
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