chore: squeeze 2 tests into one, so links previews are checked on PR level too

This commit is contained in:
Anastasiya Semenkevich 2024-10-02 13:46:21 +03:00 committed by Anastasiya
parent 9acf8d8709
commit 4133afb676
12 changed files with 107 additions and 180 deletions

View File

@ -22,7 +22,7 @@ class RemoveWalletAccountPopup(BasePopup):
@allure.step('Confirm removing account') @allure.step('Confirm removing account')
def confirm(self): def confirm(self):
self._confirm_button.click() self._confirm_button.click(timeout=10)
self._confirm_button.wait_until_hidden() self._confirm_button.wait_until_hidden()
@allure.step('Agree and confirm removing account') @allure.step('Agree and confirm removing account')

View File

@ -6,12 +6,11 @@ from allure import step
from constants import RandomUser from constants import RandomUser
from helpers.WalletHelper import authenticate_with_password from helpers.WalletHelper import authenticate_with_password
from tests.wallet_main_screen import marks from . import marks
import constants import constants
from driver.aut import AUT from driver.aut import AUT
from gui.components.signing_phrase_popup import SigningPhrasePopup from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.components.authenticate_popup import AuthenticatePopup
from gui.main_window import MainWindow from gui.main_window import MainWindow
pytestmark = marks pytestmark = marks

View File

@ -7,13 +7,11 @@ from allure_commons._allure import step
from constants import RandomUser from constants import RandomUser
from helpers.WalletHelper import authenticate_with_password from helpers.WalletHelper import authenticate_with_password
from tests.settings.settings_wallet import marks from . import marks
import constants
import driver import driver
from constants.wallet import WalletAccountSettings, DerivationPathValue from constants.wallet import WalletAccountSettings, DerivationPathValue
from gui.components.signing_phrase_popup import SigningPhrasePopup from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.components.authenticate_popup import AuthenticatePopup
from gui.main_window import MainWindow from gui.main_window import MainWindow
from gui.screens.settings_wallet import WalletSettingsView from gui.screens.settings_wallet import WalletSettingsView

View File

@ -7,13 +7,12 @@ from allure_commons._allure import step
from constants import RandomUser from constants import RandomUser
from helpers.WalletHelper import authenticate_with_password from helpers.WalletHelper import authenticate_with_password
from scripts.utils.generators import random_wallet_account_name from scripts.utils.generators import random_wallet_account_name
from tests.wallet_main_screen import marks
import constants import constants
import driver import driver
from gui.components.signing_phrase_popup import SigningPhrasePopup from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.components.authenticate_popup import AuthenticatePopup
from gui.main_window import MainWindow from gui.main_window import MainWindow
from . import marks
pytestmark = marks pytestmark = marks

View File

@ -17,8 +17,7 @@ import configs.testpath
from constants import RandomUser, UserAccount from constants import RandomUser, UserAccount
from gui.main_window import MainWindow from gui.main_window import MainWindow
from scripts.utils.parsers import remove_tags from scripts.utils.parsers import remove_tags
from . import marks
from tests.messages import marks
pytestmark = marks pytestmark = marks

View File

@ -6,15 +6,14 @@ import pytest
from allure_commons._allure import step from allure_commons._allure import step
import driver import driver
from tests.messages import marks from constants.links import external_link, link_to_status_community
import configs.testpath import configs.testpath
import constants
from constants import UserAccount, RandomUser from constants import UserAccount, RandomUser
from scripts.utils.generators import random_name_string, random_password_string
from constants.messaging import Messaging from constants.messaging import Messaging
from gui.main_window import MainWindow from gui.main_window import MainWindow
from gui.screens.messages import MessagesScreen, ToolBar from gui.screens.messages import MessagesScreen, ToolBar
from . import marks
pytestmark = marks pytestmark = marks
@ -23,13 +22,17 @@ pytestmark = marks
@pytest.mark.case(703014) @pytest.mark.case(703014)
@pytest.mark.timeout(timeout=315) @pytest.mark.timeout(timeout=315)
@pytest.mark.critical @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_one: UserAccount = RandomUser()
user_two: UserAccount = RandomUser() user_two: UserAccount = RandomUser()
user_three: UserAccount = RandomUser() user_three: UserAccount = RandomUser()
members = [user_two.name, user_three.name] members = [user_two.name, user_three.name]
main_window = MainWindow() main_window = MainWindow()
messages_screen = MessagesScreen() messages_screen = MessagesScreen()
path = configs.testpath.TEST_IMAGES / 'comm_logo.jpeg'
timeout = configs.timeouts.UI_LOAD_TIMEOUT_MSEC timeout = configs.timeouts.UI_LOAD_TIMEOUT_MSEC
with \ with \
@ -171,6 +174,97 @@ def test_group_chat_add_contact_in_ac(multiple_instances):
for message_item in message_items: for message_item in message_items:
assert chat_message_2 in message_item 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'): with step('Leave group'):
messages_screen.group_chat.leave_group().confirm_leaving() 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 assert group_chat_new_name not in messages_screen.left_panel.get_chats_names
main_window.hide() 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() aut_one.attach()
main_window.prepare() main_window.prepare()
assert group_chat_new_name in messages_screen.left_panel.get_chats_names, \ assert group_chat_new_name in messages_screen.left_panel.get_chats_names, \

View File

@ -8,7 +8,7 @@ import constants
import driver import driver
from constants import RandomUser from constants import RandomUser
from gui.components.back_up_your_seed_phrase_banner import BackUpSeedPhraseBanner from gui.components.back_up_your_seed_phrase_banner import BackUpSeedPhraseBanner
from tests.onboarding import marks from . import marks
import configs.timeouts import configs.timeouts
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp from gui.components.onboarding.before_started_popup import BeforeStartedPopUp

View File

@ -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, \ from helpers.OnboardingHelper import open_generate_new_keys_view, open_import_seed_view_and_do_import, \
finalize_onboarding_and_login finalize_onboarding_and_login
from scripts.utils.generators import random_mnemonic, get_wallet_address_from_mnemonic 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.main_window import LeftPanel
from gui.screens.onboarding import LoginView from gui.screens.onboarding import LoginView

View File

@ -6,7 +6,6 @@ from allure_commons._allure import step
from . import marks from . import marks
import configs.testpath import configs.testpath
import constants
import driver import driver
from constants import UserAccount, RandomUser from constants import UserAccount, RandomUser
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp from gui.components.onboarding.before_started_popup import BeforeStartedPopUp

View File

@ -5,7 +5,7 @@ import allure
import pytest import pytest
from allure_commons._allure import step from allure_commons._allure import step
from tests.settings.settings_wallet import marks from . import marks
import configs import configs
import driver import driver

View File

@ -1,3 +0,0 @@
import pytest
marks = pytest.mark.messaging

View File

@ -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)