From fba46c09c637913f578ab4f4778e84233c0e747d Mon Sep 17 00:00:00 2001 From: Anastasiya Semenkevich Date: Thu, 28 Mar 2024 16:38:15 +0300 Subject: [PATCH] chore: fix get chats list method (maybe) --- gui/screens/messages.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gui/screens/messages.py b/gui/screens/messages.py index 0afe166..5ca1e17 100644 --- a/gui/screens/messages.py +++ b/gui/screens/messages.py @@ -41,15 +41,15 @@ class LeftPanel(QObject): @allure.step('Open chat') def get_chats_list(self): + started_at = time.monotonic() chats_list = [] - for obj in driver.findAllObjects(self._chat_list_item.real_name): - chats_list.append(str(obj.name)) - - if len(chats_list) == 0: - raise LookupError( - 'Chats list is empty') - else: - return chats_list + while True: + for obj in driver.findAllObjects(self._chat_list_item.real_name): + chats_list.append(str(obj.name)) + if time.monotonic() - started_at > 10 and len(chats_list) == 0: + raise LookupError('Chats list is empty') + else: + return chats_list @allure.step('Click chat item') def click_chat_by_name(self, chat_name: str):