Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions constants/links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Links for link preview tests
external_link = 'https://github.com/status-im/status-desktop/issues/12018'
link_to_status_community = 'https://status.app/c/G4IAAMSIuU08Lm3oHzSz695ImidijVBxyoFDGEiSYAvADsk9ZVOKYlT2b-lHStyz1MqqkK2Xa4FwoUiq3LBgWsYI_ht6hWXCyLu0TGAk0dGu8IyQWtDSdIXOQ3hWscLjkTo5Vg5-eyUuV8jOVv7khJ_uTofT_TijN-sB#zQ3shZeEJqTC1xhGUjxuS4rtHSrhJ8vUYp64v6qWkLpvdy9L9'
status_user_profile_link = 'https://status.app/u/iwWACgoKCHNxdWlzaGVyAw==#zQ3shvMPZSyaUbjBjaNpNP1bPGsGpQDp59dZ4Gmz7UEy5o791'
2 changes: 2 additions & 0 deletions constants/messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ class Messaging(Enum):
YOU_NEED_TO_BE_A_MEMBER = 'You need to be a member of this group to send messages'
ID_VERIFICATION_REQUEST_SENT = 'ID verification request sent'
ID_VERIFICATION_REPLY_SENT = 'ID verification reply sent'
SHOW_PREVIEWS_TITLE = 'Show link previews?'
SHOW_PREVIEWS_TEXT = 'A preview of your link will be shown here before you send it'
32 changes: 32 additions & 0 deletions gui/components/messaging/link_preview_options_popup.py
Original file line number Diff line number Diff line change
@@ -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 LinkPreviewOptionsPopup(BasePopup):

def __init__(self):
super().__init__()
self._show_for_this_message_item = QObject(names.show_for_this_message_StatusMenuItem)
self._always_show_item = QObject(names.always_show_previews_StatusMenuItem)
self._never_show_item = QObject(names.never_show_previews_StatusMenuItem)

@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._show_for_this_message_item.wait_until_appears(timeout_msec)
return self

@allure.step('Wait until hidden {0}')
def wait_until_hidden(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._show_for_this_message_item.wait_until_hidden(timeout_msec)
return self

@allure.step('Verify all preview items are present')
def are_all_options_visible(self):
assert self._show_for_this_message_item.is_visible
assert self._always_show_item.is_visible
assert self._never_show_item.is_visible
11 changes: 11 additions & 0 deletions gui/objects_map/messaging_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,14 @@
chatMessageViewDelegate_Save_StatusButton = {"checkable": False, "container": chatLogView_chatMessageViewDelegate_MessageView, "id": "saveBtn", "type": "StatusButton", "unnamed": 1, "visible": True}
chatMessageViewDelegate_reply_icon_StatusIcon = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "reply-icon", "type": "StatusIcon", "visible": True}
mainWindow_replyArea_StatusChatInputReplyArea = {"container": statusDesktop_mainWindow, "id": "replyArea", "type": "StatusChatInputReplyArea", "unnamed": 1, "visible": True}

# Message link preview
mainWindow_optionsComboBox_ComboBox = {"container": statusDesktop_mainWindow, "id": "optionsComboBox", "type": "ComboBox", "unnamed": 1, "visible": True}
mainWindow_settingsCard_LinkPreviewSettingsCard = {"container": statusDesktop_mainWindow, "id": "settingsCard", "type": "LinkPreviewSettingsCard", "unnamed": 1, "visible": True}
mainWindow_closeLinkPreviewButton_StatusFlatRoundButton = {"container": statusDesktop_mainWindow, "objectName": "closeLinkPreviewButton", "type": "StatusFlatRoundButton", "visible": True}
mainWindow_linkPreviewTitleText_StatusBaseText = {"container": statusDesktop_mainWindow, "objectName": "linkPreviewTitleText", "type": "StatusBaseText", "visible": True}
mainWindow_linkPreviewSubtitleText_StatusBaseText = {"container": statusDesktop_mainWindow, "objectName": "linkPreviewSubtitleText", "type": "StatusBaseText", "visible": True}
mainWindow_titleText_StatusBaseText = {"container": statusDesktop_mainWindow, "objectName": "titleText", "type": "StatusBaseText", "visible": True}
mainWindow_subtitleText_StatusBaseText = {"container": statusDesktop_mainWindow, "objectName": "subtitleText", "type": "StatusBaseText", "visible": True}
linkPreviewTitle_StatusBaseText = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "linkPreviewTitle", "type": "StatusBaseText", "visible": True}
linkPreviewEmojiHash_EmojiHash = {"container": chatLogView_chatMessageViewDelegate_MessageView, "objectName": "linkPreviewEmojiHash", "type": "EmojiHash", "visible": True}
9 changes: 9 additions & 0 deletions gui/objects_map/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,11 @@
# Rename keypair popup
save_changes_rename_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "saveRenameKeypairChangesButton", "type": "StatusButton", "visible": True}

