test: verifications for share profile popup added

This commit is contained in:
Valentina Novgorodtceva 2024-07-11 13:16:55 +07:00 committed by Anastasiya
parent ab3fefa838
commit 01b4d1305d
5 changed files with 67 additions and 0 deletions

View File

@ -8,6 +8,7 @@ from gui.components.base_popup import BasePopup
from gui.components.context_menu import ContextMenu from gui.components.context_menu import ContextMenu
from gui.components.settings.review_contact_request_popup import AcceptRequestFromProfile from gui.components.settings.review_contact_request_popup import AcceptRequestFromProfile
from gui.components.settings.send_contact_request_popup import SendContactRequestFromProfile from gui.components.settings.send_contact_request_popup import SendContactRequestFromProfile
from gui.components.share_profile_popup import ShareProfilePopup
from gui.elements.button import Button from gui.elements.button import Button
from gui.elements.object import QObject from gui.elements.object import QObject
from gui.elements.text_label import TextLabel from gui.elements.text_label import TextLabel
@ -23,6 +24,7 @@ class ProfilePopup(BasePopup):
self._profile_image = QObject(names.ProfileHeader_userImage) self._profile_image = QObject(names.ProfileHeader_userImage)
self._user_name_label = TextLabel(names.ProfilePopup_displayName) self._user_name_label = TextLabel(names.ProfilePopup_displayName)
self._edit_profile_button = Button(names.ProfilePopup_editButton) self._edit_profile_button = Button(names.ProfilePopup_editButton)
self._share_profile_button = Button(names.share_Profile_StatusFlatButton)
self._chat_key_text_label = TextLabel(names.https_status_app_StatusBaseText) self._chat_key_text_label = TextLabel(names.https_status_app_StatusBaseText)
self._emoji_hash = QObject(names.profileDialog_userEmojiHash_EmojiHash) self._emoji_hash = QObject(names.profileDialog_userEmojiHash_EmojiHash)
self._chat_key_copy_button = Button(names.copy_icon_CopyButton) self._chat_key_copy_button = Button(names.copy_icon_CopyButton)
@ -85,6 +87,11 @@ class ProfilePopup(BasePopup):
self._edit_profile_button.click() self._edit_profile_button.click()
return ProfileSettingsView() return ProfileSettingsView()
@allure.step('Click share profile button')
def share_profile(self):
self._share_profile_button.click()
return ShareProfilePopup()
@allure.step('Wait until appears {0}') @allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._emoji_hash.wait_until_appears(timeout_msec) self._emoji_hash.wait_until_appears(timeout_msec)

View File

@ -0,0 +1,41 @@
import allure
import configs
import driver
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 ShareProfilePopup(BasePopup):
def __init__(self):
super().__init__()
self._profile_qr_code = QObject(names.o_Image)
self._profile_link_input = QObject(names.profileLinkInput_StatusBaseInput)
self._emoji_hash = TextLabel(names.o_EmojiHash)
self._copy_button = Button(names.o_copy_icon_CopyButton)
self._close_button = Button(names.closeCrossPopupButton)
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._profile_qr_code.wait_until_appears(timeout_msec)
return self
@allure.step('Get profile link')
def get_profile_link(self) -> str:
return str(self._profile_link_input.object.placeholderText)
@allure.step('Get profile qr code visibility')
def is_profile_qr_code_visibile(self) -> bool:
return self._profile_qr_code.is_visible
@allure.step('Get profile emoji hash')
def get_emoji_hash(self):
return self._emoji_hash.object.publicKey
@allure.step('Close share profile popup')
def close(self):
self._close_button.click()

View File

