TF-4370 Add E2E test for test case create new a tag

This commit is contained in:
dab246
2026-03-12 10:39:15 +07:00
committed by Dat H. Pham
parent 7df25c5f5a
commit 0f9ea3c778
7 changed files with 70 additions and 4 deletions
+1 -1
View File
@@ -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
@@ -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<void> enterNewLabelName(String name) async {
await $(CreateNewLabelModal)
.$(LabelInputFieldBuilder)
await $(#label_name_input_field)
.$(TextFieldBuilder)
.enterText(name);
}
Future<void> enterNewLabelDescription(String description) async {
await $(#label_description_input_field)
.$(TextFieldBuilder)
.enterText(description);
}
Future<void> tapPositiveActionButton(LabelActionType actionType) async {
if (actionType == LabelActionType.create) {
await $(CreateNewLabelModal).$(#create_label_button_action).tap();
@@ -11,4 +11,8 @@ class LabelRobot extends CoreRobot {
await $.scrollUntilVisible(finder: item);
await item.longPress();
}
Future<void> tapCreateNewLabelButton() async {
await $(#labels_bar_widget_add_new_label_button).tap();
}
}
@@ -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<void> 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<void> _expectCreateNewLabelModalVisible() async {
await expectViewVisible($(#create_new_label_modal));
}
Future<void> _expectToastMessageCreateNewLabelSuccessVisible(
String labelName,
) async {
await expectViewVisible(
$(find
.text(AppLocalizations().createLabelSuccessfullyMessage(labelName))),
);
}
}
@@ -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($),
);
}
@@ -281,6 +281,7 @@ class _CreateNewLabelModalState extends State<CreateNewLabelModal> {
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<CreateNewLabelModal> {
Widget _buildLabelDescriptionInputField(AppLocalizations appLocalizations) {
return LabelInputFieldBuilder(
key: const Key('label_description_input_field'),
label: appLocalizations.labelDescription,
hintText: appLocalizations.labelDescriptionHintText,
textEditingController: _descriptionInputController,
@@ -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,