chore: unpin method reworked

This commit is contained in:
Valentina Novgorodtceva 2024-05-08 13:27:30 +07:00 committed by Valentina1133
parent 2625535597
commit d9fb163cb7
4 changed files with 45 additions and 3 deletions

View File

@ -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()

View File

@ -163,6 +163,11 @@ share_your_addresses_to_join_StatusButton = {"container": statusDesktop_mainWind
# Kick member popup # Kick member popup
confirm_kick_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "CommunityMembers_KickModal_KickButton", "type": "StatusButton", "visible": True} 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 """ """ Settings """
# Send Contact Request # Send Contact Request

View File

@ -91,6 +91,10 @@ class ToolBar(QObject):
def is_pin_message_tooltip_visible(self) -> bool: def is_pin_message_tooltip_visible(self) -> bool:
return self.pinned_message_tooltip.is_visible 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') @allure.step('Confirm action in toolbar')
def confirm_action_in_toolbar(self): def confirm_action_in_toolbar(self):
self.confirm_button.click() self.confirm_button.click()

View File

@ -7,6 +7,7 @@ import pytest
from allure_commons._allure import step from allure_commons._allure import step
import driver import driver
from gui.components.community.pinned_messages_popup import PinnedMessagesPopup
from gui.main_window import MainWindow from gui.main_window import MainWindow
from . import marks from . import marks
import configs import configs
@ -135,11 +136,11 @@ def test_join_community_and_pin_unpin_message(multiple_instances):
assert message.get_message_color() == ColorCodes.ORANGE.value assert message.get_message_color() == ColorCodes.ORANGE.value
main_screen.hide() 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() aut_two.attach()
main_screen.prepare() main_screen.prepare()
message = messages_screen.chat.find_message_by_text(second_message_text, 1) messages_screen.tool_bar.click_pin_message_tooltip()
message.hover_message().unpin_message() PinnedMessagesPopup().wait_until_appears().unpin_message().close()
with step(f'User {user_one.name} see the {second_message_text} as unpinned'): with step(f'User {user_one.name} see the {second_message_text} as unpinned'):
aut_one.attach() aut_one.attach()