chore: refactored method of getting chat names
This commit is contained in:
parent
70d82ee124
commit
a78381bf9e
|
@ -33,11 +33,16 @@ class LeftPanel(QObject):
|
||||||
self._scroll = Scroll(messaging_names.scrollView_Flickable)
|
self._scroll = Scroll(messaging_names.scrollView_Flickable)
|
||||||
self._chats_list = List(messaging_names.chatList_ListView)
|
self._chats_list = List(messaging_names.chatList_ListView)
|
||||||
self._chat_list_item = QObject(messaging_names.scrollView_StatusChatListItem)
|
self._chat_list_item = QObject(messaging_names.scrollView_StatusChatListItem)
|
||||||
|
self._chats_scroll = QObject(messaging_names.mainWindow_scrollView_StatusScrollView)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@allure.step('Get chats by chats list')
|
@allure.step('Get chats by chats list')
|
||||||
def get_chats_names(self) -> typing.List[str]:
|
def get_chats_names(self) -> typing.List[str]:
|
||||||
return self._chats_list.get_values('objectName')
|
chats_list = []
|
||||||
|
for child in walk_children(driver.waitForObjectExists(self._chats_list.real_name)):
|
||||||
|
if getattr(child, 'id', '') == 'statusChatListItem':
|
||||||
|
chats_list.append(str(child.objectName))
|
||||||
|
return chats_list
|
||||||
|
|
||||||
@allure.step('Click chat item')
|
@allure.step('Click chat item')
|
||||||
def click_chat_by_name(self, chat_name: str):
|
def click_chat_by_name(self, chat_name: str):
|
||||||
|
|
|
@ -100,12 +100,14 @@ def test_group_chat(multiple_instances, user_data_one, user_data_two, user_data_
|
||||||
aut_two.attach()
|
aut_two.attach()
|
||||||
main_window.prepare()
|
main_window.prepare()
|
||||||
assert driver.waitFor(lambda: group_chat_new_name in messages_screen.left_panel.get_chats_names,
|
assert driver.waitFor(lambda: group_chat_new_name in messages_screen.left_panel.get_chats_names,
|
||||||
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'{group_chat_new_name} is not present in chats list for {aut_two}'
|
10000), f'{group_chat_new_name} is not present in chats list for {aut_two}'
|
||||||
messages_screen.left_panel.click_chat_by_name(group_chat_new_name)
|
messages_screen.left_panel.click_chat_by_name(group_chat_new_name)
|
||||||
|
|
||||||
with step('Verify members in a group members list'):
|
with step('Verify members in a group members list'):
|
||||||
assert user_one.name in messages_screen.right_panel.members
|
assert driver.waitFor(lambda: user_one.name in messages_screen.right_panel.members,
|
||||||
assert user_two.name in messages_screen.right_panel.members
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
|
||||||
|
assert driver.waitFor(lambda: user_two.name in messages_screen.right_panel.members,
|
||||||
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
|
||||||
assert driver.waitFor(lambda: user_three.name not in messages_screen.right_panel.members,
|
assert driver.waitFor(lambda: user_three.name not in messages_screen.right_panel.members,
|
||||||
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
|
||||||
assert len(messages_screen.right_panel.members) == 2
|
assert len(messages_screen.right_panel.members) == 2
|
||||||
|
@ -123,7 +125,8 @@ def test_group_chat(multiple_instances, user_data_one, user_data_two, user_data_
|
||||||
messages_screen.left_panel.open_leave_group_popup(group_chat_new_name).confirm_leaving()
|
messages_screen.left_panel.open_leave_group_popup(group_chat_new_name).confirm_leaving()
|
||||||
|
|
||||||
with step('Check that group name is not displayed on left panel'):
|
with step('Check that group name is not displayed on left panel'):
|
||||||
assert group_chat_new_name not in messages_screen.left_panel.get_chats_names
|
assert driver.waitFor(lambda: group_chat_new_name not in messages_screen.left_panel.get_chats_names,
|
||||||
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
|
||||||
main_window.hide()
|
main_window.hide()
|
||||||
|
|
||||||
with step(f'Check group members and message for {user_three.name}'):
|
with step(f'Check group members and message for {user_three.name}'):
|
||||||
|
|
Loading…
Reference in New Issue