-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TF-3260 Add integration test for app grid
- Loading branch information
Showing
10 changed files
with
162 additions
and
6 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
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,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 |
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
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,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(); | ||
} | ||
} |
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,10 @@ | ||
|
||
import '../base/core_robot.dart'; | ||
|
||
class MailboxMenuRobot extends CoreRobot { | ||
MailboxMenuRobot(super.$); | ||
|
||
Future<void> openAppGrid() async { | ||
await $(#toggle_app_grid_button).tap(); | ||
} | ||
} |
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,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)); | ||
} |
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,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(); | ||
} | ||
); | ||
} |
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