# Link preview options popup
show_for_this_message_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "text": "Show for this message", "type": "StatusMenuItem", "unnamed": 1, "visible": True}
always_show_previews_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "text": "Always show previews", "type": "StatusMenuItem", "unnamed": 1, "visible": True}
never_show_previews_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "text": "Never show previews", "type": "StatusMenuItem", "unnamed": 1, "visible": True}

# OS NAMES
# Open Files Dialog
chooseAnImageALogo_QQuickWindow = {"title": RegularExpression("Choose.*"), "type": "QQuickWindow", "unnamed": 1, "visible": True}
Expand Down Expand Up @@ -511,6 +516,10 @@
# Messaging View
mainWindow_MessagingView = {"container": statusDesktop_mainWindow, "type": "MessagingView", "unnamed": 1, "visible": True}
contactsListItem_btn_StatusContactRequestsIndicatorListItem = {"container": mainWindow_MessagingView, "objectName": "MessagingView_ContactsListItem_btn", "type": "StatusContactRequestsIndicatorListItem", "visible": True}
settingsContentBase_ScrollView = {"container": statusDesktop_mainWindow, "objectName": "settingsContentBaseScrollView", "type": "StatusScrollView", "visible": True}
always_ask_radioButton_StatusRadioButton = {"container": settingsContentBase_ScrollView, "objectName": "MessagingView_AlwaysAsk_RadioButton", "type": "SettingsRadioButton", "visible": True}
always_show_radioButton_StatusRadioButton = {"container": settingsContentBase_ScrollView, "objectName": "MessagingView_AlwaysShow_RadioButton", "type": "SettingsRadioButton", "visible": True}
never_show_radioButton_StatusRadioButton = {"container": settingsContentBase_ScrollView, "objectName": "MessagingView_NeverShow_RadioButton", "type": "SettingsRadioButton", "visible": True}

# Contacts View
mainWindow_ContactsView = {"container": statusDesktop_mainWindow, "type": "ContactsView", "unnamed": 1, "visible": True}
Expand Down
65 changes: 65 additions & 0 deletions gui/screens/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import configs
import driver
from driver.objects_access import walk_children
from driver.toplevel_window import set_focus
from gui.components.activity_center import ActivityCenter
from gui.components.context_menu import ContextMenu
from gui.components.delete_popup import DeleteMessagePopup
Expand All @@ -15,6 +16,7 @@
from gui.components.messaging.close_chat_popup import CloseChatPopup
from gui.components.messaging.edit_group_name_and_image_popup import EditGroupNameAndImagePopup
from gui.components.messaging.leave_group_popup import LeaveGroupPopup
from gui.components.messaging.link_preview_options_popup import LinkPreviewOptionsPopup
from gui.elements.button import Button
from gui.elements.list import List
from gui.elements.object import QObject
Expand Down Expand Up @@ -124,6 +126,10 @@ def __init__(self, obj):
self.from_user: typing.Optional[str] = None
self.text: typing.Optional[str] = None
self.delegate_button: typing.Optional[Button] = None
self.reply_corner: typing.Optional[QObject] = None
self.link_preview: typing.Optional[QObject] = None
self.link_preview_title_object: typing.Optional[QObject] = None
self.link_preview_emoji_hash: typing.Optional[str] = None
self.community_invitation: dict = {}
self.init_ui()

Expand All @@ -135,6 +141,10 @@ def init_ui(self):
self.community_invitation['name'] = str(child.text)
elif getattr(child, 'id', '') == 'description':
self.community_invitation['description'] = str(child.text)
elif getattr(child, 'id', '') == 'titleLayout':
self.link_preview_title_object = child
elif getattr(child, 'objectName', '') == 'linkPreviewEmojiHash':
self.link_preview_emoji_hash = str(child.publicKey)
else:
match getattr(child, 'id', ''):
case 'profileImage':
Expand All @@ -149,6 +159,8 @@ def init_ui(self):
self.reply_corner = QObject(real_name=driver.objectMap.realName(child))
case 'delegate':
self.delegate_button = Button(real_name=driver.objectMap.realName(child))
case 'linksMessageView':
self.link_preview = QObject(real_name=driver.objectMap.realName(child))

@allure.step('Open community invitation')
def open_community_invitation(self):
Expand Down Expand Up @@ -180,6 +192,12 @@ def pinned_info_text(self) -> str:
def message_is_pinned(self) -> bool:
return self.delegate_button.object.isPinned

