From 2b415bdc5359f424fbfcabf1b5319bc3a8595921 Mon Sep 17 00:00:00 2001 From: Valentina1133 <141633821+Valentina1133@users.noreply.github.com> Date: Thu, 18 Jul 2024 17:57:24 +0700 Subject: [PATCH] test: block and unblock user test added (#15577) --- test/e2e/constants/community_settings.py | 10 ++ .../{community => }/kick_member_popup.py | 0 test/e2e/gui/components/profile_popup.py | 20 ++++ .../components/settings/block_user_popup.py | 36 +++++++ .../components/settings/unblock_user_popup.py | 30 ++++++ test/e2e/gui/objects_map/names.py | 20 +++- test/e2e/gui/objects_map/settings_names.py | 3 + test/e2e/gui/screens/community_settings.py | 2 +- test/e2e/gui/screens/settings_messaging.py | 20 +++- test/e2e/tests/user_guide_tests/__init__.py | 3 + .../test_block_unblock_user.py | 102 ++++++++++++++++++ .../AppLayouts/Profile/views/ContactsView.qml | 1 + .../popups/BlockContactConfirmationDialog.qml | 5 + .../UnblockContactConfirmationDialog.qml | 3 + ui/imports/shared/views/ProfileDialogView.qml | 5 + 15 files changed, 255 insertions(+), 5 deletions(-) rename test/e2e/gui/components/{community => }/kick_member_popup.py (100%) create mode 100644 test/e2e/gui/components/settings/block_user_popup.py create mode 100644 test/e2e/gui/components/settings/unblock_user_popup.py create mode 100644 test/e2e/tests/user_guide_tests/__init__.py create mode 100644 test/e2e/tests/user_guide_tests/test_block_unblock_user.py diff --git a/test/e2e/constants/community_settings.py b/test/e2e/constants/community_settings.py index df23cbbaf9..b65e0ed109 100644 --- a/test/e2e/constants/community_settings.py +++ b/test/e2e/constants/community_settings.py @@ -55,7 +55,17 @@ class ToastMessages(Enum): UPDATE_PERMISSION_TOAST = 'Community permission updated' DELETE_PERMISSION_TOAST = 'Community permission deleted' KICKED_USER_TOAST = ' was kicked from ' + BLOCKED_USER_TOAST = ' blocked' + UNBLOCKED_USER_TOAST = ' unblocked' + REMOVED_CONTACT_TOAST = 'Contact removed' class LimitWarnings(Enum): MEMBER_ROLE_LIMIT_WARNING = 'Max of 5 ‘become member’ permissions for this Community has been reached. You will need to delete an existing ‘become member’ permission before you can add a new one.' + + +class BlockPopupWarnings(Enum): + BLOCK_WARNING_PART_1 = 'Blocking a user purges the database of all messages that you’ve previously received from ' + BLOCK_WARNING_PART_2 = ' in all contexts. This can take a moment.' + UNBLOCK_TEXT_1 = 'Unblocking ' + UNBLOCK_TEXT_2 = ' will allow new messages you receive from athletic to reach you.' diff --git a/test/e2e/gui/components/community/kick_member_popup.py b/test/e2e/gui/components/kick_member_popup.py similarity index 100% rename from test/e2e/gui/components/community/kick_member_popup.py rename to test/e2e/gui/components/kick_member_popup.py diff --git a/test/e2e/gui/components/profile_popup.py b/test/e2e/gui/components/profile_popup.py index 48cf5bc44b..2d2ed045a5 100644 --- a/test/e2e/gui/components/profile_popup.py +++ b/test/e2e/gui/components/profile_popup.py @@ -6,8 +6,10 @@ import constants import driver from gui.components.base_popup import BasePopup from gui.components.context_menu import ContextMenu +from gui.components.settings.block_user_popup import BlockUserPopup from gui.components.settings.review_contact_request_popup import AcceptRequestFromProfile from gui.components.settings.send_contact_request_popup import SendContactRequestFromProfile +from gui.components.settings.unblock_user_popup import UnblockUserPopup from gui.components.share_profile_popup import ShareProfilePopup from gui.elements.button import Button from gui.elements.object import QObject @@ -105,7 +107,10 @@ class ProfilePopupFromMembers(ProfilePopup): self._send_request_button = Button(names.send_contact_request_StatusButton) self._review_request_button = Button(names.review_contact_request_StatusButton) self._send_message_button = Button(names.send_Message_StatusButton) + self._unblock_button = Button(names.unblock_user_StatusButton) self._menu_button = Button(names.menuButton_StatusFlatButton) + self._block_user_menu_item = Button(names.block_user_StatusMenuItem) + self._add_nickname_menu_item = Button(names.add_nickname_StatusMenuItem) @allure.step('Click send request button') def send_request(self): @@ -134,3 +139,18 @@ class ProfilePopupFromMembers(ProfilePopup): def choose_context_menu_option(self, value: str): self.click_menu_button() ContextMenu().select(value) + + @allure.step('Block user from menu') + def block_user(self): + self.click_menu_button() + self._block_user_menu_item.click() + return BlockUserPopup().wait_until_appears() + + @allure.step('Get unblock button visibility state') + def is_unblock_button_visible(self): + return self._unblock_button.is_visible + + @allure.step('Unblock user from menu') + def unblock_user(self): + self._unblock_button.click() + return UnblockUserPopup().wait_until_appears() diff --git a/test/e2e/gui/components/settings/block_user_popup.py b/test/e2e/gui/components/settings/block_user_popup.py new file mode 100644 index 0000000000..3e952d9f64 --- /dev/null +++ b/test/e2e/gui/components/settings/block_user_popup.py @@ -0,0 +1,36 @@ +import allure + +import configs +from gui.components.base_popup import BasePopup +from gui.elements.button import Button +from gui.elements.object import QObject +from gui.elements.text_label import TextLabel +from gui.objects_map import names + + +class BlockUserPopup(BasePopup): + + def __init__(self): + super().__init__() + self._block_user_button = Button(names.block_StatusButton) + self._cancel_button = Button(names.cancel_StatusFlatButton) + self._block_warning_box = QObject(names.blockWarningBox_StatusWarningBox) + self._you_will_not_see_text = TextLabel(names.youWillNotSeeText_StatusBaseText) + + + @allure.step('Wait until appears {0}') + def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + self._block_user_button.wait_until_appears(timeout_msec) + return self + + @allure.step('Block user') + def block(self): + self._block_user_button.click() + + @allure.step('Get warning text') + def get_warning_text(self) -> str: + return str(self._block_warning_box.object.text) + + @allure.step('Get you will not see text') + def get_you_will_not_see_text(self) -> str: + return str(self._you_will_not_see_text.text) diff --git a/test/e2e/gui/components/settings/unblock_user_popup.py b/test/e2e/gui/components/settings/unblock_user_popup.py new file mode 100644 index 0000000000..ed3408b760 --- /dev/null +++ b/test/e2e/gui/components/settings/unblock_user_popup.py @@ -0,0 +1,30 @@ +import allure + +import configs +from gui.components.base_popup import BasePopup +from gui.elements.button import Button +from gui.elements.text_label import TextLabel +from gui.objects_map import names + + +class UnblockUserPopup(BasePopup): + + def __init__(self): + super().__init__() + self._unblock_user_button = Button(names.unblock_StatusButton) + self._cancel_button = Button(names.cancel_StatusButton) + self._unblock_text = TextLabel(names.unblockingText_StatusBaseText) + + + @allure.step('Wait until appears {0}') + def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + self._unblock_user_button.wait_until_appears(timeout_msec) + return self + + @allure.step('Unblock user') + def unblock(self): + self._unblock_user_button.click() + + @allure.step('Get warning text') + def get_warning_text(self) -> str: + return self._unblock_text.text diff --git a/test/e2e/gui/objects_map/names.py b/test/e2e/gui/objects_map/names.py index 4ee5fcec1c..5cd6264e16 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -107,6 +107,9 @@ send_contact_request_StatusButton = {"checkable": False, "container": ProfileCon review_contact_request_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "profileDialog_reviewContactRequestButton", "type": "StatusButton", "visible": True} profileDialogView_ContentItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialogView", "type": "ContentItem", "visible": True} menuButton_StatusFlatButton = {"checkable": False, "container": profileDialogView_ContentItem, "id": "menuButton", "type": "StatusFlatButton", "unnamed": 1, "visible": True} +block_user_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "blockUserStatusAction", "type": "StatusMenuItem", "visible": True} +add_nickname_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "addEditNickNameStatusAction", "type": "StatusMenuItem", "visible": True} +unblock_user_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "unblockUserProfileButton", "type": "StatusButton", "visible": True} # Share profile popup o_Image = {"container": statusDesktop_mainWindow_overlay, "objectName": "profileQRCodeImage", "type": "Image", "visible": True} @@ -187,9 +190,6 @@ join_StatusButton = { "container": statusDesktop_mainWindow_overlay, "type": "St welcome_authenticate_StatusButton = {"container": statusDesktop_mainWindow_overlay, "type": "StatusButton", "unnamed": 1, "visible": True} share_your_addresses_to_join_StatusButton = {"container": statusDesktop_mainWindow_overlay, "type": "StatusButton", "unnamed": 1, "visible": True} -# Kick member popup -confirm_kick_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "CommunityMembers_KickModal_KickButton", "type": "StatusButton", "visible": True} - # Pinned messages unpinButton_StatusFlatRoundButton = {"container": statusDesktop_mainWindow_overlay, "id": "unpinButton", "type": "StatusFlatRoundButton", "unnamed": 1, "visible": True} headerActionsCloseButton_StatusFlatRoundButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "headerActionsCloseButton", "type": "StatusFlatRoundButton", "visible": True} @@ -211,6 +211,20 @@ accept_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow # RemoveContactPopup remove_contact_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "removeContactButton", "type": "StatusButton", "visible": True} +# Kick member popup +confirm_kick_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "CommunityMembers_KickModal_KickButton", "type": "StatusButton", "visible": True} + +# Block user popup +blockWarningBox_StatusWarningBox = {"container": statusDesktop_mainWindow_overlay, "objectName": "blockWarningBox", "type": "StatusWarningBox", "visible": True} +youWillNotSeeText_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "objectName": "youWillNotSeeText", "type": "StatusBaseText", "visible": True} +block_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "blockButton", "type": "StatusButton", "visible": True} +cancel_StatusFlatButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "cancelButton", "type": "StatusFlatButton", "visible": True} + +# Unblock user popup +unblock_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "unblockUserButton", "type": "StatusButton", "visible": True} +unblockingText_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "objectName": "unblockingText", "type": "StatusBaseText", "visible": True} +cancel_StatusFlatButton_unblock = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "cancelButton", "type": "StatusFlatButton", "visible": True} + """ Common """ edit_TextEdit = {"container": statusDesktop_mainWindow_overlay, "type": "TextEdit", "unnamed": 1, "visible": True} diff --git a/test/e2e/gui/objects_map/settings_names.py b/test/e2e/gui/objects_map/settings_names.py index dbcfc7d0f6..cec1df5797 100644 --- a/test/e2e/gui/objects_map/settings_names.py +++ b/test/e2e/gui/objects_map/settings_names.py @@ -42,6 +42,7 @@ mainWindow_ContactsView = {"container": statusDesktop_mainWindow, "type": "Conta mainWindow_Send_contact_request_to_chat_key_StatusButton = {"checkable": False, "container": mainWindow_ContactsView, "objectName": "ContactsView_ContactRequest_Button", "type": "StatusButton", "visible": True} contactsTabBar_Pending_Requests_StatusTabButton = {"checkable": True, "container": mainWindow_ContactsView, "objectName": "ContactsView_PendingRequest_Button", "type": "StatusTabButton", "visible": True} settingsContentBaseScrollView_ContactListPanel = {"container": mainWindow_ContactsView, "objectName": "ContactListPanel_ListView", "type": "StatusListView", "visible": True} +settingsContentBaseScrollView_Item = {"container": mainWindow_ContactsView, "type": "Item", "unnamed": 1, "visible": True} settingsContentBaseScrollView_sentRequests_ContactsListPanel = {"container": mainWindow_ContactsView, "objectName": "sentRequests_ContactsListPanel", "type": "ContactsListPanel", "visible": True} contactsTabBar_Contacts_StatusTabButton = {"checkable": True, "container": mainWindow_ContactsView, "id": "contactsBtn", "type": "StatusTabButton", "unnamed": 1, "visible": True} settingsContentBaseScrollView_receivedRequests_ContactsListPanel = {"container": mainWindow_ContactsView, "objectName": "receivedRequests_ContactsListPanel", "type": "ContactsListPanel", "visible": True} @@ -52,6 +53,8 @@ view_Profile_StatusMenuItem = {"checkable": False, "container": statusDesktop_ma verify_Identity_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "verifyIdentity_StatusItem", "type": "StatusMenuItem", "visible": True} respond_to_ID_Request_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "pendingIdentity_StatusItem", "type": "StatusMenuItem", "visible": True} settingsContentBaseScrollView_Respond_to_ID_Request_StatusFlatButton = {"checkable": False, "container": mainWindow_ContactsView, "objectName": "verifyIdentity_StatusItem", "type": "StatusFlatButton", "unnamed": 1, "visible": True} +contactsTabBar_Blocked_StatusTabButton = {"checkable": True, "container": mainWindow_ContactsView, "objectName": "ContactsView_Blocked_Button", "type": "StatusTabButton", "visible": True} +unblock_user_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "unblock_StatusItem", "type": "StatusMenuItem", "visible": True} # Keycard Settings View mainWindow_KeycardView = {"container": statusDesktop_mainWindow, "type": "KeycardView", "unnamed": 1, "visible": True} diff --git a/test/e2e/gui/screens/community_settings.py b/test/e2e/gui/screens/community_settings.py index 72679e5d74..1b5add759b 100644 --- a/test/e2e/gui/screens/community_settings.py +++ b/test/e2e/gui/screens/community_settings.py @@ -8,8 +8,8 @@ import configs import driver from driver.objects_access import walk_children from gui.components.community.color_select_popup import ColorSelectPopup -from gui.components.community.kick_member_popup import KickMemberPopup from gui.components.community.tags_select_popup import TagsSelectPopup +from gui.components.kick_member_popup import KickMemberPopup from gui.components.os.open_file_dialogs import OpenFileDialog from gui.components.picture_edit_popup import PictureEditPopup from gui.elements.button import Button diff --git a/test/e2e/gui/screens/settings_messaging.py b/test/e2e/gui/screens/settings_messaging.py index f9383103ce..ab61334a32 100644 --- a/test/e2e/gui/screens/settings_messaging.py +++ b/test/e2e/gui/screens/settings_messaging.py @@ -8,6 +8,7 @@ import driver from driver.objects_access import walk_children from gui.components.settings.respond_to_id_request_popup import RespondToIDRequestPopup from gui.components.settings.send_contact_request_popup import SendContactRequest +from gui.components.settings.unblock_user_popup import UnblockUserPopup from gui.components.settings.verify_identity_popup import VerifyIdentityPopup from gui.elements.button import Button @@ -98,8 +99,11 @@ class ContactsSettingsView(QObject): self._contact_request_button = Button(settings_names.mainWindow_Send_contact_request_to_chat_key_StatusButton) self._pending_request_tab = Button(settings_names.contactsTabBar_Pending_Requests_StatusTabButton) self._contacts_tab = Button(settings_names.contactsTabBar_Contacts_StatusTabButton) + self._blocked_tab = Button(settings_names.contactsTabBar_Blocked_StatusTabButton) + self._contact_item = QObject(settings_names.settingsContentBaseScrollView_Item) self._contacts_items_list = List(settings_names.settingsContentBaseScrollView_ContactListPanel) - self._pending_request_sent_panel = QObject(settings_names.settingsContentBaseScrollView_sentRequests_ContactsListPanel) + self._pending_request_sent_panel = QObject( + settings_names.settingsContentBaseScrollView_sentRequests_ContactsListPanel) self._pending_request_received_panel = QObject( settings_names.settingsContentBaseScrollView_receivedRequests_ContactsListPanel) self._contacts_panel = QObject(settings_names.settingsContentBaseScrollView_mutualContacts_ContactsListPanel) @@ -111,6 +115,7 @@ class ContactsSettingsView(QObject): self._view_profile_item = QObject(settings_names.view_Profile_StatusMenuItem) self._respond_to_id_request_button = Button( settings_names.settingsContentBaseScrollView_Respond_to_ID_Request_StatusFlatButton) + self._unblock_item = Button(settings_names.unblock_user_StatusMenuItem) @property @allure.step('Get contact items') @@ -159,6 +164,11 @@ class ContactsSettingsView(QObject): self._contacts_tab.click() return self + @allure.step('Open blocked tab') + def open_blocked(self): + self._blocked_tab.click() + return self + @allure.step('Open contacts request form') def open_contact_request_form(self) -> SendContactRequest: self._contact_request_button.click() @@ -202,13 +212,21 @@ class ContactsSettingsView(QObject): request.open_more_options_popup() return self + @allure.step('Verify identity') def verify_identity(self): self._verify_identity_item.click() return VerifyIdentityPopup().wait_until_appears() + @allure.step('Get visibility state of respond to id request item') def is_respond_to_id_request_visible(self) -> bool: return self._respond_to_id_request_item.is_visible + @allure.step('Respond to ID request') def respond_to_id_request(self): self._respond_to_id_request_item.click() return RespondToIDRequestPopup().wait_until_appears() + + @allure.step('Unblock user') + def unblock_user(self): + self._unblock_item.click() + return UnblockUserPopup().wait_until_appears() diff --git a/test/e2e/tests/user_guide_tests/__init__.py b/test/e2e/tests/user_guide_tests/__init__.py new file mode 100644 index 0000000000..89d542ead7 --- /dev/null +++ b/test/e2e/tests/user_guide_tests/__init__.py @@ -0,0 +1,3 @@ +import pytest + +marks = pytest.mark.user_guide diff --git a/test/e2e/tests/user_guide_tests/test_block_unblock_user.py b/test/e2e/tests/user_guide_tests/test_block_unblock_user.py new file mode 100644 index 0000000000..ca3dcffd93 --- /dev/null +++ b/test/e2e/tests/user_guide_tests/test_block_unblock_user.py @@ -0,0 +1,102 @@ +import allure +import pytest +from allure_commons._allure import step + +import constants +import driver +from constants import UserAccount +from constants.community_settings import BlockPopupWarnings, ToastMessages +from gui.main_window import MainWindow +from . import marks +import configs + +pytestmark = marks + + +@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/738772', + "Block or unblock someone in Status") +# @pytest.mark.case(738772) +@pytest.mark.parametrize('user_data_one, user_data_two, user_data_three', [ + (configs.testpath.TEST_USER_DATA / 'squisher', configs.testpath.TEST_USER_DATA / 'athletic', + configs.testpath.TEST_USER_DATA / 'nervous') +]) +def test_block_and_unblock_user_from_settings_and_profile(multiple_instances, user_data_one, user_data_two, user_data_three): + user_one: UserAccount = constants.user_account_one + user_two: UserAccount = constants.user_account_two + user_three: UserAccount = constants.user_account_three + timeout = configs.timeouts.UI_LOAD_TIMEOUT_MSEC + main_screen = MainWindow() + + with multiple_instances(user_data=user_data_one) as aut_one, multiple_instances( + user_data=user_data_two) as aut_two, multiple_instances(user_data=user_data_three) as aut_three: + with step(f'Launch multiple instances with authorized users {user_one.name}, {user_two.name}, {user_three}'): + for aut, account in zip([aut_one, aut_two, aut_three], [user_one, user_two, user_three]): + aut.attach() + main_screen.wait_until_appears(configs.timeouts.APP_LOAD_TIMEOUT_MSEC).prepare() + main_screen.authorize_user(account) + main_screen.hide() + + with step( + f'User {user_one.name}, block contact {user_two.name} from user profile and verify button Unblock appeared'): + aut_one.attach() + main_screen.prepare() + community_screen = main_screen.left_panel.select_community('Community with 2 users') + profile_popup = community_screen.right_panel.click_member(user_two.name) + block_popup = profile_popup.block_user() + warning_text = BlockPopupWarnings.BLOCK_WARNING_PART_1.value + user_two.name + BlockPopupWarnings.BLOCK_WARNING_PART_2.value + assert driver.waitFor(lambda: block_popup.get_warning_text() == warning_text, + timeout), f'Text is incorrect, actual text is {block_popup.get_warning_text()}, correct text is {warning_text}' + block_popup.block() + with step('Check that Unblock user button appeared'): + assert driver.waitFor(lambda: profile_popup.is_unblock_button_visible, + timeout), f"Unblock button did not appear" + main_screen.left_panel.click() + + with step('Check toast message about blocked member'): + toast_messages = main_screen.wait_for_notification() + message_1 = ToastMessages.REMOVED_CONTACT_TOAST.value + message_2 = user_two.name + ToastMessages.BLOCKED_USER_TOAST.value + assert driver.waitFor(lambda: message_1 in toast_messages, + timeout), f"Toast message {message_1} is incorrect, current message is {toast_messages}" + assert driver.waitFor(lambda: message_2 in toast_messages, + timeout), f"Toast message {message_2} is incorrect, current message is {toast_messages}" + main_screen.hide() + + with step(f'User {user_two.name} does not see {user_one.name} in contacts list'): + aut_two.attach() + main_screen.prepare() + contacts_settings = main_screen.left_panel.open_settings().left_panel.open_messaging_settings().open_contacts_settings() + assert driver.waitFor(lambda: user_one.name not in contacts_settings.contact_items, timeout) + main_screen.hide() + + with step( + f'User {user_one.name}, unblock {user_two.name} from contact settings and verify {user_two.name} was removed from blocked list'): + aut_one.attach() + main_screen.prepare() + contacts_settings = main_screen.left_panel.open_settings().left_panel.open_messaging_settings().open_contacts_settings() + unblock_popup = contacts_settings.open_blocked().open_more_options_popup(user_two.name).unblock_user() + warning_text = BlockPopupWarnings.UNBLOCK_TEXT_1.value + user_two.name + BlockPopupWarnings.UNBLOCK_TEXT_2.value + assert driver.waitFor(lambda: unblock_popup.get_warning_text() == warning_text, + timeout), f'Text is incorrect, actual text is {unblock_popup.get_warning_text()}, correct text is {warning_text}' + unblock_popup.unblock() + + with step('Check toast message about unblocked member'): + toast_messages = main_screen.wait_for_notification() + message_2 = user_two.name + ToastMessages.UNBLOCKED_USER_TOAST.value + assert driver.waitFor(lambda: message_2 in toast_messages, + timeout), f"Toast message {message_2} is incorrect, current message is {toast_messages}" + + with step( + f'User {user_one.name}, block stranger {user_three.name} from user profile and verify button Unblock appeared'): + community_screen = main_screen.left_panel.select_community('Community with 2 users') + profile_popup = community_screen.right_panel.click_member(user_three.name) + block_popup = profile_popup.block_user() + block_popup.block() + + with step('Check that Unblock user button appeared'): + assert driver.waitFor(lambda: profile_popup.is_unblock_button_visible, timeout), f"Unblock button did not appear" + + with step( + f'User {user_one.name}, unblock stranger {user_three.name} from user profile and verify that Unblock button dissapeared and send request is visible again'): + profile_popup.unblock_user().unblock() + assert driver.waitFor(lambda: profile_popup.is_send_request_button_visible(), timeout) diff --git a/ui/app/AppLayouts/Profile/views/ContactsView.qml b/ui/app/AppLayouts/Profile/views/ContactsView.qml index 73f18724cf..7dd62142e2 100644 --- a/ui/app/AppLayouts/Profile/views/ContactsView.qml +++ b/ui/app/AppLayouts/Profile/views/ContactsView.qml @@ -105,6 +105,7 @@ SettingsContentBase { // } StatusTabButton { id: blockedBtn + objectName: "ContactsView_Blocked_Button" width: implicitWidth enabled: root.contactsStore.blockedContactsModel.count > 0 text: qsTr("Blocked") diff --git a/ui/imports/shared/popups/BlockContactConfirmationDialog.qml b/ui/imports/shared/popups/BlockContactConfirmationDialog.qml index aa6e3c18e5..9d422cdc41 100644 --- a/ui/imports/shared/popups/BlockContactConfirmationDialog.qml +++ b/ui/imports/shared/popups/BlockContactConfirmationDialog.qml @@ -24,6 +24,7 @@ CommonContactDialog { } StatusBaseText { + objectName: "youWillNotSeeText" Layout.fillWidth: true wrapMode: Text.WordWrap lineHeight: 22 @@ -32,6 +33,7 @@ CommonContactDialog { } StatusWarningBox { + objectName: "blockWarningBox" Layout.fillWidth: true Layout.topMargin: Style.current.padding icon: "warning" @@ -45,6 +47,7 @@ CommonContactDialog { StatusCheckBox { Layout.topMargin: Style.current.halfPadding + objectName: "removeContactCheckbox" id: ctrlRemoveContact visible: contactDetails.isContact checked: visible @@ -62,10 +65,12 @@ CommonContactDialog { rightButtons: ObjectModel { StatusFlatButton { + objectName: "cancelButton" text: qsTr("Cancel") onClicked: root.close() } StatusButton { + objectName: "blockButton" type: StatusBaseButton.Type.Danger text: qsTr("Block") onClicked: root.accepted() diff --git a/ui/imports/shared/popups/UnblockContactConfirmationDialog.qml b/ui/imports/shared/popups/UnblockContactConfirmationDialog.qml index 1ae83d7083..594433e422 100644 --- a/ui/imports/shared/popups/UnblockContactConfirmationDialog.qml +++ b/ui/imports/shared/popups/UnblockContactConfirmationDialog.qml @@ -14,6 +14,7 @@ CommonContactDialog { title: qsTr("Unblock user") StatusBaseText { + objectName: "unblockingText" Layout.fillWidth: true wrapMode: Text.WordWrap text: qsTr("Unblocking %1 will allow new messages you receive from %1 to reach you.").arg(mainDisplayName) @@ -21,10 +22,12 @@ CommonContactDialog { rightButtons: ObjectModel { StatusFlatButton { + objectName: "cancelButton" text: qsTr("Cancel") onClicked: root.close() } StatusButton { + objectName: "unblockUserButton" type: StatusBaseButton.Type.Danger text: qsTr("Unblock") onClicked: root.accepted() diff --git a/ui/imports/shared/views/ProfileDialogView.qml b/ui/imports/shared/views/ProfileDialogView.qml index 0d799c1e20..b39f3a89ac 100644 --- a/ui/imports/shared/views/ProfileDialogView.qml +++ b/ui/imports/shared/views/ProfileDialogView.qml @@ -155,6 +155,7 @@ Pane { StatusButton { size: StatusButton.Size.Small type: StatusBaseButton.Type.Danger + objectName: "blockUserButton" text: qsTr("Block user") onClicked: Global.blockContactRequested(root.publicKey, contactDetails) } @@ -164,6 +165,7 @@ Pane { id: btnUnblockUserComponent StatusButton { size: StatusButton.Size.Small + objectName: "unblockUserProfileButton" text: qsTr("Unblock user") onClicked: Global.unblockContactRequested(root.publicKey, contactDetails) } @@ -375,6 +377,7 @@ Pane { onTriggered: Global.openMarkAsIDVerifiedPopup(root.publicKey, contactDetails, null) } StatusAction { + objectName: "addEditNickNameStatusAction" text: d.userNickName ? qsTr("Edit nickname") : qsTr("Add nickname") icon.name: "edit_pencil" onTriggered: { @@ -406,6 +409,7 @@ Pane { } StatusAction { text: qsTr("Remove nickname") + objectName: "removeNicknameStatusAction" icon.name: "delete" type: StatusAction.Type.Danger enabled: !d.isCurrentUser && !!contactDetails.localNickname @@ -447,6 +451,7 @@ Pane { } StatusAction { text: qsTr("Block user") + objectName: "blockUserStatusAction" icon.name: "cancel" type: StatusAction.Type.Danger enabled: !d.isBlocked