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($),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user