diff --git a/integration_test/robots/mailbox_menu_robot.dart b/integration_test/robots/mailbox_menu_robot.dart index b28944989e..5a87248e53 100644 --- a/integration_test/robots/mailbox_menu_robot.dart +++ b/integration_test/robots/mailbox_menu_robot.dart @@ -88,4 +88,13 @@ class MailboxMenuRobot extends CoreRobot { return inboxCount; } + + Future tapSignOut() async { + await $.scrollUntilVisible(finder: $(AppLocalizations().sign_out)); + await $(AppLocalizations().sign_out).tap(); + } + + Future confirmSignOut() async { + await $(AppLocalizations().yesLogout).tap(); + } } \ No newline at end of file diff --git a/integration_test/scenarios/misc/log_out_scenario.dart b/integration_test/scenarios/misc/log_out_scenario.dart new file mode 100644 index 0000000000..34397bdea6 --- /dev/null +++ b/integration_test/scenarios/misc/log_out_scenario.dart @@ -0,0 +1,26 @@ +import 'package:tmail_ui_user/features/starting_page/presentation/twake_welcome/twake_welcome_view.dart'; + +import '../../base/base_test_scenario.dart'; +import '../../robots/mailbox_menu_robot.dart'; +import '../../robots/thread_robot.dart'; + +class LogOutScenario extends BaseTestScenario { + const LogOutScenario(super.$); + + @override + Future runTestLogic() async { + final threadRobot = ThreadRobot($); + final mailboxMenuRobot = MailboxMenuRobot($); + + await threadRobot.openMailbox(); + await mailboxMenuRobot.openSetting(); + await mailboxMenuRobot.tapSignOut(); + await mailboxMenuRobot.confirmSignOut(); + + await _expectTwakeWelcomeViewVisible(); + } + + Future _expectTwakeWelcomeViewVisible() async { + await expectViewVisible($(TwakeWelcomeView)); + } +} \ No newline at end of file diff --git a/integration_test/tests/misc/log_out_test.dart b/integration_test/tests/misc/log_out_test.dart new file mode 100644 index 0000000000..1b1c3987e2 --- /dev/null +++ b/integration_test/tests/misc/log_out_test.dart @@ -0,0 +1,9 @@ +import '../../base/test_base.dart'; +import '../../scenarios/misc/log_out_scenario.dart'; + +void main() { + TestBase().runPatrolTest( + description: 'Should see Twake welcome screen when log out successfully', + scenarioBuilder: ($) => LogOutScenario($), + ); +} \ No newline at end of file diff --git a/lib/features/composer/presentation/controller/rich_text_web_controller.dart b/lib/features/composer/presentation/controller/rich_text_web_controller.dart index a62993140b..01a327717c 100644 --- a/lib/features/composer/presentation/controller/rich_text_web_controller.dart +++ b/lib/features/composer/presentation/controller/rich_text_web_controller.dart @@ -4,6 +4,7 @@ import 'dart:convert'; import 'package:core/presentation/extensions/color_extension.dart'; import 'package:core/utils/app_logger.dart'; import 'package:core/utils/html/html_utils.dart'; +import 'package:core/utils/platform_info.dart'; import 'package:custom_pop_up_menu/custom_pop_up_menu.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; @@ -318,7 +319,9 @@ class RichTextWebController extends GetxController { void onClose() { menuParagraphController.dispose(); menuOrderListController.dispose(); - editorController.clear(); + if (PlatformInfo.isWeb || editorController.editorController != null) { + editorController.clear(); + } super.onClose(); } } \ No newline at end of file