chore: raise exceptions when needed

This commit is contained in:
Anastasiya Semenkevich 2023-12-19 16:12:24 +03:00 committed by Anastasiya
parent a75d09fc5d
commit 767f388b57
4 changed files with 9 additions and 9 deletions

View File

@ -76,12 +76,12 @@ class CreateCommunityPopup(BasePopup):
self._add_logo_button.click() self._add_logo_button.click()
try: try:
return OpenFileDialog().wait_until_appears() return OpenFileDialog().wait_until_appears()
except LookupError as err: except Exception as err:
if attempt: if attempt:
LOG.debug(err) LOG.debug(err)
return self._open_logo_file_dialog(attempt - 1) return self._open_logo_file_dialog(attempt - 1)
else: else:
raise raise err
@logo.setter @logo.setter
@allure.step('Set community logo') @allure.step('Set community logo')

View File

@ -57,11 +57,11 @@ class LeftPanel(QObject):
try: try:
self._open_context_menu_for_chat(chat_name).select('Leave group') self._open_context_menu_for_chat(chat_name).select('Leave group')
return LeaveGroupPopup().wait_until_appears() return LeaveGroupPopup().wait_until_appears()
except: except Exception as ex:
if attempt: if attempt:
return self.open_leave_group_popup(chat_name, attempt - 1) return self.open_leave_group_popup(chat_name, attempt - 1)
else: else:
raise raise ex
class ToolBar(QObject): class ToolBar(QObject):

View File

@ -80,7 +80,7 @@ class ContactItem:
self._open_canvas_button.click(attempt - 1) self._open_canvas_button.click(attempt - 1)
return self return self
else: else:
raise f"Popup didn't appear" raise LookupError(f"Popup didn't appear")
class ContactsSettingsView(QObject): class ContactsSettingsView(QObject):

View File

@ -101,11 +101,11 @@ class LeftPanel(QObject):
try: try:
self._open_context_menu_for_account(account_name).select_edit_account_from_context_menu() self._open_context_menu_for_account(account_name).select_edit_account_from_context_menu()
return AccountPopup().wait_until_appears() return AccountPopup().wait_until_appears()
except: except Exception as ex:
if attempt: if attempt:
return self.open_edit_account_popup_from_context_menu(account_name, attempt - 1) return self.open_edit_account_popup_from_context_menu(account_name, attempt - 1)
else: else:
raise raise ex
@allure.step('Open account popup') @allure.step('Open account popup')
def open_add_account_popup(self, attempt: int = 2): def open_add_account_popup(self, attempt: int = 2):
@ -128,11 +128,11 @@ class LeftPanel(QObject):
try: try:
self._open_context_menu_for_account(account_name).select_delete_account_from_context_menu() self._open_context_menu_for_account(account_name).select_delete_account_from_context_menu()
return RemoveWalletAccountPopup().wait_until_appears() return RemoveWalletAccountPopup().wait_until_appears()
except: except Exception as ex:
if attempt: if attempt:
return self.delete_account_from_context_menu(account_name, attempt - 1) return self.delete_account_from_context_menu(account_name, attempt - 1)
else: else:
raise raise ex
class SavedAddressesView(QObject): class SavedAddressesView(QObject):