tests: use own profile link in messages so the information is not gone after 30 days

This commit is contained in:
Anastasiya Semenkevich 2024-08-27 10:34:00 +03:00 committed by Anastasiya
parent 2275fe4f1f
commit a7cb7376dd
6 changed files with 26 additions and 27 deletions

View File

@ -1,6 +1,7 @@
import time
import allure
import pyperclip
import configs
import constants
@ -20,6 +21,7 @@ class OnlineIdentifier(QObject):
self._inactive_button = Button(names.userContextmenu_InActiveButton)
self._automatic_button = Button(names.userContextmenu_AutomaticButton)
self._view_my_profile_button = Button(names.userContextMenu_ViewMyProfileAction)
self._copy_link_to_profile = QObject(names.userContextMenu_CopyLinkToProfile)
self._user_name_text_label = TextLabel(names.userLabel_StyledText)
self._identicon_ring = QObject(names.o_StatusIdenticonRing)
@ -28,11 +30,6 @@ class OnlineIdentifier(QObject):
driver.waitFor(lambda: self._view_my_profile_button.is_visible, timeout_msec)
return self
@property
@allure.step('Check identicon ring visibility')
def is_identicon_ring_visible(self):
return self._identicon_ring.is_visible
@property
@allure.step('Get user name')
def get_user_name(self) -> str:
@ -57,3 +54,9 @@ class OnlineIdentifier(QObject):
def open_profile_popup_from_online_identifier(self) -> ProfilePopup:
self._view_my_profile_button.click()
return ProfilePopup().wait_until_appears()
@allure.step('Copy link to profile from online identifier')
def copy_link_to_profile(self) -> str:
self._copy_link_to_profile.click()
link = str(pyperclip.paste())
return link

View File

