chore: fixed community admin kik member and also changed timeouts in several places

This commit is contained in:
Valentina Novgorodtceva 2024-04-10 16:15:37 +07:00 committed by Anastasiya
parent 5f7ac07157
commit 3b5f0d792a
5 changed files with 22 additions and 10 deletions

View File

@ -26,7 +26,7 @@ class AuthenticatePopup(BasePopup):
def authenticate(self, password: str): def authenticate(self, password: str):
self._password_text_edit.type_text(password) self._password_text_edit.type_text(password)
self._authenticate_button.click() 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') @allure.step('Close authenticate popup by close button')
def close_authenticate_popup(self): def close_authenticate_popup(self):

View File

@ -228,7 +228,7 @@ class LeftPanel(QObject):
@property @property
@allure.step('Get Join button visible attribute') @allure.step('Get Join button visible attribute')
def is_join_community_visible(self) -> bool: def is_join_community_visible(self) -> bool:
return self._join_community_button.is_visible return self._join_community_button.exists
@property @property
@allure.step('Get channels') @allure.step('Get channels')

View File

@ -3,6 +3,7 @@ import typing
import allure import allure
import configs
import driver import driver
from driver.objects_access import walk_children from driver.objects_access import walk_children
from gui.components.community.color_select_popup import ColorSelectPopup from gui.components.community.color_select_popup import ColorSelectPopup
@ -268,17 +269,28 @@ class MembersView(QObject):
def members(self) -> typing.List[str]: def members(self) -> typing.List[str]:
return [str(member.title) for member in driver.findAllObjects(self._member_list_item.real_name)] return [str(member.title) for member in driver.findAllObjects(self._member_list_item.real_name)]
@allure.step('Get community member object') @allure.step('Get community member objects')
def get_member_object(self, member_name: str): def get_member_objects(self) -> typing.List:
member_objects = []
for item in driver.findAllObjects(self._member_list_item.real_name): for item in driver.findAllObjects(self._member_list_item.real_name):
if str(getattr(item, 'title', '')) == str(member_name): member_objects.append(item)
return item return member_objects
else:
@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') raise LookupError(f'Member not found')
return member
@allure.step('Kick community member') @allure.step('Kick community member')
def kick_member(self, member_name: str): def kick_member(self, member_name: str):
time.sleep(3)
member = self.get_member_object(member_name) member = self.get_member_object(member_name)
QObject(real_name=driver.objectMap.realName(member)).hover() QObject(real_name=driver.objectMap.realName(member)).hover()
self._kick_member_button.click() self._kick_member_button.click()

View File

@ -201,7 +201,7 @@ def test_community_admin_kick_member_and_delete_message(multiple_instances):
assert community_params['intro'] == welcome_popup.intro assert community_params['intro'] == welcome_popup.intro
welcome_popup.join().authenticate(user_one.password) welcome_popup.join().authenticate(user_one.password)
assert driver.waitFor(lambda: not community_screen.left_panel.is_join_community_visible, 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() messages_screen = MessagesScreen()
message_text = "Hi" message_text = "Hi"
messages_screen.group_chat.send_message_to_group_chat(message_text) messages_screen.group_chat.send_message_to_group_chat(message_text)

View File

@ -102,7 +102,7 @@ def test_switch_state_to_offline_online_automatic(multiple_instances):
assert community_params['intro'] == welcome_popup.intro assert community_params['intro'] == welcome_popup.intro
welcome_popup.join().authenticate(user_one.password) welcome_popup.join().authenticate(user_one.password)
assert driver.waitFor(lambda: not community_screen.left_panel.is_join_community_visible, 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() main_screen.hide()
with step(f'User {user_two.name}, switch state to offline'): with step(f'User {user_two.name}, switch state to offline'):