TF-4370 Add E2E test for test case create new a tag
This commit is contained in:
@@ -2,7 +2,7 @@ version: "3"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
tmail-backend:
|
tmail-backend:
|
||||||
image: linagora/tmail-backend:memory-1.0.6-rc1
|
image: linagora/tmail-backend:memory-1.0.16-rc2
|
||||||
container_name: tmail-backend
|
container_name: tmail-backend
|
||||||
volumes:
|
volumes:
|
||||||
- ./jwt_publickey:/root/conf/jwt_publickey
|
- ./jwt_publickey:/root/conf/jwt_publickey
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:core/presentation/views/text/text_field_builder.dart';
|
import 'package:core/presentation/views/text/text_field_builder.dart';
|
||||||
import 'package:flutter_test/flutter_test.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/models/label_action_type.dart';
|
||||||
import 'package:tmail_ui_user/features/labels/presentation/widgets/create_new_label_modal.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.$);
|
CreateLabelModalRobot(super.$);
|
||||||
|
|
||||||
Future<void> enterNewLabelName(String name) async {
|
Future<void> enterNewLabelName(String name) async {
|
||||||
await $(CreateNewLabelModal)
|
await $(#label_name_input_field)
|
||||||
.$(LabelInputFieldBuilder)
|
|
||||||
.$(TextFieldBuilder)
|
.$(TextFieldBuilder)
|
||||||
.enterText(name);
|
.enterText(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> enterNewLabelDescription(String description) async {
|
||||||
|
await $(#label_description_input_field)
|
||||||
|
.$(TextFieldBuilder)
|
||||||
|
.enterText(description);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> tapPositiveActionButton(LabelActionType actionType) async {
|
Future<void> tapPositiveActionButton(LabelActionType actionType) async {
|
||||||
if (actionType == LabelActionType.create) {
|
if (actionType == LabelActionType.create) {
|
||||||
await $(CreateNewLabelModal).$(#create_label_button_action).tap();
|
await $(CreateNewLabelModal).$(#create_label_button_action).tap();
|
||||||
|
|||||||
@@ -11,4 +11,8 @@ class LabelRobot extends CoreRobot {
|
|||||||
await $.scrollUntilVisible(finder: item);
|
await $.scrollUntilVisible(finder: item);
|
||||||
await item.longPress();
|
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,
|
valueListenable: _labelNameErrorTextNotifier,
|
||||||
builder: (_, errorText, __) {
|
builder: (_, errorText, __) {
|
||||||
return LabelInputFieldBuilder(
|
return LabelInputFieldBuilder(
|
||||||
|
key: const Key('label_name_input_field'),
|
||||||
label: appLocalizations.labelName,
|
label: appLocalizations.labelName,
|
||||||
hintText: appLocalizations
|
hintText: appLocalizations
|
||||||
.pleaseEnterNameYourNewLabel,
|
.pleaseEnterNameYourNewLabel,
|
||||||
@@ -309,6 +310,7 @@ class _CreateNewLabelModalState extends State<CreateNewLabelModal> {
|
|||||||
|
|
||||||
Widget _buildLabelDescriptionInputField(AppLocalizations appLocalizations) {
|
Widget _buildLabelDescriptionInputField(AppLocalizations appLocalizations) {
|
||||||
return LabelInputFieldBuilder(
|
return LabelInputFieldBuilder(
|
||||||
|
key: const Key('label_description_input_field'),
|
||||||
label: appLocalizations.labelDescription,
|
label: appLocalizations.labelDescription,
|
||||||
hintText: appLocalizations.labelDescriptionHintText,
|
hintText: appLocalizations.labelDescriptionHintText,
|
||||||
textEditingController: _descriptionInputController,
|
textEditingController: _descriptionInputController,
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class LabelsBarWidget extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Widget addNewLabelIcon = TMailButtonWidget.fromIcon(
|
Widget addNewLabelIcon = TMailButtonWidget.fromIcon(
|
||||||
|
key: const Key('labels_bar_widget_add_new_label_button'),
|
||||||
icon: imagePaths.icAddNewFolder,
|
icon: imagePaths.icAddNewFolder,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
iconColor: AppColor.steelGrayA540,
|
iconColor: AppColor.steelGrayA540,
|
||||||
|
|||||||
Reference in New Issue
Block a user