TF-3605 E2E Mailbox create, rename, move and delete sub folder
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||
|
||||
import 'package:core/presentation/views/text/text_field_builder.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/label_mailbox_item_widget.dart';
|
||||
@@ -42,29 +44,26 @@ class MailboxMenuRobot extends CoreRobot {
|
||||
await $(AppLocalizations().newSubfolder).tap();
|
||||
}
|
||||
|
||||
Future<void> enterNewSubFolderName(String name) async {
|
||||
Future<void> enterNewFolderName(String name) async {
|
||||
await $(MailboxCreatorView)
|
||||
.$(TextFieldBuilder)
|
||||
.enterText(name);
|
||||
.$(TextFieldBuilder)
|
||||
.enterText(name);
|
||||
}
|
||||
|
||||
Future<void> confirmCreateNewSubFolder() async {
|
||||
Future<void> confirmCreateNewFolder() async {
|
||||
await $(MailboxCreatorView)
|
||||
.$(AppLocalizations().done)
|
||||
.tap();
|
||||
.$(AppLocalizations().createFolder)
|
||||
.tap();
|
||||
}
|
||||
|
||||
Future<void> expandMailboxWithName(String name) async {
|
||||
await $(MailboxItemWidget)
|
||||
.which<MailboxItemWidget>((widget) {
|
||||
return widget.mailboxNode.item.name?.name.toLowerCase() ==
|
||||
name.toLowerCase();
|
||||
})
|
||||
.$(TMailButtonWidget)
|
||||
.which<TMailButtonWidget>((widget) {
|
||||
return widget.icon == ImagePaths().icArrowRight;
|
||||
})
|
||||
.tap();
|
||||
.which<MailboxItemWidget>((widget) {
|
||||
return widget.mailboxNode.item.name?.name.toLowerCase() ==
|
||||
name.toLowerCase();
|
||||
})
|
||||
.$(#expand_mailbox_button)
|
||||
.tap();
|
||||
}
|
||||
|
||||
Future<void> openMailboxSearch() async {
|
||||
@@ -137,4 +136,43 @@ class MailboxMenuRobot extends CoreRobot {
|
||||
await $(AppLocalizations().restore).tap();
|
||||
await $.pumpAndSettle();
|
||||
}
|
||||
|
||||
Future<void> tapRenameMailbox() async {
|
||||
await $(AppLocalizations().renameFolder).tap();
|
||||
}
|
||||
|
||||
Future<void> enterRenameSubFolderName(String name) async {
|
||||
await $(#rename_mailbox_dialog)
|
||||
.$(TextField)
|
||||
.enterText(name);
|
||||
await $.pumpAndSettle(duration: const Duration(seconds: 1));
|
||||
}
|
||||
|
||||
Future<void> confirmRenameSubFolder() async {
|
||||
await $(#rename_mailbox_dialog)
|
||||
.$(AppLocalizations().rename.toUpperCase())
|
||||
.tap();
|
||||
}
|
||||
|
||||
Future<void> tapMoveMailbox() async {
|
||||
await $(AppLocalizations().moveFolder).tap();
|
||||
}
|
||||
|
||||
Future<void> tapMailboxWithName(String name) async {
|
||||
await $(name).tap();
|
||||
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||
}
|
||||
|
||||
Future<void> tapDeleteMailbox() async {
|
||||
await $(AppLocalizations().deleteFolder).tap();
|
||||
}
|
||||
|
||||
Future<void> confirmDeleteMailbox() async {
|
||||
await $(AppLocalizations().delete).tap();
|
||||
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||
}
|
||||
|
||||
Future<void> tapAddNewFolderButton() async {
|
||||
await $(#add_new_folder_button).tap();
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,8 @@ class CreateAndHideSubFolderScenario extends BaseTestScenario {
|
||||
appLocalizations.inboxMailboxDisplayName,
|
||||
);
|
||||
await mailboxMenuRobot.tapCreateNewSubFolder();
|
||||
await mailboxMenuRobot.enterNewSubFolderName(subFolderName);
|
||||
await mailboxMenuRobot.confirmCreateNewSubFolder();
|
||||
await mailboxMenuRobot.enterNewFolderName(subFolderName);
|
||||
await mailboxMenuRobot.confirmCreateNewFolder();
|
||||
await _expectMailboxWithNameVisible(subFolderName);
|
||||
|
||||
await threadRobot.openMailbox();
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../../base/base_test_scenario.dart';
|
||||
import '../../robots/mailbox_menu_robot.dart';
|
||||
import '../../robots/thread_robot.dart';
|
||||
|
||||
class CreatePersonalFolderScenario extends BaseTestScenario {
|
||||
const CreatePersonalFolderScenario(super.$);
|
||||
|
||||
@override
|
||||
Future<void> runTestLogic() async {
|
||||
const folderName = 'crud personal folder';
|
||||
|
||||
final threadRobot = ThreadRobot($);
|
||||
final mailboxMenuRobot = MailboxMenuRobot($);
|
||||
|
||||
await threadRobot.openMailbox();
|
||||
await mailboxMenuRobot.tapAddNewFolderButton();
|
||||
await mailboxMenuRobot.enterNewFolderName(folderName);
|
||||
await mailboxMenuRobot.confirmCreateNewFolder();
|
||||
await _expectMailboxWithNameVisible(folderName);
|
||||
}
|
||||
|
||||
Future<void> _expectMailboxWithNameVisible(String name) async {
|
||||
await expectViewVisible($(name));
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/mailbox_item_widget.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
import '../../base/base_test_scenario.dart';
|
||||
import '../../robots/mailbox_menu_robot.dart';
|
||||
import '../../robots/thread_robot.dart';
|
||||
|
||||
class CreateRenameMoveAndDeleteMailboxScenario extends BaseTestScenario {
|
||||
const CreateRenameMoveAndDeleteMailboxScenario(super.$);
|
||||
|
||||
@override
|
||||
Future<void> runTestLogic() async {
|
||||
const subFolderName = 'crud sub folder';
|
||||
const subFolderRenamedName = 'renamed sub folder';
|
||||
|
||||
final threadRobot = ThreadRobot($);
|
||||
final mailboxMenuRobot = MailboxMenuRobot($);
|
||||
final appLocalizations = AppLocalizations();
|
||||
|
||||
// Create sub folder
|
||||
await threadRobot.openMailbox();
|
||||
await mailboxMenuRobot.longPressMailboxWithName(
|
||||
appLocalizations.inboxMailboxDisplayName,
|
||||
);
|
||||
await mailboxMenuRobot.tapCreateNewSubFolder();
|
||||
await mailboxMenuRobot.enterNewFolderName(subFolderName);
|
||||
await mailboxMenuRobot.confirmCreateNewFolder();
|
||||
await _expectMailboxWithNameVisible(subFolderName);
|
||||
|
||||
// Rename sub folder
|
||||
await threadRobot.openMailbox();
|
||||
await mailboxMenuRobot.expandMailboxWithName(
|
||||
appLocalizations.inboxMailboxDisplayName
|
||||
);
|
||||
await mailboxMenuRobot.longPressMailboxWithName(subFolderName);
|
||||
await mailboxMenuRobot.tapRenameMailbox();
|
||||
await mailboxMenuRobot.enterRenameSubFolderName(subFolderRenamedName);
|
||||
await mailboxMenuRobot.confirmRenameSubFolder();
|
||||
await _expectMailboxWithNameVisible(subFolderRenamedName);
|
||||
|
||||
// Move sub folder to archive mailbox
|
||||
await mailboxMenuRobot.longPressMailboxWithName(subFolderRenamedName);
|
||||
await mailboxMenuRobot.tapMoveMailbox();
|
||||
await mailboxMenuRobot.tapMailboxWithName(appLocalizations.archiveMailboxDisplayName);
|
||||
await _expectMailboxWithNameHaveSubFolder(appLocalizations.archiveMailboxDisplayName);
|
||||
|
||||
// Delete sub folder
|
||||
await mailboxMenuRobot.expandMailboxWithName(appLocalizations.archiveMailboxDisplayName);
|
||||
await mailboxMenuRobot.longPressMailboxWithName(subFolderRenamedName);
|
||||
await mailboxMenuRobot.tapDeleteMailbox();
|
||||
await mailboxMenuRobot.confirmDeleteMailbox();
|
||||
await _expectMailboxWithNameNotHaveSubFolder(appLocalizations.archiveMailboxDisplayName);
|
||||
}
|
||||
|
||||
Future<void> _expectMailboxWithNameVisible(String name) async {
|
||||
await expectViewVisible($(name));
|
||||
}
|
||||
|
||||
Future<void> _expectMailboxWithNameHaveSubFolder(String name) async {
|
||||
await expectViewVisible(
|
||||
$(MailboxItemWidget).which<MailboxItemWidget>((widget) {
|
||||
return widget.mailboxNode.item.name?.name.toLowerCase() == name.toLowerCase()
|
||||
&& widget.mailboxNode.hasChildren();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _expectMailboxWithNameNotHaveSubFolder(String name) async {
|
||||
await expectViewVisible(
|
||||
$(MailboxItemWidget).which<MailboxItemWidget>((widget) {
|
||||
return widget.mailboxNode.item.name?.name.toLowerCase() == name.toLowerCase()
|
||||
&& !widget.mailboxNode.hasChildren();
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../scenarios/mailbox/create_personal_folder_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should create personal mailbox successfully',
|
||||
scenarioBuilder: ($) => CreatePersonalFolderScenario($),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import '../../base/test_base.dart';
|
||||
import '../../scenarios/mailbox/create_rename_move_and_delete_mailbox_scenario.dart';
|
||||
|
||||
void main() {
|
||||
TestBase().runPatrolTest(
|
||||
description: 'Should create, rename, move and delete mailbox successfully',
|
||||
scenarioBuilder: ($) => CreateRenameMoveAndDeleteMailboxScenario($),
|
||||
);
|
||||
}
|
||||
@@ -55,6 +55,7 @@ class FoldersBarWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget newFolderIcon = TMailButtonWidget.fromIcon(
|
||||
key: const Key('add_new_folder_button'),
|
||||
icon: imagePaths.icAddNewFolder,
|
||||
backgroundColor: Colors.transparent,
|
||||
iconColor: AppColor.steelGrayA540,
|
||||
|
||||
@@ -28,6 +28,7 @@ class MailboxExpandButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TMailButtonWidget.fromIcon(
|
||||
key: const Key('expand_mailbox_button'),
|
||||
icon: mailboxNode.expandMode.getIcon(
|
||||
imagePaths,
|
||||
DirectionUtils.isDirectionRTLByLanguage(context),
|
||||
|
||||
+2
-2
@@ -1637,10 +1637,10 @@ packages:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: patrol_finders
|
||||
sha256: "4c6d78e00362fd15d7c21cfac110e501d08ada7d77000bad139b0c3c2e27ccaf"
|
||||
sha256: "8787f9d5c3417b72e8959a55ad51c024cc0594d15e5db85bc179c4d8faa0c493"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.7.0"
|
||||
version: "2.7.2"
|
||||
patrol_log:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
||||
+1
-1
@@ -293,7 +293,7 @@ dev_dependencies:
|
||||
|
||||
patrol_log: 0.3.0
|
||||
|
||||
patrol_finders: 2.7.0
|
||||
patrol_finders: 2.7.2
|
||||
|
||||
plugin_platform_interface: 2.1.8
|
||||
|
||||
|
||||
Reference in New Issue
Block a user