TF-4301 Add E2E tests for label creation and tagging from email view

This commit is contained in:
dab246
2026-03-06 19:08:20 +07:00
committed by Dat H. Pham
parent 190ccc7bc3
commit 1b62990f28
15 changed files with 135 additions and 49 deletions
@@ -21,7 +21,7 @@ mixin LabelModalMixin {
}) async {
return DialogRouter().openDialogModal(
child: CreateNewLabelModal(
key: const Key('create_label_modal'),
key: const Key('create_new_label_modal'),
labels: labels,
accountId: accountId,
imagePaths: imagePaths,
@@ -124,6 +124,7 @@ class _AddLabelToEmailModalState extends State<AddLabelToEmailModal> {
),
),
TMailButtonWidget(
key: const Key('create_a_new_label_button'),
text: appLocalizations.createANewLabel,
icon: _imagePaths.icAddNewFolder,
iconColor: AppColor.primaryMain,
@@ -1,4 +1,5 @@
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/core/session/session.dart';
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
@@ -32,6 +33,7 @@ extension AddLabelToThreadExtension on ThreadDetailController {
final newLabel = await DialogRouter().openDialogModal(
child: AddLabelToEmailModal(
key: const Key('add_label_to_thread_modal'),
labels: labels,
emailLabels: threadLabels,
emailIds: emailIds,
+21 -16
View File
@@ -27,22 +27,27 @@ class DialogRouter {
required String routeName,
required Object? arguments
}) async {
if (PlatformInfo.isWeb) {
_isMapDialogOpened[routeName] = true;
}
_bindingDI(routeName);
try {
if (PlatformInfo.isWeb) {
_isMapDialogOpened[routeName] = true;
}
_bindingDI(routeName);
final returnedValue = await Get.generalDialog(
barrierDismissible: true,
barrierLabel: routeName,
routeSettings: RouteSettings(arguments: arguments),
pageBuilder: (_, __, ___) => _generateView(routeName: routeName)
);
final returnedValue = await Get.generalDialog(
barrierDismissible: true,
barrierLabel: routeName,
routeSettings: RouteSettings(arguments: arguments),
pageBuilder: (_, __, ___) => _generateView(routeName: routeName),
);
if (PlatformInfo.isWeb) {
_isMapDialogOpened.remove(routeName);
return returnedValue;
} catch (e) {
logWarning('DialogRouter::pushGeneralDialog: Exception = $e');
} finally {
if (PlatformInfo.isWeb) {
_isMapDialogOpened.remove(routeName);
}
}
return returnedValue;
}
final RxMap<String, bool> _isMapDialogOpened = RxMap<String, bool>();
@@ -95,10 +100,10 @@ class DialogRouter {
Future<dynamic> openDialogModal({
required Widget child,
required String dialogLabel,
String? dialogLabel,
}) async {
try {
if (PlatformInfo.isWeb) {
if (PlatformInfo.isWeb && dialogLabel != null) {
_isMapDialogOpened[dialogLabel] = true;
}
@@ -110,7 +115,7 @@ class DialogRouter {
} catch (e) {
logWarning('DialogRouter::openDialogModal: Exception = $e');
} finally {
if (PlatformInfo.isWeb) {
if (PlatformInfo.isWeb && dialogLabel != null) {
_isMapDialogOpened.remove(dialogLabel);
}
}