@ -87,6 +87,7 @@ userContextmenu_AlwaysActiveButton= {"container": o_StatusListView, "objectName"
userContextmenu_InActiveButton= {"container": o_StatusListView, "objectName": "userStatusMenuInactiveAction", "type": "StatusMenuItem", "visible": True}
userContextmenu_AutomaticButton= {"container": o_StatusListView, "objectName": "userStatusMenuAutomaticAction", "type": "StatusMenuItem", "visible": True}
userContextMenu_ViewMyProfileAction = {"container": o_StatusListView, "objectName": "userStatusViewMyProfileAction", "type": "StatusMenuItem", "visible": True}
userContextMenu_CopyLinkToProfile = {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusCopyLinkAction", "type": "StatusMenuItem", "visible": True}
userLabel_StyledText = {"container": o_StatusListView, "type": "StyledText", "unnamed": 1, "visible": True}
o_StatusIdenticonRing = {"container": o_StatusListView, "type": "StatusIdenticonRing", "unnamed": 1, "visible": True}

View File

@ -312,11 +312,6 @@ class YourProfileView(OnboardingView):
def get_profile_image(self) -> Image:
return self._profile_image.image
@property
@allure.step('Check identicon ring visibility')
def is_identicon_ring_visible(self):
return self._identicon_ring.is_visible
@property
@allure.step('Get error messages')
def get_error_message(self) -> str:
@ -415,11 +410,6 @@ class YourEmojihashAndIdenticonRingView(OnboardingView):
def get_emoji_hash(self) -> str:
return str(getattr(self._emoji_hash.object, 'publicKey'))
@property
@allure.step('Verify: Identicon ring visible')
def is_identicon_ring_visible(self):
return self._identicon_ring.is_visible
@allure.step('Click next in your emojihash and identicon ring view')
def next(self):
# TODO https://github.com/status-im/status-desktop/issues/15345

View File

@ -93,7 +93,7 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, keys_screen,
emoji_hash_identicon_view = YourEmojihashAndIdenticonRingView().verify_emojihash_view_present()
chat_key = emoji_hash_identicon_view.get_chat_key
emoji_hash_public_key = emoji_hash_identicon_view.get_emoji_hash
assert emoji_hash_identicon_view.is_identicon_ring_visible, f'Identicon ring is not present when it should'
assert emoji_hash_identicon_view._identicon_ring.is_visible, f'Identicon ring is not present when it should'
with step('Click Start using Status'):
next_view = emoji_hash_identicon_view.next()
@ -112,7 +112,7 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, keys_screen,
online_identifier = main_window.left_panel.open_online_identifier()
assert online_identifier.get_user_name == user_name, \
f'Display name in online identifier is wrong, current: {online_identifier.get_user_name}, expected: {user_name}'
assert online_identifier.is_identicon_ring_visible, \
assert online_identifier._identicon_ring.is_visible, \
f'Identicon ring is not present when it should'
assert str(online_identifier.object.pubkey) is not None, \
f'Public key is not present'

View File

@ -5,7 +5,7 @@ from allure_commons._allure import step
import configs.testpath
import driver
from constants import UserAccount, RandomUser
from constants.links import external_link, link_to_status_community, status_user_profile_link
from constants.links import external_link, link_to_status_community
from constants.messaging import Messaging
from gui.main_window import MainWindow
from gui.screens.messages import MessagesScreen, ToolBar
@ -21,11 +21,10 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704578', 'Status community link preview bubble')
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704589', 'Status user profile link preview')
@pytest.mark.case(704596, 704578, 704578)
@pytest.mark.parametrize('community_name, domain_link, user_name, domain_link_2, user_emoji_hash',
[pytest.param('Status', 'status.app', 'Test1', 'github.com',
'0x04c1671d3659b92671cdac657a901e133ca1cfadddbb640db7dec342ee70c4142533cc03e89eff2bd09dd75aea71d45ab2b605bc7e1996c4a6a82d037f4070d13c')
@pytest.mark.parametrize('community_name, domain_link, domain_link_2',
[pytest.param('Status', 'status.app', 'github.com')
])
def test_link_previews(multiple_instances, community_name, domain_link, user_name, domain_link_2, user_emoji_hash):
def test_link_previews(multiple_instances, community_name, domain_link, domain_link_2):
user_one: UserAccount = RandomUser()
user_two: UserAccount = RandomUser()
main_window = MainWindow()
@ -65,6 +64,11 @@ def test_link_previews(multiple_instances, community_name, domain_link, user_nam
request = activity_center.find_contact_request_in_list(user_one.name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
activity_center.click_activity_center_button(
'Contact requests').accept_contact_request(request)
activity_center.click()
with step(f'User {user_two.name}, get own profile link and emoji hash in online identifier'):
profile_link = main_window.left_panel.open_online_identifier().copy_link_to_profile()
public_key_from_emoji_hash = main_window.left_panel.open_online_identifier().open_profile_popup_from_online_identifier().get_emoji_hash
with step(f'User {user_two.name} opens 1x1 chat with {user_one.name} and paste external link'):
messages_screen.left_panel.click_chat_by_name(user_one.name)
@ -140,15 +144,15 @@ def test_link_previews(multiple_instances, community_name, domain_link, user_nam
messages_screen.group_chat.confirm_sending_message()
with step(f'Paste link to user profile link and send message'):
message_user = status_user_profile_link
message_user = profile_link
messages_screen.group_chat.type_message(message_user)
assert driver.waitFor(
lambda: user_name == messages_screen.group_chat.get_link_preview_bubble_title(), 12000)
lambda: user_two.name == messages_screen.group_chat.get_link_preview_bubble_title(), 12000)
messages_screen.group_chat.confirm_sending_message()
with step('Verify title and emojihash are correct for link preview of sent message'):
sent_message = messages_screen.chat.messages(0)
assert driver.waitFor(lambda: sent_message[0].get_link_preview_title() == user_name,
assert driver.waitFor(lambda: sent_message[0].get_link_preview_title() == user_two.name,
timeout)
assert driver.waitFor(lambda: sent_message[0].link_preview_emoji_hash == user_emoji_hash,
assert driver.waitFor(lambda: sent_message[0].link_preview_emoji_hash == public_key_from_emoji_hash,
timeout)

View File

@ -40,6 +40,7 @@ StatusMenu {
}
StatusAction {
objectName: "userStatusCopyLinkAction"
text: qsTr("Copy link to profile")
icon.name: "copy"
onTriggered: {