TF-4229 Add integration test on mobile for case edit_a_tag_scenario
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
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/widgets/create_new_label_modal.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
import '../../base/core_robot.dart';
|
||||||
|
|
||||||
|
class CreateLabelModalRobot extends CoreRobot {
|
||||||
|
CreateLabelModalRobot(super.$);
|
||||||
|
|
||||||
|
Future<void> enterNewLabelName(String name) async {
|
||||||
|
await $(CreateNewLabelModal)
|
||||||
|
.$(LabelInputFieldBuilder)
|
||||||
|
.$(TextFieldBuilder)
|
||||||
|
.enterText(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> tapSaveButton() async {
|
||||||
|
await $(CreateNewLabelModal).$(AppLocalizations().save).tap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/features/base/widget/context_menu/context_menu_dialog_item.dart';
|
||||||
|
|
||||||
|
import '../../base/core_robot.dart';
|
||||||
|
|
||||||
|
class LabelActionTypeContextMenuRobot extends CoreRobot {
|
||||||
|
LabelActionTypeContextMenuRobot(super.$);
|
||||||
|
|
||||||
|
Future<void> selectActionByName(String name) async {
|
||||||
|
final item = $(ContextMenuDialogItem).$(name);
|
||||||
|
await $.scrollUntilVisible(finder: item);
|
||||||
|
await item.tap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/features/base/widget/context_menu/context_menu_dialog_item.dart';
|
||||||
|
|
||||||
|
import '../../base/core_robot.dart';
|
||||||
|
|
||||||
|
class LabelListContextMenuRobot extends CoreRobot {
|
||||||
|
LabelListContextMenuRobot(super.$);
|
||||||
|
|
||||||
|
Future<void> selectLabelByName(String name) async {
|
||||||
|
final item = $(ContextMenuDialogItem).$(name);
|
||||||
|
await $.scrollUntilVisible(finder: item);
|
||||||
|
await item.tap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/labels/label_list_item.dart';
|
||||||
|
|
||||||
|
import '../../base/core_robot.dart';
|
||||||
|
|
||||||
|
class LabelRobot extends CoreRobot {
|
||||||
|
LabelRobot(super.$);
|
||||||
|
|
||||||
|
Future<void> longPressLabelWithName(String name) async {
|
||||||
|
final item = $(LabelListItem).$(name);
|
||||||
|
await $.scrollUntilVisible(finder: item);
|
||||||
|
await item.longPress();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import 'package:core/utils/platform_info.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
|
|
||||||
|
import '../../base/base_test_scenario.dart';
|
||||||
|
import '../../mixin/provisioning_label_scenario_mixin.dart';
|
||||||
|
import '../../robots/labels/create_label_modal_robot.dart';
|
||||||
|
import '../../robots/labels/label_action_type_context_menu_robot.dart';
|
||||||
|
import '../../robots/labels/label_robot.dart';
|
||||||
|
import '../../robots/thread_robot.dart';
|
||||||
|
|
||||||
|
class EditATagScenario extends BaseTestScenario
|
||||||
|
with ProvisioningLabelScenarioMixin {
|
||||||
|
const EditATagScenario(super.$);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> setupPreLogin() async {
|
||||||
|
PlatformInfo.isIntegrationTesting = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> runTestLogic() async {
|
||||||
|
final threadRobot = ThreadRobot($);
|
||||||
|
final labelRobot = LabelRobot($);
|
||||||
|
final labelActionTypeContextMenuRobot = LabelActionTypeContextMenuRobot($);
|
||||||
|
final createLabelModalRobot = CreateLabelModalRobot($);
|
||||||
|
final appLocalizations = AppLocalizations();
|
||||||
|
|
||||||
|
await provisionLabelsByDisplayNames(['Edit Tag 1', 'Edit Tag 2']);
|
||||||
|
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||||
|
|
||||||
|
await threadRobot.openMailbox();
|
||||||
|
await labelRobot.longPressLabelWithName('Edit Tag 1');
|
||||||
|
await _expectLabelActionTypeContextMenuVisible();
|
||||||
|
|
||||||
|
await labelActionTypeContextMenuRobot.selectActionByName(
|
||||||
|
appLocalizations.edit,
|
||||||
|
);
|
||||||
|
await _expectEditLabelModalVisible();
|
||||||
|
|
||||||
|
const newLabelName = 'New edit tag 1';
|
||||||
|
await createLabelModalRobot.enterNewLabelName(newLabelName);
|
||||||
|
await createLabelModalRobot.tapSaveButton();
|
||||||
|
await _expectLabelWithNewNameUpdated(newLabelName);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectLabelActionTypeContextMenuVisible() async {
|
||||||
|
await expectViewVisible($(#label_action_type_context_menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectEditLabelModalVisible() async {
|
||||||
|
await expectViewVisible($(#edit_label_modal));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectLabelWithNewNameUpdated(String name) async {
|
||||||
|
await expectViewVisible($(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> disposeAfterTest() async {
|
||||||
|
PlatformInfo.isIntegrationTesting = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import '../../base/test_base.dart';
|
||||||
|
import '../../scenarios/labels/edit_a_tag_scenario.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestBase().runPatrolTest(
|
||||||
|
description:
|
||||||
|
'Should update label display name when edit a label successfully',
|
||||||
|
scenarioBuilder: ($) => EditATagScenario($),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:core/utils/app_logger.dart';
|
import 'package:core/utils/app_logger.dart';
|
||||||
import 'package:dartz/dartz.dart';
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||||
import 'package:labels/extensions/list_label_extension.dart';
|
import 'package:labels/extensions/list_label_extension.dart';
|
||||||
import 'package:labels/model/label.dart';
|
import 'package:labels/model/label.dart';
|
||||||
@@ -42,6 +43,7 @@ extension HandleLabelActionTypeExtension on LabelController {
|
|||||||
|
|
||||||
await DialogRouter().openDialogModal(
|
await DialogRouter().openDialogModal(
|
||||||
child: CreateNewLabelModal(
|
child: CreateNewLabelModal(
|
||||||
|
key: const Key('edit_label_modal'),
|
||||||
labels: labels,
|
labels: labels,
|
||||||
selectedLabel: label,
|
selectedLabel: label,
|
||||||
actionType: LabelActionType.edit,
|
actionType: LabelActionType.edit,
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ mixin LabelContextMenuMixin on PopupContextMenuActionMixin {
|
|||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
return openBottomSheetContextMenuAction(
|
return openBottomSheetContextMenuAction(
|
||||||
|
key: const Key('label_action_type_context_menu'),
|
||||||
context: context,
|
context: context,
|
||||||
itemActions: contextMenuActions,
|
itemActions: contextMenuActions,
|
||||||
onContextMenuActionClick: (menuAction) {
|
onContextMenuActionClick: (menuAction) {
|
||||||
|
|||||||
Reference in New Issue
Block a user