TF-3260 Add integration test for app grid
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -10,6 +10,7 @@ services:
|
|||||||
- ./mailetcontainer.xml:/root/conf/mailetcontainer.xml
|
- ./mailetcontainer.xml:/root/conf/mailetcontainer.xml
|
||||||
- ./imapserver.xml:/root/conf/imapserver.xml
|
- ./imapserver.xml:/root/conf/imapserver.xml
|
||||||
- ./jmap.properties:/root/conf/jmap.properties
|
- ./jmap.properties:/root/conf/jmap.properties
|
||||||
|
- ./linagora-ecosystem.properties:/root/conf/linagora-ecosystem.properties
|
||||||
- ../provisioning/integration_test/provisioning.sh:/root/conf/integration_test/provisioning.sh
|
- ../provisioning/integration_test/provisioning.sh:/root/conf/integration_test/provisioning.sh
|
||||||
- ../provisioning/integration_test/eml:/root/conf/integration_test/eml
|
- ../provisioning/integration_test/eml:/root/conf/integration_test/eml
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
Twake_Drive.appName=Twake Drive
|
||||||
|
Twake_Drive.logoURL=https://sign-up.stg.lin-saas.com/images/tdrive.svg
|
||||||
|
Twake_Drive.webLink=https://drive.stg.lin-saas.com/
|
||||||
|
mobileApps.Twake_Chat.appName=Twake Chat
|
||||||
|
mobileApps.Twake_Chat.logoURL=https://sign-up.stg.lin-saas.com/images/twakechat.svg
|
||||||
|
mobileApps.Twake_Chat.androidPackageId=app.twake.android.chat
|
||||||
|
mobileApps.Twake_Chat.iosUrlScheme=twake.chat
|
||||||
|
mobileApps.Twake_Chat.iosAppStoreLink=itms-apps://itunes.apple.com/us/app/twake-chat/id6473384641
|
||||||
|
mobileApps.Twake_Sync.appName=Twake Sync
|
||||||
|
mobileApps.Twake_Sync.logoURL=https://twake.app/tild3364-6130-4763-b634-343435643861__twp-logo_1.svg
|
||||||
|
mobileApps.Twake_Sync.androidPackageId=com.twake.android.sync
|
||||||
@@ -65,6 +65,10 @@
|
|||||||
<name>bcc</name>
|
<name>bcc</name>
|
||||||
<onMailetException>ignore</onMailetException>
|
<onMailetException>ignore</onMailetException>
|
||||||
</mailet>
|
</mailet>
|
||||||
|
<mailet match="All" class="RemoveMimeHeader">
|
||||||
|
<name>X-SMIME-Status</name>
|
||||||
|
<onMailetException>ignore</onMailetException>
|
||||||
|
</mailet>
|
||||||
<mailet match="All" class="RecipientRewriteTable">
|
<mailet match="All" class="RecipientRewriteTable">
|
||||||
<errorProcessor>rrt-error</errorProcessor>
|
<errorProcessor>rrt-error</errorProcessor>
|
||||||
</mailet>
|
</mailet>
|
||||||
@@ -149,4 +153,3 @@
|
|||||||
</processors>
|
</processors>
|
||||||
|
|
||||||
</mailetcontainer>
|
</mailetcontainer>
|
||||||
|
|
||||||
|
|||||||
@@ -12,4 +12,8 @@ abstract class BaseScenario {
|
|||||||
await $.waitUntilVisible(patrolFinder);
|
await $.waitUntilVisible(patrolFinder);
|
||||||
expect(patrolFinder, findsWidgets);
|
expect(patrolFinder, findsWidgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> expectViewInVisible(PatrolFinder patrolFinder) async {
|
||||||
|
expect(patrolFinder, findsNothing);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
import '../base/core_robot.dart';
|
||||||
|
|
||||||
|
class AppGridRobot extends CoreRobot {
|
||||||
|
AppGridRobot(super.$);
|
||||||
|
|
||||||
|
Future<void> openAppInAppGridByAppName(String appName) async {
|
||||||
|
await $(find.text(appName)).tap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
import '../base/core_robot.dart';
|
||||||
|
|
||||||
|
class MailboxMenuRobot extends CoreRobot {
|
||||||
|
MailboxMenuRobot(super.$);
|
||||||
|
|
||||||
|
Future<void> openAppGrid() async {
|
||||||
|
await $(#toggle_app_grid_button).tap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,14 +20,12 @@ class ThreadRobot extends CoreRobot {
|
|||||||
await $(ThreadView).$(SearchBarView).tap();
|
await $(ThreadView).$(SearchBarView).tap();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> openMailbox(String mailboxName) async {
|
|
||||||
await $(#mobile_mailbox_menu_button).tap();
|
|
||||||
await $.scrollUntilVisible(finder: $(mailboxName));
|
|
||||||
await $(mailboxName).tap();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> openEmailWithSubject(String subject) async {
|
Future<void> openEmailWithSubject(String subject) async {
|
||||||
await $.scrollUntilVisible(finder: $(subject));
|
await $.scrollUntilVisible(finder: $(subject));
|
||||||
await $(subject).tap();
|
await $(subject).tap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> openMailbox() async {
|
||||||
|
await $(#mobile_mailbox_menu_button).tap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
|
||||||
|
import 'package:core/utils/platform_info.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_view.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/app_grid_view.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/app_dashboard/app_list_dashboard_item.dart';
|
||||||
|
|
||||||
|
import '../base/base_scenario.dart';
|
||||||
|
import '../robots/app_grid_robot.dart';
|
||||||
|
import '../robots/mailbox_menu_robot.dart';
|
||||||
|
import '../robots/thread_robot.dart';
|
||||||
|
import 'login_with_basic_auth_scenario.dart';
|
||||||
|
|
||||||
|
class AppGridScenario extends BaseScenario {
|
||||||
|
|
||||||
|
final LoginWithBasicAuthScenario loginWithBasicAuthScenario;
|
||||||
|
|
||||||
|
AppGridScenario(
|
||||||
|
super.$,
|
||||||
|
{
|
||||||
|
required this.loginWithBasicAuthScenario
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> execute() async {
|
||||||
|
final threadRobot = ThreadRobot($);
|
||||||
|
final mailboxMenuRobot = MailboxMenuRobot($);
|
||||||
|
final appGridRobot = AppGridRobot($);
|
||||||
|
|
||||||
|
await loginWithBasicAuthScenario.execute();
|
||||||
|
|
||||||
|
await threadRobot.openMailbox();
|
||||||
|
await _expectMailboxViewVisible();
|
||||||
|
await _expectAppGridViewVisible();
|
||||||
|
|
||||||
|
await Future.delayed(const Duration(seconds: 2));
|
||||||
|
|
||||||
|
await mailboxMenuRobot.openAppGrid();
|
||||||
|
await _expectListViewAppGridVisible();
|
||||||
|
await _expectAllAppInAppGridDisplayedIsFull();
|
||||||
|
|
||||||
|
await appGridRobot.openAppInAppGridByAppName('Twake Drive');
|
||||||
|
await Future.delayed(const Duration(seconds: 2));
|
||||||
|
|
||||||
|
if (PlatformInfo.isAndroid) {
|
||||||
|
await $.native.pressBack();
|
||||||
|
|
||||||
|
await appGridRobot.openAppInAppGridByAppName('Twake Sync');
|
||||||
|
await Future.delayed(const Duration(seconds: 2));
|
||||||
|
|
||||||
|
await $.native.pressBack();
|
||||||
|
|
||||||
|
await appGridRobot.openAppInAppGridByAppName('Twake Chat');
|
||||||
|
await Future.delayed(const Duration(seconds: 2));
|
||||||
|
|
||||||
|
await $.native.pressBack();
|
||||||
|
|
||||||
|
await _expectMailboxViewVisible();
|
||||||
|
} else if (PlatformInfo.isIOS) {
|
||||||
|
await _expectMailboxViewInVisible();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectMailboxViewVisible() => expectViewVisible($(MailboxView));
|
||||||
|
|
||||||
|
Future<void> _expectAppGridViewVisible() => expectViewVisible($(AppGridView));
|
||||||
|
|
||||||
|
Future<void> _expectListViewAppGridVisible() => expectViewVisible($(#list_view_app_grid));
|
||||||
|
|
||||||
|
Future<void> _expectAllAppInAppGridDisplayedIsFull() async {
|
||||||
|
int totalApp = PlatformInfo.isIOS ? 2 : 3;
|
||||||
|
expect(find.byType(AppListDashboardItem), findsNWidgets(totalApp));
|
||||||
|
|
||||||
|
final listAppItem = $.tester
|
||||||
|
.widgetList<AppListDashboardItem>(find.byType(AppListDashboardItem));
|
||||||
|
|
||||||
|
final listAppNames = listAppItem.map((item) => item.app.appName).toList();
|
||||||
|
|
||||||
|
if (PlatformInfo.isIOS) {
|
||||||
|
expect(listAppNames, equals(['Twake Drive', 'Twake Chat']));
|
||||||
|
} else {
|
||||||
|
expect(listAppNames, equals(['Twake Drive', 'Twake Chat', 'Twake Sync']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectMailboxViewInVisible() => expectViewInVisible($(MailboxView));
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -67,6 +67,7 @@ class _AppGridViewState extends State<AppGridView> {
|
|||||||
valueListenable: _isCollapsedNotifier,
|
valueListenable: _isCollapsedNotifier,
|
||||||
builder: (context, isCollapsed, child) {
|
builder: (context, isCollapsed, child) {
|
||||||
return TMailButtonWidget.fromIcon(
|
return TMailButtonWidget.fromIcon(
|
||||||
|
key: const Key('toggle_app_grid_button'),
|
||||||
icon: _getCollapseIcon(context, isCollapsed),
|
icon: _getCollapseIcon(context, isCollapsed),
|
||||||
iconColor: isCollapsed
|
iconColor: isCollapsed
|
||||||
? AppColor.colorIconUnSubscribedMailbox
|
? AppColor.colorIconUnSubscribedMailbox
|
||||||
@@ -94,6 +95,7 @@ class _AppGridViewState extends State<AppGridView> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
|
key: const Key('list_view_app_grid'),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
primary: false,
|
primary: false,
|
||||||
padding: const EdgeInsetsDirectional.only(
|
padding: const EdgeInsetsDirectional.only(
|
||||||
|
|||||||
Reference in New Issue
Block a user