diff --git a/backend-docker/docker-compose.yaml b/backend-docker/docker-compose.yaml index e72833e33..0e984c7f1 100644 --- a/backend-docker/docker-compose.yaml +++ b/backend-docker/docker-compose.yaml @@ -2,7 +2,7 @@ version: "3" services: tmail-backend: - image: linagora/tmail-backend:memory-1.0.6-rc1 + image: linagora/tmail-backend:memory-1.0.16-rc2 container_name: tmail-backend volumes: - ./jwt_publickey:/root/conf/jwt_publickey diff --git a/integration_test/robots/labels/create_label_modal_robot.dart b/integration_test/robots/labels/create_label_modal_robot.dart index 9ebb8de28..34ebeb097 100644 --- a/integration_test/robots/labels/create_label_modal_robot.dart +++ b/integration_test/robots/labels/create_label_modal_robot.dart @@ -1,6 +1,5 @@ import 'package:core/presentation/views/text/text_field_builder.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:tmail_ui_user/features/base/widget/label_input_field_builder.dart'; import 'package:tmail_ui_user/features/labels/presentation/models/label_action_type.dart'; import 'package:tmail_ui_user/features/labels/presentation/widgets/create_new_label_modal.dart'; @@ -10,12 +9,17 @@ class CreateLabelModalRobot extends CoreRobot { CreateLabelModalRobot(super.$); Future enterNewLabelName(String name) async { - await $(CreateNewLabelModal) - .$(LabelInputFieldBuilder) + await $(#label_name_input_field) .$(TextFieldBuilder) .enterText(name); } + Future enterNewLabelDescription(String description) async { + await $(#label_description_input_field) + .$(TextFieldBuilder) + .enterText(description); + } + Future tapPositiveActionButton(LabelActionType actionType) async { if (actionType == LabelActionType.create) { await $(CreateNewLabelModal).$(#create_label_button_action).tap(); diff --git a/integration_test/robots/labels/label_robot.dart b/integration_test/robots/labels/label_robot.dart index 67a7f2928..54b0df67d 100644 --- a/integration_test/robots/labels/label_robot.dart +++ b/integration_test/robots/labels/label_robot.dart @@ -11,4 +11,8 @@ class LabelRobot extends CoreRobot { await $.scrollUntilVisible(finder: item); await item.longPress(); } + + Future tapCreateNewLabelButton() async { + await $(#labels_bar_widget_add_new_label_button).tap(); + } } diff --git a/integration_test/scenarios/labels/create_new_a_tag_scenario.dart b/integration_test/scenarios/labels/create_new_a_tag_scenario.dart new file mode 100644 index 000000000..35a4f8918 --- /dev/null +++ b/integration_test/scenarios/labels/create_new_a_tag_scenario.dart @@ -0,0 +1,45 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:tmail_ui_user/features/labels/presentation/models/label_action_type.dart'; +import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; + +import '../../base/base_test_scenario.dart'; +import '../../robots/labels/create_label_modal_robot.dart'; +import '../../robots/labels/label_robot.dart'; +import '../../robots/thread_robot.dart'; + +class CreateNewATagScenario extends BaseTestScenario { + const CreateNewATagScenario(super.$); + + @override + Future runTestLogic() async { + final threadRobot = ThreadRobot($); + final labelRobot = LabelRobot($); + final createLabelModalRobot = CreateLabelModalRobot($); + + await threadRobot.openMailbox(); + await labelRobot.tapCreateNewLabelButton(); + await $.pumpAndTrySettle(); + await _expectCreateNewLabelModalVisible(); + + const newLabelName = 'Create new tag 1'; + const newLabelDescription = 'Description tag 1'; + await createLabelModalRobot.enterNewLabelName(newLabelName); + await createLabelModalRobot.enterNewLabelDescription(newLabelDescription); + await createLabelModalRobot.tapPositiveActionButton(LabelActionType.create); + await $.pumpAndTrySettle(); + await _expectToastMessageCreateNewLabelSuccessVisible(newLabelName); + } + + Future _expectCreateNewLabelModalVisible() async { + await expectViewVisible($(#create_new_label_modal)); + } + + Future _expectToastMessageCreateNewLabelSuccessVisible( + String labelName, + ) async { + await expectViewVisible( + $(find + .text(AppLocalizations().createLabelSuccessfullyMessage(labelName))), + ); + } +} diff --git a/integration_test/tests/labels/create_new_a_tag_test.dart b/integration_test/tests/labels/create_new_a_tag_test.dart new file mode 100644 index 000000000..b87b3e9a5 --- /dev/null +++ b/integration_test/tests/labels/create_new_a_tag_test.dart @@ -0,0 +1,10 @@ +import '../../base/test_base.dart'; +import '../../scenarios/labels/create_new_a_tag_scenario.dart'; + +void main() { + TestBase().runPatrolTest( + description: + 'Should show toast success when create new a label successfully', + scenarioBuilder: ($) => CreateNewATagScenario($), + ); +} diff --git a/lib/features/labels/presentation/widgets/create_new_label_modal.dart b/lib/features/labels/presentation/widgets/create_new_label_modal.dart index f2c52fed2..ce1947239 100644 --- a/lib/features/labels/presentation/widgets/create_new_label_modal.dart +++ b/lib/features/labels/presentation/widgets/create_new_label_modal.dart @@ -281,6 +281,7 @@ class _CreateNewLabelModalState extends State { valueListenable: _labelNameErrorTextNotifier, builder: (_, errorText, __) { return LabelInputFieldBuilder( + key: const Key('label_name_input_field'), label: appLocalizations.labelName, hintText: appLocalizations .pleaseEnterNameYourNewLabel, @@ -309,6 +310,7 @@ class _CreateNewLabelModalState extends State { Widget _buildLabelDescriptionInputField(AppLocalizations appLocalizations) { return LabelInputFieldBuilder( + key: const Key('label_description_input_field'), label: appLocalizations.labelDescription, hintText: appLocalizations.labelDescriptionHintText, textEditingController: _descriptionInputController, diff --git a/lib/features/mailbox/presentation/widgets/labels/labels_bar_widget.dart b/lib/features/mailbox/presentation/widgets/labels/labels_bar_widget.dart index fbfa3af02..16b6e528c 100644 --- a/lib/features/mailbox/presentation/widgets/labels/labels_bar_widget.dart +++ b/lib/features/mailbox/presentation/widgets/labels/labels_bar_widget.dart @@ -35,6 +35,7 @@ class LabelsBarWidget extends StatelessWidget { @override Widget build(BuildContext context) { Widget addNewLabelIcon = TMailButtonWidget.fromIcon( + key: const Key('labels_bar_widget_add_new_label_button'), icon: imagePaths.icAddNewFolder, backgroundColor: Colors.transparent, iconColor: AppColor.steelGrayA540,