diff --git a/test/e2e/gui/components/community/pinned_messages_popup.py b/test/e2e/gui/components/community/pinned_messages_popup.py new file mode 100644 index 0000000000..1ee3c9b03f --- /dev/null +++ b/test/e2e/gui/components/community/pinned_messages_popup.py @@ -0,0 +1,32 @@ +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.objects_map import names + + +class PinnedMessagesPopup(BasePopup): + + def __init__(self): + super().__init__() + self._close_button = Button(names.headerActionsCloseButton_StatusFlatRoundButton) + self._unpin_button = Button(names.unpinButton_StatusFlatRoundButton) + self._pinned_message_details = QObject(names.o_StatusPinMessageDetails) + + @allure.step('Wait until appears {0}') + def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + self._pinned_message_details.wait_until_appears(timeout_msec) + return self + + @allure.step('Unpin message') + def unpin_message(self): + self._pinned_message_details.hover() + self._unpin_button.click() + return self + + @allure.step('Close pinned messages popup') + def close(self): + self._close_button.click() + self._pinned_message_details.wait_until_hidden() diff --git a/test/e2e/gui/objects_map/names.py b/test/e2e/gui/objects_map/names.py index 083e863b54..dddfbab6e9 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -163,6 +163,11 @@ share_your_addresses_to_join_StatusButton = {"container": statusDesktop_mainWind # 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} +o_StatusPinMessageDetails = {"container": statusDesktop_mainWindow_overlay, "type": "StatusPinMessageDetails", "unnamed": 1, "visible": True} + """ Settings """ # Send Contact Request diff --git a/test/e2e/gui/screens/messages.py b/test/e2e/gui/screens/messages.py index 76e48dd6cc..18675c0622 100644 --- a/test/e2e/gui/screens/messages.py +++ b/test/e2e/gui/screens/messages.py @@ -91,6 +91,10 @@ class ToolBar(QObject): def is_pin_message_tooltip_visible(self) -> bool: return self.pinned_message_tooltip.is_visible + @allure.step('Click on pin message tooltip') + def click_pin_message_tooltip(self): + return self.pinned_message_tooltip.click() + @allure.step('Confirm action in toolbar') def confirm_action_in_toolbar(self): self.confirm_button.click() diff --git a/test/e2e/tests/communities/test_communities_pin_and_unpin_messages.py b/test/e2e/tests/communities/test_communities_pin_and_unpin_messages.py index a75949d6df..1d8e84d839 100644 --- a/test/e2e/tests/communities/test_communities_pin_and_unpin_messages.py +++ b/test/e2e/tests/communities/test_communities_pin_and_unpin_messages.py @@ -7,6 +7,7 @@ import pytest from allure_commons._allure import step import driver +from gui.components.community.pinned_messages_popup import PinnedMessagesPopup from gui.main_window import MainWindow from . import marks import configs @@ -135,11 +136,11 @@ def test_join_community_and_pin_unpin_message(multiple_instances): assert message.get_message_color() == ColorCodes.ORANGE.value main_screen.hide() - with step(f'User {user_two.name} hover message and unpin it'): + with step(f'User {user_two.name} unpin message from pinned messages popup'): aut_two.attach() main_screen.prepare() - message = messages_screen.chat.find_message_by_text(second_message_text, 1) - message.hover_message().unpin_message() + messages_screen.tool_bar.click_pin_message_tooltip() + PinnedMessagesPopup().wait_until_appears().unpin_message().close() with step(f'User {user_one.name} see the {second_message_text} as unpinned'): aut_one.attach()