chore: test switch state to offline, online or automatic updated
This commit is contained in:
parent
3174dc9f96
commit
2c03f8b29a
|
@ -53,3 +53,4 @@ class ColorCodes(Enum):
|
|||
GREEN = '#4ebc60'
|
||||
BLUE = '#2a4af5'
|
||||
ORANGE = '#ff9f0f'
|
||||
GRAY = '#939ba1'
|
||||
|
|
|
@ -164,5 +164,6 @@ croppedImageEditLogo = {"container": mainWindow_communityEditPanelScrollView_Edi
|
|||
croppedImageEditBanner = {"container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "objectName": "editCroppedImageItem_Community banner", "type": "EditCroppedImagePanel", "visible": True}
|
||||
|
||||
# User List Panel
|
||||
mainWindow_UserListPanel = {"container": statusDesktop_mainWindow, "type": "UserListPanel", "unnamed": 1, "visible": True}
|
||||
userListPanel_StatusMemberListItem = {"container": mainWindow_UserListPanel, "type": "StatusMemberListItem", "unnamed": 1, "visible": True}
|
||||
mainWindow_userListPanel_StatusListView = {"container": statusDesktop_mainWindow, "objectName": "userListPanel", "type": "StatusListView", "visible": True}
|
||||
userListPanel_StatusMemberListItem = {"container": mainWindow_userListPanel_StatusListView, "index": 1, "type": "StatusMemberListItem", "unnamed": 1, "visible": True}
|
||||
statusBadge_StatusBadge = {"container": userListPanel_StatusMemberListItem, "id": "statusBadge", "type": "StatusBadge", "unnamed": 1, "visible": True}
|
||||
|
|
|
@ -6,7 +6,7 @@ from allure_commons._allure import step
|
|||
|
||||
import configs
|
||||
import driver
|
||||
from constants import UserChannel
|
||||
from constants import UserChannel, ColorCodes
|
||||
from driver.objects_access import walk_children
|
||||
from gui.components.community.community_category_popup import NewCategoryPopup, EditCategoryPopup, CategoryPopup
|
||||
from gui.components.community.community_channel_popups import EditChannelPopup, NewChannelPopup
|
||||
|
@ -423,10 +423,21 @@ class Chat(QObject):
|
|||
class Members(QObject):
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(communities_names.mainWindow_UserListPanel)
|
||||
super().__init__(communities_names.mainWindow_userListPanel_StatusListView)
|
||||
self._member_item = QObject(communities_names.userListPanel_StatusMemberListItem)
|
||||
self._user_badge_color = QObject(communities_names.statusBadge_StatusBadge)
|
||||
|
||||
@property
|
||||
@allure.step('Get all members')
|
||||
def members(self) -> typing.List[str]:
|
||||
return [str(member.statusListItemTitle.text) for member in driver.findAllObjects(self._member_item.real_name)]
|
||||
|
||||
@allure.step('Verify member is offline by index')
|
||||
def member_is_offline(self, index: int) -> bool:
|
||||
self._member_item.real_name['index'] = index
|
||||
return self._user_badge_color.object.color.name == ColorCodes.GRAY.value
|
||||
|
||||
@allure.step('Verify member is online by index')
|
||||
def member_is_online(self, index: int) -> bool:
|
||||
self._member_item.real_name['index'] = index
|
||||
return self._user_badge_color.object.color.name == ColorCodes.GREEN.value
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
import time
|
||||
from datetime import datetime
|
||||
from copy import deepcopy
|
||||
|
||||
import allure
|
||||
import pytest
|
||||
from allure import step
|
||||
|
||||
import configs
|
||||
import constants
|
||||
from driver.aut import AUT
|
||||
import driver
|
||||
from constants import UserAccount
|
||||
from gui.components.changes_detected_popup import ChangesDetectedToastMessage
|
||||
from gui.main_window import MainWindow
|
||||
from . import marks
|
||||
|
@ -33,49 +39,116 @@ def test_change_own_display_name(main_screen: MainWindow, user_account, new_name
|
|||
|
||||
|
||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703002', 'Switch state to offline')
|
||||
@pytest.mark.case(703002)
|
||||
@pytest.mark.skip(reason="https://github.com/status-im/desktop-qa-automation/issues/149")
|
||||
def test_switch_states_between_offline_and_online(aut: AUT, main_screen: MainWindow, user_account):
|
||||
with (step('Open settings and switch state to offline')):
|
||||
settings = main_screen.left_panel
|
||||
settings.set_user_to_offline()
|
||||
|
||||
with step('Verify user appears offline'):
|
||||
assert settings.user_is_offline()
|
||||
|
||||
with step('Restart application'):
|
||||
aut.restart()
|
||||
main_screen.authorize_user(user_account)
|
||||
|
||||
with step('Verify user appears offline'):
|
||||
assert settings.user_is_offline()
|
||||
|
||||
with (step('Open settings and switch state to online')):
|
||||
settings = main_screen.left_panel
|
||||
settings.set_user_to_online()
|
||||
|
||||
with step('Restart application'):
|
||||
aut.restart()
|
||||
main_screen.authorize_user(user_account)
|
||||
|
||||
with step('Verify user appears online'):
|
||||
assert settings.user_is_online()
|
||||
|
||||
|
||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703003', 'Switch state to online')
|
||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703004', 'Switch state to automatic')
|
||||
@pytest.mark.case(703004)
|
||||
@pytest.mark.skip(reason="https://github.com/status-im/desktop-qa-automation/issues/149")
|
||||
def test_switch_state_to_automatic(aut: AUT, main_screen: MainWindow, user_account):
|
||||
with step('Open settings and switch state to automatic'):
|
||||
settings = main_screen.left_panel
|
||||
settings.set_user_to_automatic()
|
||||
@pytest.mark.case(703002, 703003, 703004)
|
||||
@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_switch_state_to_offline_online_automatic(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_screen = MainWindow()
|
||||
|
||||
with step('Verify user status set automatically to online'):
|
||||
assert settings.user_is_set_to_automatic()
|
||||
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_screen.wait_until_appears(configs.timeouts.APP_LOAD_TIMEOUT_MSEC).prepare()
|
||||
main_screen.authorize_user(account)
|
||||
main_screen.hide()
|
||||
|
||||
with step('Restart application'):
|
||||
aut.restart()
|
||||
main_screen.authorize_user(user_account)
|
||||
with step(f'User {user_two.name}, get chat key'):
|
||||
aut_two.attach()
|
||||
main_screen.prepare()
|
||||
profile_popup = main_screen.left_panel.open_online_identifier().open_profile_popup_from_online_identifier()
|
||||
chat_key = profile_popup.copy_chat_key
|
||||
profile_popup.close()
|
||||
main_screen.hide()
|
||||
|
||||
with step('Verify user status set automatically to online'):
|
||||
assert settings.user_is_set_to_automatic()
|
||||
with step(f'User {user_one.name}, send contact request to {user_two.name}'):
|
||||
aut_one.attach()
|
||||
main_screen.prepare()
|
||||
settings = main_screen.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_screen.hide()
|
||||
|
||||
with step(f'User {user_two.name}, accept contact request from {user_one.name}'):
|
||||
aut_two.attach()
|
||||
main_screen.prepare()
|
||||
settings = main_screen.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)
|
||||
|
||||
with step(f'User {user_two.name}, create community and invite {user_one.name}'):
|
||||
main_screen.create_community(community_params['name'], community_params['description'],
|
||||
community_params['intro'], community_params['outro'],
|
||||
community_params['logo']['fp'], community_params['banner']['fp'])
|
||||
main_screen.left_panel.invite_people_in_community([user_one.name], 'Message', community_params['name'])
|
||||
main_screen.hide()
|
||||
|
||||
with step(f'User {user_one.name}, accept invitation from {user_two.name}'):
|
||||
aut_one.attach()
|
||||
main_screen.prepare()
|
||||
messages_view = main_screen.left_panel.open_messages_screen()
|
||||
chat = messages_view.left_panel.open_chat(user_two.name)
|
||||
community_screen = chat.accept_community_invite(community_params['name'], '0')
|
||||
|
||||
with step(f'User {user_one.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_two.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'
|
||||
main_screen.hide()
|
||||
|
||||
with step(f'User {user_two.name}, switch state to offline'):
|
||||
aut_two.attach()
|
||||
main_screen.prepare()
|
||||
settings = main_screen.left_panel
|
||||
settings.set_user_to_offline()
|
||||
main_screen.hide()
|
||||
|
||||
with step(f'User {user_one.name}, sees {user_two.name} as offline'):
|
||||
aut_one.attach()
|
||||
main_screen.prepare()
|
||||
assert community_screen.right_panel.member_is_offline(1)
|
||||
main_screen.hide()
|
||||
|
||||
with step(f'User {user_two.name}, switch state to online'):
|
||||
aut_two.attach()
|
||||
main_screen.prepare()
|
||||
settings = main_screen.left_panel
|
||||
settings.set_user_to_online()
|
||||
main_screen.hide()
|
||||
|
||||
with step(f'User {user_one.name}, sees {user_two.name} as online'):
|
||||
aut_one.attach()
|
||||
main_screen.prepare()
|
||||
time.sleep(2)
|
||||
assert community_screen.right_panel.member_is_online(1)
|
||||
main_screen.hide()
|
||||
|
||||
with step(f'User {user_two.name}, switch state to automatic'):
|
||||
aut_two.attach()
|
||||
main_screen.prepare()
|
||||
settings = main_screen.left_panel
|
||||
settings.set_user_to_automatic()
|
||||
|
||||
with step('Verify user status set automatically to online'):
|
||||
assert settings.user_is_online()
|
||||
main_screen.hide()
|
||||
|
||||
with step(f'User {user_one.name}, sees {user_two.name} as online'):
|
||||
aut_one.attach()
|
||||
main_screen.prepare()
|
||||
assert community_screen.right_panel.member_is_online(1)
|
||||
main_screen.hide()
|
||||
|
|
Loading…
Reference in New Issue