diff --git a/gui/components/community/authenticate_popup.py b/gui/components/community/authenticate_popup.py index 9d30726..fb84cd5 100644 --- a/gui/components/community/authenticate_popup.py +++ b/gui/components/community/authenticate_popup.py @@ -26,7 +26,7 @@ class AuthenticatePopup(BasePopup): def authenticate(self, password: str): self._password_text_edit.type_text(password) self._authenticate_button.click() - self._authenticate_button.wait_until_hidden() + self._authenticate_button.wait_until_hidden(8000) @allure.step('Close authenticate popup by close button') def close_authenticate_popup(self): diff --git a/gui/screens/community.py b/gui/screens/community.py index 182a876..54b44a0 100644 --- a/gui/screens/community.py +++ b/gui/screens/community.py @@ -228,7 +228,7 @@ class LeftPanel(QObject): @property @allure.step('Get Join button visible attribute') def is_join_community_visible(self) -> bool: - return self._join_community_button.is_visible + return self._join_community_button.exists @property @allure.step('Get channels') diff --git a/gui/screens/community_settings.py b/gui/screens/community_settings.py index 81b8d09..2d06245 100644 --- a/gui/screens/community_settings.py +++ b/gui/screens/community_settings.py @@ -3,6 +3,7 @@ import typing import allure +import configs import driver from driver.objects_access import walk_children from gui.components.community.color_select_popup import ColorSelectPopup @@ -268,17 +269,28 @@ class MembersView(QObject): def members(self) -> typing.List[str]: return [str(member.title) for member in driver.findAllObjects(self._member_list_item.real_name)] - @allure.step('Get community member object') - def get_member_object(self, member_name: str): + @allure.step('Get community member objects') + def get_member_objects(self) -> typing.List: + member_objects = [] for item in driver.findAllObjects(self._member_list_item.real_name): - if str(getattr(item, 'title', '')) == str(member_name): - return item - else: + member_objects.append(item) + return member_objects + + @allure.step('Find community member by name') + def get_member_object(self, member_name: str): + member = None + started_at = time.monotonic() + while member is None: + for _member in self.get_member_objects(): + if member_name in str(_member.userName): + member = _member + break + if time.monotonic() - started_at > configs.timeouts.MESSAGING_TIMEOUT_SEC: raise LookupError(f'Member not found') + return member @allure.step('Kick community member') def kick_member(self, member_name: str): - time.sleep(3) member = self.get_member_object(member_name) QObject(real_name=driver.objectMap.realName(member)).hover() self._kick_member_button.click() diff --git a/tests/communities/test_communities.py b/tests/communities/test_communities.py index 2e9c4ec..bdc3516 100644 --- a/tests/communities/test_communities.py +++ b/tests/communities/test_communities.py @@ -201,7 +201,7 @@ def test_community_admin_kick_member_and_delete_message(multiple_instances): assert community_params['intro'] == welcome_popup.intro welcome_popup.join().authenticate(user_one.password) assert driver.waitFor(lambda: not community_screen.left_panel.is_join_community_visible, - configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Join community button not hidden' + 8000), 'Join community button not hidden' messages_screen = MessagesScreen() message_text = "Hi" messages_screen.group_chat.send_message_to_group_chat(message_text) diff --git a/tests/online_identifier/test_online_identifier.py b/tests/online_identifier/test_online_identifier.py index 2eaf6a5..926496a 100644 --- a/tests/online_identifier/test_online_identifier.py +++ b/tests/online_identifier/test_online_identifier.py @@ -102,7 +102,7 @@ def test_switch_state_to_offline_online_automatic(multiple_instances): assert community_params['intro'] == welcome_popup.intro welcome_popup.join().authenticate(user_one.password) assert driver.waitFor(lambda: not community_screen.left_panel.is_join_community_visible, - configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Join community button not hidden' + 8000), 'Join community button not hidden' main_screen.hide() with step(f'User {user_two.name}, switch state to offline'):