From 4133afb6765cba28b9983d2fe0ea3733b27d81a2 Mon Sep 17 00:00:00 2001 From: Anastasiya Semenkevich Date: Wed, 2 Oct 2024 13:46:21 +0300 Subject: [PATCH] chore: squeeze 2 tests into one, so links previews are checked on PR level too --- .../wallet/remove_wallet_account_popup.py | 2 +- .../test_add_account_after_restart.py | 3 +- .../test_add_delete_account_from_settings.py | 4 +- .../test_add_edit_delete_generated_account.py | 3 +- .../test_messaging_1x1_chat.py | 3 +- .../test_messaging_group_chat.py | 104 +++++++++++- ...nboarding_generate_account_back_up_seed.py | 2 +- .../test_onboarding_import_seed.py | 2 +- .../test_onboarding_sync_with_code.py | 1 - ...est_wallet_settings_saved_addresses_add.py | 2 +- test/e2e/tests/messages/__init__.py | 3 - .../messages/test_messaging_link_previews.py | 158 ------------------ 12 files changed, 107 insertions(+), 180 deletions(-) delete mode 100644 test/e2e/tests/messages/__init__.py delete mode 100644 test/e2e/tests/messages/test_messaging_link_previews.py diff --git a/test/e2e/gui/components/wallet/remove_wallet_account_popup.py b/test/e2e/gui/components/wallet/remove_wallet_account_popup.py index 593f0e2c01..e956b93092 100644 --- a/test/e2e/gui/components/wallet/remove_wallet_account_popup.py +++ b/test/e2e/gui/components/wallet/remove_wallet_account_popup.py @@ -22,7 +22,7 @@ class RemoveWalletAccountPopup(BasePopup): @allure.step('Confirm removing account') def confirm(self): - self._confirm_button.click() + self._confirm_button.click(timeout=10) self._confirm_button.wait_until_hidden() @allure.step('Agree and confirm removing account') diff --git a/test/e2e/tests/crtitical_tests_prs/test_add_account_after_restart.py b/test/e2e/tests/crtitical_tests_prs/test_add_account_after_restart.py index 5081e38d27..31cc98da24 100644 --- a/test/e2e/tests/crtitical_tests_prs/test_add_account_after_restart.py +++ b/test/e2e/tests/crtitical_tests_prs/test_add_account_after_restart.py @@ -6,12 +6,11 @@ from allure import step from constants import RandomUser from helpers.WalletHelper import authenticate_with_password -from tests.wallet_main_screen import marks +from . import marks import constants from driver.aut import AUT from gui.components.signing_phrase_popup import SigningPhrasePopup -from gui.components.authenticate_popup import AuthenticatePopup from gui.main_window import MainWindow pytestmark = marks diff --git a/test/e2e/tests/crtitical_tests_prs/test_add_delete_account_from_settings.py b/test/e2e/tests/crtitical_tests_prs/test_add_delete_account_from_settings.py index 1ae9f98bd1..a2d1f25864 100644 --- a/test/e2e/tests/crtitical_tests_prs/test_add_delete_account_from_settings.py +++ b/test/e2e/tests/crtitical_tests_prs/test_add_delete_account_from_settings.py @@ -7,13 +7,11 @@ from allure_commons._allure import step from constants import RandomUser from helpers.WalletHelper import authenticate_with_password -from tests.settings.settings_wallet import marks +from . import marks -import constants import driver from constants.wallet import WalletAccountSettings, DerivationPathValue from gui.components.signing_phrase_popup import SigningPhrasePopup -from gui.components.authenticate_popup import AuthenticatePopup from gui.main_window import MainWindow from gui.screens.settings_wallet import WalletSettingsView diff --git a/test/e2e/tests/crtitical_tests_prs/test_add_edit_delete_generated_account.py b/test/e2e/tests/crtitical_tests_prs/test_add_edit_delete_generated_account.py index bc2ae4fc94..9f7add1940 100644 --- a/test/e2e/tests/crtitical_tests_prs/test_add_edit_delete_generated_account.py +++ b/test/e2e/tests/crtitical_tests_prs/test_add_edit_delete_generated_account.py @@ -7,13 +7,12 @@ from allure_commons._allure import step from constants import RandomUser from helpers.WalletHelper import authenticate_with_password from scripts.utils.generators import random_wallet_account_name -from tests.wallet_main_screen import marks import constants import driver from gui.components.signing_phrase_popup import SigningPhrasePopup -from gui.components.authenticate_popup import AuthenticatePopup from gui.main_window import MainWindow +from . import marks pytestmark = marks diff --git a/test/e2e/tests/crtitical_tests_prs/test_messaging_1x1_chat.py b/test/e2e/tests/crtitical_tests_prs/test_messaging_1x1_chat.py index 5c388d8943..de601b712a 100644 --- a/test/e2e/tests/crtitical_tests_prs/test_messaging_1x1_chat.py +++ b/test/e2e/tests/crtitical_tests_prs/test_messaging_1x1_chat.py @@ -17,8 +17,7 @@ import configs.testpath from constants import RandomUser, UserAccount from gui.main_window import MainWindow from scripts.utils.parsers import remove_tags - -from tests.messages import marks +from . import marks pytestmark = marks diff --git a/test/e2e/tests/crtitical_tests_prs/test_messaging_group_chat.py b/test/e2e/tests/crtitical_tests_prs/test_messaging_group_chat.py index 5aef963abd..02161fef05 100644 --- a/test/e2e/tests/crtitical_tests_prs/test_messaging_group_chat.py +++ b/test/e2e/tests/crtitical_tests_prs/test_messaging_group_chat.py @@ -6,15 +6,14 @@ import pytest from allure_commons._allure import step import driver -from tests.messages import marks +from constants.links import external_link, link_to_status_community import configs.testpath -import constants from constants import UserAccount, RandomUser -from scripts.utils.generators import random_name_string, random_password_string from constants.messaging import Messaging from gui.main_window import MainWindow from gui.screens.messages import MessagesScreen, ToolBar +from . import marks pytestmark = marks @@ -23,13 +22,17 @@ pytestmark = marks @pytest.mark.case(703014) @pytest.mark.timeout(timeout=315) @pytest.mark.critical -def test_group_chat_add_contact_in_ac(multiple_instances): +@pytest.mark.parametrize('community_name, domain_link, domain_link_2', + [pytest.param('Status', 'status.app', 'github.com') + ]) +def test_group_chat_add_contact_in_ac(multiple_instances, community_name, domain_link, domain_link_2): user_one: UserAccount = RandomUser() user_two: UserAccount = RandomUser() user_three: UserAccount = RandomUser() members = [user_two.name, user_three.name] main_window = MainWindow() messages_screen = MessagesScreen() + path = configs.testpath.TEST_IMAGES / 'comm_logo.jpeg' timeout = configs.timeouts.UI_LOAD_TIMEOUT_MSEC with \ @@ -171,6 +174,97 @@ def test_group_chat_add_contact_in_ac(multiple_instances): for message_item in message_items: assert chat_message_2 in message_item + 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} paste external link'): + message = external_link + messages_screen.group_chat.send_message_to_group_chat(message) + messages_screen.group_chat.type_message(message) + + with step('Verify text in the link preview bubble'): + assert driver.waitFor( + lambda: Messaging.SHOW_PREVIEWS_TITLE.value == messages_screen.group_chat.get_show_link_preview_bubble_title(), + timeout), f'Actual title of the link preview is not correct' + assert Messaging.SHOW_PREVIEWS_TEXT.value == messages_screen.group_chat.get_show_link_preview_bubble_description(), \ + f'Actual text of the link preview is not correct' + + with step('Click options combobox and verify that there are 3 options'): + messages_screen.group_chat.click_options().are_all_options_visible() + + with step('Close link preview options popup and send a message'): + messages_screen.group_chat.close_link_preview_popup().confirm_sending_message() + + with step('Verify that message was sent without preview'): + sent_message = messages_screen.chat.messages(0) + assert driver.waitFor(lambda: sent_message[0].link_preview is None, + timeout), f'Message was wrongly sent with preview' + + with step(f'Paste external link again and verify that there are still 3 options'): + messages_screen.group_chat.type_message(message) + messages_screen.group_chat.click_options().are_all_options_visible() + + with step('Close link preview options popup and send a message'): + messages_screen.group_chat.close_link_preview_popup().confirm_sending_message() + + with step('Change preview settings to always show previews in messaging settings'): + main_window.left_panel.open_settings().left_panel.open_messaging_settings().click_always_show() + main_window.left_panel.open_messages_screen().left_panel.click_chat_by_name(group_chat_new_name) + + with step(f'Paste external link again'): + messages_screen.group_chat.type_message(message) + + with step('Wait until link preview is ready'): + assert driver.waitFor( + lambda: domain_link_2 == messages_screen.group_chat.get_link_preview_bubble_description(), + configs.timeouts.UI_LOAD_TIMEOUT_MSEC) + + with step(f'Paste image to the same message'): + messages_screen.group_chat.choose_image(str(path)) + messages_screen.group_chat.send_message() + + with step('Verify image and link unfurl are present in the last sent message'): + message_object = messages_screen.chat.messages(0)[0] + assert driver.waitFor(lambda: message_object.image_message.visible, + timeout), f"Image is not found in the last message" + assert driver.waitFor(lambda: message_object.delegate_button.is_visible, + timeout), f"Link preview is not found in the last message" + assert driver.waitFor(lambda: message_object.banner_image.is_visible, + timeout), f"Banner image is not found in the last message" + assert driver.waitFor( + lambda: domain_link_2 == message_object.get_link_domain(), + configs.timeouts.UI_LOAD_TIMEOUT_MSEC) + + with step(f'Paste link to status community'): + message_community = link_to_status_community + messages_screen.group_chat.type_message(message_community) + + with step('Verify title and subtitle of preview are correct and close button exists'): + assert driver.waitFor( + lambda: community_name == messages_screen.group_chat.get_link_preview_bubble_title(), + configs.timeouts.UI_LOAD_TIMEOUT_MSEC) + assert driver.waitFor( + lambda: domain_link == messages_screen.group_chat.get_link_preview_bubble_description(), + configs.timeouts.UI_LOAD_TIMEOUT_MSEC) + + with step('Close link preview options popup and send a message'): + messages_screen.group_chat.confirm_sending_message() + + with step(f'Paste link to user profile link and send message'): + message_user = profile_link + messages_screen.group_chat.type_message(message_user) + assert driver.waitFor( + 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_two.name, + timeout) + assert driver.waitFor(lambda: sent_message[0].link_preview_emoji_hash == public_key_from_emoji_hash, + timeout) + with step('Leave group'): messages_screen.group_chat.leave_group().confirm_leaving() @@ -205,7 +299,7 @@ def test_group_chat_add_contact_in_ac(multiple_instances): assert group_chat_new_name not in messages_screen.left_panel.get_chats_names main_window.hide() - with step(f'Get back to {aut_one} and check members list'): + with step(f'Get back to {user_one.name} and check members list'): aut_one.attach() main_window.prepare() assert group_chat_new_name in messages_screen.left_panel.get_chats_names, \ diff --git a/test/e2e/tests/crtitical_tests_prs/test_onboarding_generate_account_back_up_seed.py b/test/e2e/tests/crtitical_tests_prs/test_onboarding_generate_account_back_up_seed.py index 33905730b5..b7b97f61cc 100755 --- a/test/e2e/tests/crtitical_tests_prs/test_onboarding_generate_account_back_up_seed.py +++ b/test/e2e/tests/crtitical_tests_prs/test_onboarding_generate_account_back_up_seed.py @@ -8,7 +8,7 @@ import constants import driver from constants import RandomUser from gui.components.back_up_your_seed_phrase_banner import BackUpSeedPhraseBanner -from tests.onboarding import marks +from . import marks import configs.timeouts from gui.components.onboarding.before_started_popup import BeforeStartedPopUp diff --git a/test/e2e/tests/crtitical_tests_prs/test_onboarding_import_seed.py b/test/e2e/tests/crtitical_tests_prs/test_onboarding_import_seed.py index 78636c59d0..ca7ae41413 100644 --- a/test/e2e/tests/crtitical_tests_prs/test_onboarding_import_seed.py +++ b/test/e2e/tests/crtitical_tests_prs/test_onboarding_import_seed.py @@ -9,7 +9,7 @@ from driver.aut import AUT from helpers.OnboardingHelper import open_generate_new_keys_view, open_import_seed_view_and_do_import, \ finalize_onboarding_and_login from scripts.utils.generators import random_mnemonic, get_wallet_address_from_mnemonic -from tests.onboarding import marks +from . import marks from gui.main_window import LeftPanel from gui.screens.onboarding import LoginView diff --git a/test/e2e/tests/crtitical_tests_prs/test_onboarding_sync_with_code.py b/test/e2e/tests/crtitical_tests_prs/test_onboarding_sync_with_code.py index 611848a42c..e71fa3f740 100644 --- a/test/e2e/tests/crtitical_tests_prs/test_onboarding_sync_with_code.py +++ b/test/e2e/tests/crtitical_tests_prs/test_onboarding_sync_with_code.py @@ -6,7 +6,6 @@ from allure_commons._allure import step from . import marks import configs.testpath -import constants import driver from constants import UserAccount, RandomUser from gui.components.onboarding.before_started_popup import BeforeStartedPopUp diff --git a/test/e2e/tests/crtitical_tests_prs/test_wallet_settings_saved_addresses_add.py b/test/e2e/tests/crtitical_tests_prs/test_wallet_settings_saved_addresses_add.py index f15d6e69a4..c84217ca29 100644 --- a/test/e2e/tests/crtitical_tests_prs/test_wallet_settings_saved_addresses_add.py +++ b/test/e2e/tests/crtitical_tests_prs/test_wallet_settings_saved_addresses_add.py @@ -5,7 +5,7 @@ import allure import pytest from allure_commons._allure import step -from tests.settings.settings_wallet import marks +from . import marks import configs import driver diff --git a/test/e2e/tests/messages/__init__.py b/test/e2e/tests/messages/__init__.py deleted file mode 100644 index 76d6db9598..0000000000 --- a/test/e2e/tests/messages/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -import pytest - -marks = pytest.mark.messaging diff --git a/test/e2e/tests/messages/test_messaging_link_previews.py b/test/e2e/tests/messages/test_messaging_link_previews.py deleted file mode 100644 index f0780f193f..0000000000 --- a/test/e2e/tests/messages/test_messaging_link_previews.py +++ /dev/null @@ -1,158 +0,0 @@ -import allure -import pytest -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 -from constants.messaging import Messaging -from gui.main_window import MainWindow -from gui.screens.messages import MessagesScreen, ToolBar - -import configs.testpath -from . import marks - -pytestmark = marks - - -@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704596', - 'Sending a link for the first time - default setting') -@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, domain_link_2', - [pytest.param('Status', 'status.app', 'github.com') - ]) -def test_link_previews(multiple_instances, community_name, domain_link, domain_link_2): - user_one: UserAccount = RandomUser() - user_two: UserAccount = RandomUser() - main_window = MainWindow() - messages_screen = MessagesScreen() - path = configs.testpath.TEST_IMAGES / 'comm_logo.jpeg' - timeout = configs.timeouts.UI_LOAD_TIMEOUT_MSEC - - with (multiple_instances(user_data=None) as aut_one, multiple_instances(user_data=None) as aut_two): - with step(f'Launch multiple instances with new users {user_one.name} and {user_two.name}'): - for aut, account in zip([aut_one, aut_two], [user_one, user_two]): - aut.attach() - main_window.wait_until_appears(configs.timeouts.APP_LOAD_TIMEOUT_MSEC).prepare() - main_window.authorize_user(account) - main_window.hide() - - with step(f'User {user_two.name}, get chat key'): - aut_two.attach() - main_window.prepare() - profile_popup = main_window.left_panel.open_online_identifier().open_profile_popup_from_online_identifier() - chat_key = profile_popup.copy_chat_key - profile_popup.close() - main_window.hide() - - with step(f'User {user_one.name}, send contact request to {user_two.name}'): - aut_one.attach() - main_window.prepare() - settings = main_window.left_panel.open_settings() - messaging_settings = settings.left_panel.open_messaging_settings() - contacts_settings = messaging_settings.open_contacts_settings() - contact_request_popup = contacts_settings.open_contact_request_form() - contact_request_popup.send(chat_key, f'Hello {user_two.name}') - - with step(f'User {user_two.name}, accept contact request from {user_one.name} via activity center'): - aut_two.attach() - main_window.prepare() - activity_center = ToolBar().open_activity_center() - 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) - message = external_link - messages_screen.group_chat.type_message(message) - - with step('Verify text in the link preview bubble'): - assert driver.waitFor( - lambda: Messaging.SHOW_PREVIEWS_TITLE.value == messages_screen.group_chat.get_show_link_preview_bubble_title(), - timeout), f'Actual title of the link preview is not correct' - assert Messaging.SHOW_PREVIEWS_TEXT.value == messages_screen.group_chat.get_show_link_preview_bubble_description(), \ - f'Actual text of the link preview is not correct' - - with step('Click options combobox and verify that there are 3 options'): - messages_screen.group_chat.click_options().are_all_options_visible() - - with step('Close link preview options popup and send a message'): - messages_screen.group_chat.close_link_preview_popup().confirm_sending_message() - - with step('Verify that message was sent without preview'): - sent_message = messages_screen.chat.messages(0) - assert driver.waitFor(lambda: sent_message[0].link_preview is None, - timeout), f'Message was wrongly sent with preview' - - with step(f'Paste external link again and verify that there are still 3 options'): - messages_screen.group_chat.type_message(message) - messages_screen.group_chat.click_options().are_all_options_visible() - - with step('Close link preview options popup and send a message'): - messages_screen.group_chat.close_link_preview_popup().confirm_sending_message() - - with step('Change preview settings to always show previews in messaging settings'): - main_window.left_panel.open_settings().left_panel.open_messaging_settings().click_always_show() - main_window.left_panel.open_messages_screen().left_panel.click_chat_by_name(user_one.name) - - with step(f'Paste external link again'): - messages_screen.group_chat.type_message(message) - - with step('Wait until link preview is ready'): - assert driver.waitFor( - lambda: domain_link_2 == messages_screen.group_chat.get_link_preview_bubble_description(), - configs.timeouts.UI_LOAD_TIMEOUT_MSEC) - - with step(f'Paste image to the same message'): - messages_screen.group_chat.choose_image(str(path)) - messages_screen.group_chat.send_message() - - with step('Verify image and link unfurl are present in the last sent message'): - message_object = messages_screen.chat.messages(0)[0] - assert driver.waitFor(lambda: message_object.image_message.visible, - timeout), f"Image is not found in the last message" - assert driver.waitFor(lambda: message_object.delegate_button.is_visible, - timeout), f"Link preview is not found in the last message" - assert driver.waitFor(lambda: message_object.banner_image.is_visible, - timeout), f"Banner image is not found in the last message" - assert driver.waitFor( - lambda: domain_link_2 == message_object.get_link_domain(), - configs.timeouts.UI_LOAD_TIMEOUT_MSEC) - - with step(f'Paste link to status community'): - message_community = link_to_status_community - messages_screen.group_chat.type_message(message_community) - - with step('Verify title and subtitle of preview are correct and close button exists'): - assert driver.waitFor( - lambda: community_name == messages_screen.group_chat.get_link_preview_bubble_title(), - configs.timeouts.UI_LOAD_TIMEOUT_MSEC) - assert driver.waitFor( - lambda: domain_link == messages_screen.group_chat.get_link_preview_bubble_description(), - configs.timeouts.UI_LOAD_TIMEOUT_MSEC) - - with step('Close link preview options popup and send a message'): - messages_screen.group_chat.confirm_sending_message() - - with step(f'Paste link to user profile link and send message'): - message_user = profile_link - messages_screen.group_chat.type_message(message_user) - assert driver.waitFor( - 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_two.name, - timeout) - assert driver.waitFor(lambda: sent_message[0].link_preview_emoji_hash == public_key_from_emoji_hash, - timeout)