chore: change 1x1 chat to add contacts through settings

This commit is contained in:
Anastasiya Semenkevich 2024-10-01 15:42:59 +03:00 committed by Michał
parent f8d33656e6
commit e015fface7
4 changed files with 74 additions and 126 deletions

View File

@ -32,5 +32,5 @@ class BeforeStartedPopUp(BasePopup):
assert self._terms_of_use_checkBox.checkState != 0, f"ToU checkbox is not checked" assert self._terms_of_use_checkBox.checkState != 0, f"ToU checkbox is not checked"
assert self._terms_of_use_link.is_visible, f"Terms of use link is missing" assert self._terms_of_use_link.is_visible, f"Terms of use link is missing"
assert self._privacy_policy_link.is_visible, f"Privacy Policy link is missing" assert self._privacy_policy_link.is_visible, f"Privacy Policy link is missing"
self._get_started_button.click() self._get_started_button.click(timeout=10)
self.wait_until_hidden() self.wait_until_hidden()

View File

@ -9,6 +9,7 @@ from allure_commons._allure import step
import driver import driver
from constants.images_paths import HEART_EMOJI_PATH, ANGRY_EMOJI_PATH, THUMBSUP_EMOJI_PATH, THUMBSDOWN_EMOJI_PATH, \ from constants.images_paths import HEART_EMOJI_PATH, ANGRY_EMOJI_PATH, THUMBSUP_EMOJI_PATH, THUMBSDOWN_EMOJI_PATH, \
LAUGHING_EMOJI_PATH, SAD_EMOJI_PATH LAUGHING_EMOJI_PATH, SAD_EMOJI_PATH
from constants.messaging import Messaging
from constants.wallet import WalletAddress from constants.wallet import WalletAddress
from gui.screens.messages import MessagesScreen, ToolBar from gui.screens.messages import MessagesScreen, ToolBar
@ -25,10 +26,11 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703087', '1-1 Chat') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703087', '1-1 Chat')
@pytest.mark.case(703087) @pytest.mark.case(703087)
@pytest.mark.critical @pytest.mark.critical
def test_1x1_chat(multiple_instances): def test_1x1_chat_add_contact_in_settings(multiple_instances):
user_one: UserAccount = RandomUser() user_one: UserAccount = RandomUser()
user_two: UserAccount = RandomUser() user_two: UserAccount = RandomUser()
main_window = MainWindow() main_window = MainWindow()
messages_screen = MessagesScreen() messages_screen = MessagesScreen()
emoji = 'sunglasses' emoji = 'sunglasses'
timeout = configs.timeouts.UI_LOAD_TIMEOUT_MSEC timeout = configs.timeouts.UI_LOAD_TIMEOUT_MSEC
@ -56,18 +58,69 @@ def test_1x1_chat(multiple_instances):
aut_one.attach() aut_one.attach()
main_window.prepare() main_window.prepare()
settings = main_window.left_panel.open_settings() settings = main_window.left_panel.open_settings()
contact_request_form = settings.left_panel.open_messaging_settings().open_contacts_settings().open_contact_request_form() messaging_settings = settings.left_panel.open_messaging_settings()
contact_request_form.send(chat_key, f'Hello {user_two.name}') 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'): with step('Verify that contact request was sent and is in pending requests'):
contacts_settings.open_pending_requests()
assert Messaging.CONTACT_REQUEST_SENT.value == contacts_settings.contact_items[0].object.contactText
assert len(contacts_settings.contact_items) == 1
assert contacts_settings.pending_request_sent_list_title == 'Sent'
main_window.hide()
with step(f'Verify that contact request was received by {user_two.name}'):
aut_two.attach() aut_two.attach()
main_window.prepare() main_window.prepare()
activity_center = ToolBar().open_activity_center() settings = main_window.left_panel.open_settings()
request = activity_center.find_contact_request_in_list(user_one.name, timeout) messaging_settings = settings.left_panel.open_messaging_settings()
activity_center.click_activity_center_button( contacts_settings = messaging_settings.open_contacts_settings()
'Contact requests').accept_contact_request(request) contacts_settings.open_pending_requests()
assert contacts_settings.pending_request_received_list_title == 'Received'
assert user_one.name == contacts_settings.contact_items[0].contact
assert len(contacts_settings.contact_items) == 1
# TODO https://github.com/status-im/desktop-qa-automation/issues/346
# with step('Verify toast message about new contact request received'):
# toast_messages = main_window.wait_for_notification()
# assert len(toast_messages) == 1, \
# f"Multiple toast messages appeared"
# message = toast_messages[0]
# assert message == Messaging.NEW_CONTACT_REQUEST.value, \
# f"Toast message is incorrect, current message is {message}"
with step(f'User {user_two.name}, accept contact request from {user_one.name}'):
contacts_settings.accept_contact_request(user_one.name)
with step(f'Verify that contact appeared in contacts list of {user_two.name} in messaging settings'):
contacts_settings = main_window.left_panel.open_settings().left_panel.open_messaging_settings().open_contacts_settings()
contacts_settings.open_contacts()
assert contacts_settings.contacts_list_title == 'Contacts'
assert user_one.name == contacts_settings.contact_items[0].contact
assert len(contacts_settings.contact_items) == 1
main_window.hide() main_window.hide()
with step(f'Verify that contact appeared in contacts list of {user_one.name} in messaging settings'):
aut_one.attach()
main_window.prepare()
contacts_settings = main_window.left_panel.open_settings().left_panel.open_messaging_settings().open_contacts_settings()
contacts_settings.open_contacts()
assert contacts_settings.contacts_list_title == 'Contacts'
assert user_two.name == contacts_settings.contact_items[0].contact
assert len(contacts_settings.contact_items) == 1
with step(f'Verify that 1X1 chat with {user_two.name} appeared for {user_one.name}'):
messages_screen = main_window.left_panel.open_messages_screen()
assert user_two.name in messages_screen.left_panel.get_chats_names
main_window.hide()
with step(f'Verify that 1X1 chat with {user_one.name} appeared for {user_two.name}'):
aut_two.attach()
main_window.prepare()
messages_screen = main_window.left_panel.open_messages_screen()
assert user_one.name in messages_screen.left_panel.get_chats_names
with step(f'User {user_one.name} send a message to {user_two.name}'): with step(f'User {user_one.name} send a message to {user_two.name}'):
aut_one.attach() aut_one.attach()
main_window.prepare() main_window.prepare()