@allure.step('Get title of link preview')
def get_link_preview_title(self) -> str:
for child in walk_children(self.link_preview_title_object):
if getattr(child, 'objectName', '') == 'linkPreviewTitle':
return str(child.text)


class ChatView(QObject):

Expand Down Expand Up @@ -273,6 +291,13 @@ def __init__(self):
self._message_input_area = QObject(messaging_names.inputScrollView_messageInputField_TextArea)
self._message_field = TextEdit(messaging_names.inputScrollView_Message_PlaceholderText)
self._emoji_button = Button(messaging_names.mainWindow_statusChatInputEmojiButton_StatusFlatRoundButton)
self._link_preview_title = QObject(messaging_names.mainWindow_linkPreviewTitleText_StatusBaseText)
self._link_preview_preview_subtitle = QObject(messaging_names.mainWindow_linkPreviewSubtitleText_StatusBaseText)
self._link_preview_show_preview = QObject(messaging_names.mainWindow_titleText_StatusBaseText)
self._link_preview_show_description = QObject(messaging_names.mainWindow_subtitleText_StatusBaseText)
self._link_preview_card = QObject(messaging_names.mainWindow_settingsCard_LinkPreviewSettingsCard)
self._options_combobox = QObject(messaging_names.mainWindow_optionsComboBox_ComboBox)
self._close_preview_button = QObject(messaging_names.mainWindow_closeLinkPreviewButton_StatusFlatRoundButton)

@property
@allure.step('Get group name')
Expand Down Expand Up @@ -322,10 +347,50 @@ def leave_group(self):

@allure.step('Send message to group chat')
def send_message_to_group_chat(self, message: str):
self.type_message(message)
self.confirm_sending_message()

@allure.step('Type text to message field')
def type_message(self, message: str):
self._message_field.type_text(message)

@allure.step('Confirm sending message')
def confirm_sending_message(self):
self._message_input_area.click()
for i in range(2):
driver.nativeType('<Return>')

@allure.step('Click options combobox')
def click_options(self):
self._options_combobox.click()
return LinkPreviewOptionsPopup().wait_until_appears()

@allure.step('Close link preview popup by clicking preview bubble area')
def close_link_preview_popup(self):
self._link_preview_card.click()
LinkPreviewOptionsPopup().wait_until_hidden()
return self

@allure.step('Get text of title of link preview bubble')
def get_link_preview_bubble_title(self) -> str:
return str(self._link_preview_title.object.text)

@allure.step('Get text of description of link preview bubble')
def get_link_preview_bubble_description(self) -> str:
return str(self._link_preview_preview_subtitle.object.text)

@allure.step('Get text of title of show link preview bubble')
def get_show_link_preview_bubble_title(self) -> str:
return str(self._link_preview_show_preview.object.text)

@allure.step('Get text of description of show link preview bubble')
def get_show_link_preview_bubble_description(self) -> str:
return str(self._link_preview_show_description.object.text)

@allure.step('Get close button visibility state')
def does_close_button_exist(self) -> bool:
return self._close_preview_button.is_visible

@allure.step('Send emoji to chat')
def send_emoji_to_chat(self, emoji: str):
self._emoji_button.click()
Expand Down
10 changes: 9 additions & 1 deletion gui/screens/settings_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ class MessagingSettingsView(QObject):
def __init__(self):
super().__init__(names.mainWindow_MessagingView)
self._contacts_button = Button(names.contactsListItem_btn_StatusContactRequestsIndicatorListItem)
self._always_ask_button = Button(names.always_ask_radioButton_StatusRadioButton)
self._always_show_button = Button(names.always_show_radioButton_StatusRadioButton)
self._never_ask_button = Button(names.never_show_radioButton_StatusRadioButton)

@allure.step('Open contacts settings')
def open_contacts_settings(self) -> 'ContactsSettingsView':
self._contacts_button.click()
return ContactsSettingsView()

@allure.step('Choose always show previews from website links preview options')
def click_always_show(self):
self._always_show_button.click()


class ContactItem:

Expand Down Expand Up @@ -101,7 +108,8 @@ def __init__(self):
self._verify_identity_item = QObject(names.verify_Identity_StatusMenuItem)
self._respond_to_id_request_item = QObject(names.respond_to_ID_Request_StatusMenuItem)
self._view_profile_item = QObject(names.view_Profile_StatusMenuItem)
self._respond_to_id_request_button = Button(names.settingsContentBaseScrollView_Respond_to_ID_Request_StatusFlatButton)
self._respond_to_id_request_button = Button(
names.settingsContentBaseScrollView_Respond_to_ID_Request_StatusFlatButton)

@property
@allure.step('Get contact items')
Expand Down
Loading