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
@@ -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))),
);
}
}