From b08751ac91db498dc53ac1cb3aef91cb6c802528 Mon Sep 17 00:00:00 2001 From: Anastasiya Semenkevich Date: Fri, 31 May 2024 17:00:33 +0300 Subject: [PATCH] chore: improve profile --- gui/components/online_identifier.py | 11 ++--------- gui/components/profile_popup.py | 8 +++++++- gui/objects_map/names.py | 21 +++++++++++---------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gui/components/online_identifier.py b/gui/components/online_identifier.py index 8c7e478..09c1367 100644 --- a/gui/components/online_identifier.py +++ b/gui/components/online_identifier.py @@ -54,13 +54,6 @@ class OnlineIdentifier(QObject): self.wait_until_hidden() @allure.step('Open Profile popup from online identifier') - def open_profile_popup_from_online_identifier(self, attempts: int =2) -> ProfilePopup: + def open_profile_popup_from_online_identifier(self) -> ProfilePopup: self._view_my_profile_button.click() - time.sleep(0.5) - try: - return ProfilePopup() - except Exception as ex: - if attempts: - self.open_profile_popup_from_online_identifier(attempts - 1) - else: - raise ex + return ProfilePopup().wait_until_appears() \ No newline at end of file diff --git a/gui/components/profile_popup.py b/gui/components/profile_popup.py index ce22dd2..e0473ca 100644 --- a/gui/components/profile_popup.py +++ b/gui/components/profile_popup.py @@ -16,7 +16,8 @@ from gui.screens.settings_profile import ProfileSettingsView class ProfilePopup(BasePopup): def __init__(self): - super(ProfilePopup, self).__init__() + super().__init__() + self._profile_popup_content_item = QObject(names.ProfileContentItem) self._profile_image = QObject(names.ProfileHeader_userImage) self._user_name_label = TextLabel(names.ProfilePopup_displayName) self._edit_profile_button = Button(names.ProfilePopup_editButton) @@ -24,6 +25,11 @@ class ProfilePopup(BasePopup): self._emoji_hash = QObject(names.profileDialog_userEmojiHash_EmojiHash) self._chat_key_copy_button = Button(names.copy_icon_CopyButton) + @allure.step('Wait until appears {0}') + def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + self._profile_popup_content_item.wait_until_appears(timeout_msec) + return self + @property @allure.step('Get profile image') def profile_image(self): diff --git a/gui/objects_map/names.py b/gui/objects_map/names.py index 59036ad..106a051 100644 --- a/gui/objects_map/names.py +++ b/gui/objects_map/names.py @@ -84,17 +84,18 @@ userContextMenu_ViewMyProfileAction = {"container": o_StatusListView, "objectNam userLabel_StyledText = {"container": o_StatusListView, "type": "StyledText", "unnamed": 1, "visible": True} o_StatusIdenticonRing = {"container": o_StatusListView, "type": "StatusIdenticonRing", "unnamed": 1, "visible": True} -# My Profile Popup -ProfileHeader_userImage = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialog_userImage", "type": "UserImage", "visible": True} -ProfilePopup_displayName = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialog_displayName", "type": "StatusBaseText", "visible": True} -ProfilePopup_editButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "editProfileButton", "type": "StatusButton", "visible": True} -ProfilePopup_SendContactRequestButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "profileDialog_sendContactRequestButton", "type": "StatusButton", "visible": True} -profileDialog_userEmojiHash_EmojiHash = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialog_userEmojiHash", "type": "EmojiHash", "visible": True} -edit_TextEdit = {"container": statusDesktop_mainWindow_overlay, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True} +# My Profile Popup (online identifier) +ProfileContentItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialogView", "type": "ContentItem", "visible": True} +ProfileHeader_userImage = {"container": ProfileContentItem, "objectName": "ProfileDialog_userImage", "type": "UserImage", "visible": True} +ProfilePopup_displayName = {"container": ProfileContentItem, "objectName": "ProfileDialog_displayName", "type": "StatusBaseText", "visible": True} +ProfilePopup_editButton = {"container": ProfileContentItem, "objectName": "editProfileButton", "type": "StatusButton", "visible": True} +ProfilePopup_SendContactRequestButton = {"container": ProfileContentItem, "objectName": "profileDialog_sendContactRequestButton", "type": "StatusButton", "visible": True} +profileDialog_userEmojiHash_EmojiHash = {"container": ProfileContentItem, "objectName": "ProfileDialog_userEmojiHash", "type": "EmojiHash", "visible": True} +edit_TextEdit = {"container": ProfileContentItem, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True} https_status_app_StatusBaseText = {"container": edit_TextEdit, "type": "StatusBaseText", "unnamed": 1, "visible": True} -copy_icon_CopyButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "copy-icon", "type": "CopyButton", "visible": True} -request_ID_verification_StatusFlatButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "requestIDVerification_StatusItem", "type": "StatusFlatButton", "visible": True} -send_contact_request_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "profileDialog_sendContactRequestButton", "type": "StatusButton", "visible": True} +copy_icon_CopyButton = {"container": ProfileContentItem, "objectName": "copy-icon", "type": "CopyButton", "visible": True} +request_ID_verification_StatusFlatButton = {"checkable": False, "container": ProfileContentItem, "objectName": "requestIDVerification_StatusItem", "type": "StatusFlatButton", "visible": True} +send_contact_request_StatusButton = {"checkable": False, "container": ProfileContentItem, "objectName": "profileDialog_sendContactRequestButton", "type": "StatusButton", "visible": True} # Welcome Status Popup betaConsent_StatusModal = {"container": statusDesktop_mainWindow_overlay, "objectName": "desktopBetaStatusModal", "type": "StatusModal", "visible": True}