Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.

Commit 75e2117

Browse files
committed
chore: fix get chats list method (maybe)
1 parent b1ef47b commit 75e2117

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

gui/screens/messages.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ def chats(self) -> typing.List[str]:
4141

4242
@allure.step('Open chat')
4343
def get_chats_list(self):
44+
started_at = time.monotonic()
4445
chats_list = []
45-
for obj in driver.findAllObjects(self._chat_list_item.real_name):
46-
chats_list.append(str(obj.name))
47-
48-
if len(chats_list) == 0:
49-
raise LookupError(
50-
'Chats list is empty')
51-
else:
52-
return chats_list
46+
while True:
47+
for obj in driver.findAllObjects(self._chat_list_item.real_name):
48+
chats_list.append(str(obj.name))
49+
if time.monotonic() - started_at > 10 and len(chats_list) == 0:
50+
raise LookupError('Chats list is empty')
51+
else:
52+
return chats_list
5353

5454
@allure.step('Click chat item')
5555
def click_chat_by_name(self, chat_name: str):

0 commit comments

Comments
 (0)