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 9ac2187eaa
commit 146a337c4e
5 changed files with 22 additions and 10 deletions

View File

@ -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):

View File

@ -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')

View File

@ -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()

View File

@ -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)

View File

@ -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'):