TF-4243 Add integration test on mobile for case delete_a_label
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
import 'package:core/presentation/views/dialog/confirm_dialog_button.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
import '../base/core_robot.dart';
|
||||||
|
|
||||||
|
class ConfirmDialogRobot extends CoreRobot {
|
||||||
|
ConfirmDialogRobot(super.$);
|
||||||
|
|
||||||
|
Future<void> selectActionByName(String name) async {
|
||||||
|
await $(ConfirmDialogButton).$(name).tap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import 'package:core/utils/platform_info.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/labels/label_list_view.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/confirm_dialog_robot.dart';
|
||||||
|
import '../../robots/labels/label_action_type_context_menu_robot.dart';
|
||||||
|
import '../../robots/labels/label_robot.dart';
|
||||||
|
import '../../robots/thread_robot.dart';
|
||||||
|
|
||||||
|
class DeleteATagScenario extends BaseTestScenario
|
||||||
|
with ProvisioningLabelScenarioMixin {
|
||||||
|
const DeleteATagScenario(super.$);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> setupPreLogin() async {
|
||||||
|
PlatformInfo.isIntegrationTesting = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> runTestLogic() async {
|
||||||
|
final threadRobot = ThreadRobot($);
|
||||||
|
final labelRobot = LabelRobot($);
|
||||||
|
final labelActionTypeContextMenuRobot = LabelActionTypeContextMenuRobot($);
|
||||||
|
final confirmDialogRobot = ConfirmDialogRobot($);
|
||||||
|
final appLocalizations = AppLocalizations();
|
||||||
|
|
||||||
|
await provisionLabelsByDisplayNames(['Delete Tag 1', 'Delete Tag 2']);
|
||||||
|
await $.pumpAndSettle(duration: const Duration(seconds: 2));
|
||||||
|
|
||||||
|
await threadRobot.openMailbox();
|
||||||
|
await labelRobot.longPressLabelWithName('Delete Tag 1');
|
||||||
|
await _expectLabelActionTypeContextMenuVisible();
|
||||||
|
|
||||||
|
await labelActionTypeContextMenuRobot.selectActionByName(
|
||||||
|
appLocalizations.delete,
|
||||||
|
);
|
||||||
|
await _expectDeleteLabelConfirmDialogVisible();
|
||||||
|
|
||||||
|
await confirmDialogRobot.selectActionByName(appLocalizations.delete);
|
||||||
|
await $.pumpAndSettle(duration: const Duration(seconds: 1));
|
||||||
|
await _expectLabelDeletedByName('Delete Tag 1');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectLabelActionTypeContextMenuVisible() async {
|
||||||
|
await expectViewVisible($(#label_action_type_context_menu));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectDeleteLabelConfirmDialogVisible() async {
|
||||||
|
await expectViewVisible($(#confirm_dialog_delete_label));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _expectLabelDeletedByName(String name) async {
|
||||||
|
await expectViewInvisible($(LabelListView).$(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> disposeAfterTest() async {
|
||||||
|
PlatformInfo.isIntegrationTesting = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import '../../base/test_base.dart';
|
||||||
|
import '../../scenarios/labels/delete_a_tag_scenario.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestBase().runPatrolTest(
|
||||||
|
description:
|
||||||
|
'Should delete label in label list when delete a label successfully',
|
||||||
|
scenarioBuilder: ($) => DeleteATagScenario($),
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user