@ -95,6 +95,7 @@ ProfileContentItem = {"container": statusDesktop_mainWindow_overlay, "objectName
ProfileHeader_userImage = {"container": ProfileContentItem, "objectName": "ProfileDialog_userImage", "type": "UserImage", "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_displayName = {"container": ProfileContentItem, "objectName": "ProfileDialog_displayName", "type": "StatusBaseText", "visible": True}
ProfilePopup_editButton = {"container": ProfileContentItem, "objectName": "editProfileButton", "type": "StatusButton", "visible": True} ProfilePopup_editButton = {"container": ProfileContentItem, "objectName": "editProfileButton", "type": "StatusButton", "visible": True}
share_Profile_StatusFlatButton = {"checkable": False, "container": ProfileContentItem, "objectName": "shareProfileButton", "type": "StatusFlatButton", "visible": True}
ProfilePopup_SendContactRequestButton = {"container": ProfileContentItem, "objectName": "profileDialog_sendContactRequestButton", "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} profileDialog_userEmojiHash_EmojiHash = {"container": ProfileContentItem, "objectName": "ProfileDialog_userEmojiHash", "type": "EmojiHash", "visible": True}
edit_TextEdit = {"container": ProfileContentItem, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True} edit_TextEdit = {"container": ProfileContentItem, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True}
@ -107,6 +108,12 @@ review_contact_request_StatusButton = {"checkable": False, "container": statusDe
profileDialogView_ContentItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialogView", "type": "ContentItem", "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} menuButton_StatusFlatButton = {"checkable": False, "container": profileDialogView_ContentItem, "id": "menuButton", "type": "StatusFlatButton", "unnamed": 1, "visible": True}
# Share profile popup
o_Image = {"container": statusDesktop_mainWindow_overlay, "objectName": "profileQRCodeImage", "type": "Image", "visible": True}
o_copy_icon_CopyButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "copy-icon", "type": "CopyButton", "visible": True}
o_EmojiHash = {"container": statusDesktop_mainWindow_overlay, "type": "EmojiHash", "unnamed": 1, "visible": True}
profileLinkInput_StatusBaseInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "profileLinkInput", "type": "StatusBaseInput", "visible": True}
# Welcome Status Popup # Welcome Status Popup
betaConsent_StatusModal = {"container": statusDesktop_mainWindow_overlay, "objectName": "desktopBetaStatusModal", "type": "StatusModal", "visible": True} betaConsent_StatusModal = {"container": statusDesktop_mainWindow_overlay, "objectName": "desktopBetaStatusModal", "type": "StatusModal", "visible": True}
agreeToUse_StatusCheckBox = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "objectName": "desktopBetaAgreeCheckBox", "type": "StatusCheckBox", "visible": True} agreeToUse_StatusCheckBox = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "objectName": "desktopBetaAgreeCheckBox", "type": "StatusCheckBox", "visible": True}

View File

@ -126,6 +126,15 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, keys_screen,
assert profile_popup.get_emoji_hash == emoji_hash_public_key, \ assert profile_popup.get_emoji_hash == emoji_hash_public_key, \
f'Public keys should match when they dont' f'Public keys should match when they dont'
with step('Open share profile popup and check the data'):
share_profile_popup = profile_popup.share_profile()
profile_link = share_profile_popup.get_profile_link()
emoji_hash = share_profile_popup.get_emoji_hash()
assert share_profile_popup.is_profile_qr_code_visibile
assert chat_key in profile_link, f'Profile link is wrong {profile_link}, it does not contain correct chat key'
assert emoji_hash == emoji_hash_public_key, f'Public keys do not match'
share_profile_popup. close()
with step('Click left panel and open settings'): with step('Click left panel and open settings'):
main_window.left_panel.click() main_window.left_panel.click()
settings = main_window.left_panel.open_settings() settings = main_window.left_panel.open_settings()

View File

@ -47,6 +47,7 @@ StatusDialog {
color: Theme.palette.white color: Theme.palette.white
Image { Image {
objectName: "profileQRCodeImage"
anchors.fill: parent anchors.fill: parent
asynchronous: true asynchronous: true
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
@ -89,6 +90,7 @@ StatusDialog {
} }
StatusBaseInput { StatusBaseInput {
objectName: "profileLinkInput"
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 44 Layout.preferredHeight: 44
leftPadding: Style.current.padding leftPadding: Style.current.padding
@ -118,6 +120,7 @@ StatusDialog {
} }
StatusBaseInput { StatusBaseInput {
objectName: "emojiHashInput"
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 44 Layout.preferredHeight: 44
leftPadding: Style.current.padding leftPadding: Style.current.padding