View File

@ -22,7 +22,8 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703014', 'Create a group and send messages') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703014', 'Create a group and send messages')
@pytest.mark.case(703014) @pytest.mark.case(703014)
@pytest.mark.timeout(timeout=315) @pytest.mark.timeout(timeout=315)
def test_group_chat(multiple_instances): @pytest.mark.critical
def test_group_chat_add_contact_in_ac(multiple_instances):
user_one: UserAccount = RandomUser() user_one: UserAccount = RandomUser()
user_two: UserAccount = RandomUser() user_two: UserAccount = RandomUser()
user_three: UserAccount = RandomUser() user_three: UserAccount = RandomUser()

View File

@ -1,106 +0,0 @@
import allure
import pytest
from allure_commons._allure import step
from . import marks
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
pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703011', 'Add a contact with a chat key')
@pytest.mark.case(703011)
# TODO: reason='https://github.com/status-im/desktop-qa-automation/issues/346'
def test_messaging_settings_accepting_request(multiple_instances):
user_one: UserAccount = RandomUser()
user_two: UserAccount = RandomUser()
main_window = MainWindow()
with (multiple_instances(user_data=None) as aut_one, multiple_instances(user_data=None) as aut_two):
with step(f'Launch multiple instances with authorized 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('Verify that contact request was sent and is in pending requests'):
contacts_settings.open_pending_requests()
assert Messaging.CONTACT_REQUEST_SENT.value == contacts_settings.contact_items[0].object.contactText
assert len(contacts_settings.contact_items) == 1
assert contacts_settings.pending_request_sent_list_title == 'Sent'
main_window.hide()
with step(f'Verify that contact request was received by {user_two.name}'):
aut_two.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()
contacts_settings.open_pending_requests()
assert contacts_settings.pending_request_received_list_title == 'Received'
assert user_one.name == contacts_settings.contact_items[0].contact
assert len(contacts_settings.contact_items) == 1
# TODO https://github.com/status-im/desktop-qa-automation/issues/346
# with step('Verify toast message about new contact request received'):
# toast_messages = main_window.wait_for_notification()
# assert len(toast_messages) == 1, \
# f"Multiple toast messages appeared"
# message = toast_messages[0]
# assert message == Messaging.NEW_CONTACT_REQUEST.value, \
# f"Toast message is incorrect, current message is {message}"
with step(f'User {user_two.name}, accept contact request from {user_one.name}'):
contacts_settings.accept_contact_request(user_one.name)
with step(f'Verify that contact appeared in contacts list of {user_two.name} in messaging settings'):
contacts_settings = main_window.left_panel.open_settings().left_panel.open_messaging_settings().open_contacts_settings()
contacts_settings.open_contacts()
assert contacts_settings.contacts_list_title == 'Contacts'
assert user_one.name == contacts_settings.contact_items[0].contact
assert len(contacts_settings.contact_items) == 1
main_window.hide()
with step(f'Verify that contact appeared in contacts list of {user_one.name} in messaging settings'):
aut_one.attach()
main_window.prepare()
contacts_settings = main_window.left_panel.open_settings().left_panel.open_messaging_settings().open_contacts_settings()
contacts_settings.open_contacts()
assert contacts_settings.contacts_list_title == 'Contacts'
assert user_two.name == contacts_settings.contact_items[0].contact
assert len(contacts_settings.contact_items) == 1
with step(f'Verify that 1X1 chat with {user_two.name} appeared for {user_one.name}'):
messages_screen = main_window.left_panel.open_messages_screen()
assert user_two.name in messages_screen.left_panel.get_chats_names
main_window.hide()
with step(f'Verify that 1X1 chat with {user_one.name} appeared for {user_two.name}'):
aut_two.attach()
main_window.prepare()
messages_screen = main_window.left_panel.open_messages_screen()
assert user_one.name in messages_screen.left_panel.get_chats_names