chore: test_join_community was separated from others

This commit is contained in:
Valentina Novgorodtceva 2023-12-11 20:12:10 +07:00 committed by Valentina1133
parent 53717439f7
commit eeaba5822d
2 changed files with 95 additions and 86 deletions

View File

@ -1,4 +1,3 @@
from copy import deepcopy
from datetime import datetime
import allure
@ -7,8 +6,6 @@ from allure_commons._allure import step
import configs.testpath
import constants
import driver
from constants import UserAccount
from gui.main_window import MainWindow
@ -125,86 +122,3 @@ def test_edit_community(main_screen: MainWindow, params):
assert community_info.description == params['description']
# TODO after https://github.com/status-im/status-desktop/issues/12967 will be fixed
# assert '1' in community_info.members
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703510', 'Join community via owner invite')
@pytest.mark.case(703510)
@pytest.mark.parametrize('user_data_one, user_data_two', [
(configs.testpath.TEST_USER_DATA / 'user_account_one', configs.testpath.TEST_USER_DATA / 'user_account_two')
])
def test_join_community_via_owner_invite(multiple_instance, user_data_one, user_data_two):
user_one: UserAccount = constants.user_account_one
user_two: UserAccount = constants.user_account_two
community_params = deepcopy(constants.community_params)
community_params['name'] = f'{datetime.now():%d%m%Y_%H%M%S}'
main_window = MainWindow()
with multiple_instance() as aut_one, multiple_instance() 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_user_canvas().open_profile_popup()
chat_key = profile_popup.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}')
main_window.hide()
with step(f'User {user_two.name}, accept contact request from {user_one.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.accept_contact_request(user_one.name)
main_window.hide()
with step(f'User {user_one.name}, create community and {user_two.name}'):
aut_one.attach()
main_window.prepare()
main_window.create_community(community_params)
main_window.left_panel.invite_people_in_community([user_two.name], 'Message', community_params['name'])
main_window.hide()
with step(f'User {user_two.name}, accept invitation from {user_one.name}'):
aut_two.attach()
main_window.prepare()
messages_view = main_window.left_panel.open_messages_screen()
chat = messages_view.left_panel.open_chat(user_one.name)
community_screen = chat.accept_community_invite(community_params['name'])
with step(f'User {user_two.name}, verify welcome community popup'):
welcome_popup = community_screen.left_panel.open_welcome_community_popup()
assert community_params['name'] in welcome_popup.title
assert community_params['intro'] == welcome_popup.intro
welcome_popup.join().authenticate(user_one.password)
welcome_popup.share_address()
assert driver.waitFor(lambda: not community_screen.left_panel.is_join_community_visible,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Join community button not hidden'
with step(f'User {user_two.name}, see two members in community members list'):
assert user_one.name in community_screen.right_panel.members
assert driver.waitFor(lambda: '2' in community_screen.left_panel.members)
main_window.hide()
with step(f'User {user_one.name}, see two members in community members list'):
aut_one.attach()
main_window.prepare()
assert user_one.name in community_screen.right_panel.members
assert driver.waitFor(lambda: user_two.name in community_screen.right_panel.members)
assert '2' in community_screen.left_panel.members

View File

@ -0,0 +1,95 @@
from copy import deepcopy
from datetime import datetime
import allure
import pytest
from allure_commons._allure import step
import configs.testpath
import constants
import driver
from constants import UserAccount
from gui.main_window import MainWindow
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703510', 'Join community via owner invite')
@pytest.mark.case(703510)
@pytest.mark.parametrize('user_data_one, user_data_two', [
(configs.testpath.TEST_USER_DATA / 'user_account_one', configs.testpath.TEST_USER_DATA / 'user_account_two')
])
def test_join_community_via_owner_invite(multiple_instance, user_data_one, user_data_two):
user_one: UserAccount = constants.user_account_one
user_two: UserAccount = constants.user_account_two
community_params = deepcopy(constants.community_params)
community_params['name'] = f'{datetime.now():%d%m%Y_%H%M%S}'
main_window = MainWindow()
with multiple_instance() as aut_one, multiple_instance() 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_user_canvas().open_profile_popup()
chat_key = profile_popup.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}')
main_window.hide()
with step(f'User {user_two.name}, accept contact request from {user_one.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.accept_contact_request(user_one.name)
main_window.hide()
with step(f'User {user_one.name}, create community and {user_two.name}'):
aut_one.attach()
main_window.prepare()
main_window.create_community(community_params)
main_window.left_panel.invite_people_in_community([user_two.name], 'Message', community_params['name'])
main_window.hide()
with step(f'User {user_two.name}, accept invitation from {user_one.name}'):
aut_two.attach()
main_window.prepare()
messages_view = main_window.left_panel.open_messages_screen()
chat = messages_view.left_panel.open_chat(user_one.name)
community_screen = chat.accept_community_invite(community_params['name'])
with step(f'User {user_two.name}, verify welcome community popup'):
welcome_popup = community_screen.left_panel.open_welcome_community_popup()
assert community_params['name'] in welcome_popup.title
assert community_params['intro'] == welcome_popup.intro
welcome_popup.join().authenticate(user_one.password)
welcome_popup.share_address()
assert driver.waitFor(lambda: not community_screen.left_panel.is_join_community_visible,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Join community button not hidden'
with step(f'User {user_two.name}, see two members in community members list'):
assert user_one.name in community_screen.right_panel.members
assert driver.waitFor(lambda: '2' in community_screen.left_panel.members)
main_window.hide()
with step(f'User {user_one.name}, see two members in community members list'):
aut_one.attach()
main_window.prepare()
assert user_one.name in community_screen.right_panel.members
assert driver.waitFor(lambda: user_two.name in community_screen.right_panel.members)
assert '2' in community_screen.left_panel.members