сhore: attempt to fix endless waiting time in category and accounts tests

This commit is contained in:
Anastasiya Semenkevich 2024-03-22 15:01:38 +03:00 committed by Anastasiya
parent 7482a8f8d9
commit 31b895f1d0
8 changed files with 24 additions and 27 deletions

View File

@ -66,3 +66,4 @@ class WalletTransactions(Enum):
class WalletScreensHeaders(Enum):
WALLET_ADD_ACCOUNT_POPUP_TITLE = 'Add a new account'
WALLET_EDIT_ACCOUNT_POPUP_TITLE = 'Edit account'

View File

@ -29,7 +29,6 @@ class NewChannelPopup(ChannelPopup):
self._emoji_button.click()
EmojiPopup().wait_until_appears().select(emoji)
self._save_create_button.click()
self.wait_until_hidden()
class EditChannelPopup(ChannelPopup):

View File

@ -47,7 +47,7 @@ class AccountPopup(BasePopup):
self._address_combobox_button = Button(names.mainWallet_AddEditAccountPopup_GeneratedAddressComponent)
self._non_eth_checkbox = CheckBox(names.mainWallet_AddEditAccountPopup_NonEthDerivationPathCheckBox)
def verify_account_popup_present(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
def verify_add_account_popup_present(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
driver.waitFor(lambda: self._popup_header_title.exists, timeout_msec)
assert (getattr(self._popup_header_title.object, 'text')
== WalletScreensHeaders.WALLET_ADD_ACCOUNT_POPUP_TITLE.value), \
@ -55,6 +55,14 @@ class AccountPopup(BasePopup):
current screen title is {getattr(self._popup_header_title.object, 'text')}"
return self
def verify_edit_account_popup_present(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
driver.waitFor(lambda: self._popup_header_title.exists, timeout_msec)
assert (getattr(self._popup_header_title.object, 'text')
== WalletScreensHeaders.WALLET_EDIT_ACCOUNT_POPUP_TITLE.value), \
f"AccountPopup is not shown or has wrong title, \
current screen title is {getattr(self._popup_header_title.object, 'text')}"
return self
@allure.step('Set name for account')
def set_name(self, value: str):
self._name_text_edit.text = value

View File

@ -268,20 +268,14 @@ class LeftPanel(QObject):
return CommunitySettingsScreen().wait_until_appears()
@allure.step('Open create channel popup')
def open_create_channel_popup(self, attempt: int = 2) -> NewChannelPopup:
try:
self._channel_or_category_button.click()
self._create_channel_menu_item.click()
return NewChannelPopup().wait_until_appears()
except LookupError as er:
if attempt:
self.open_create_channel_popup(attempt - 1)
else:
raise er
def open_create_channel_popup(self) -> NewChannelPopup:
self._channel_or_category_button.click()
self._create_channel_menu_item.click()
return NewChannelPopup()
@allure.step('Get visibility state of create channel or category button')
def is_create_channel_or_category_button_visible(self) -> bool:
return self._channel_or_category_button.is_visible
@allure.step('Get presence state of create channel or category button')
def does_create_channel_or_category_button_exist(self) -> bool:
return self._channel_or_category_button.exists
@allure.step('Get visibility state of add channels button')
def is_add_channels_button_visible(self) -> bool:

View File

@ -41,7 +41,7 @@ class WalletSettingsView(QObject):
def open_add_account_pop_up(self, attempts: int = 2) -> 'AccountPopup':
self._wallet_settings_add_new_account_button.click()
try:
return AccountPopup().verify_account_popup_present()
return AccountPopup().verify_add_account_popup_present()
except Exception as ex:
if attempts:
return self.open_add_account_pop_up(attempts - 1)

View File

@ -98,15 +98,10 @@ class LeftPanel(QObject):
self._open_context_menu_for_account(account_name).select_hide_include_total_balance_from_context_menu()
@allure.step('Open account popup for editing from context menu')
def open_edit_account_popup_from_context_menu(self, account_name: str, attempt: int = 2) -> AccountPopup:
try:
self._open_context_menu_for_account(account_name).select_edit_account_from_context_menu()
return AccountPopup().wait_until_appears()
except Exception as ex:
if attempt:
return self.open_edit_account_popup_from_context_menu(account_name, attempt - 1)
else:
raise ex
def open_edit_account_popup_from_context_menu(self, account_name: str) -> AccountPopup:
self._open_context_menu_for_account(account_name).select_edit_account_from_context_menu()
return AccountPopup().verify_edit_account_popup_present()
@allure.step('Open account popup')
def open_add_account_popup(self, attempt: int = 2):

View File

@ -89,7 +89,7 @@ def test_member_role_cannot_add_edit_or_delete_category(main_screen: MainWindow)
with step('Verify that member cannot add category'):
with step('Verify that create channel or category button is not present'):
assert not community_screen.left_panel.is_create_channel_or_category_button_visible()
assert not community_screen.left_panel.does_create_channel_or_category_button_exist()
with step('Verify that add category button is not present'):
assert not community_screen.left_panel.is_add_category_button_visible()

View File

@ -81,7 +81,7 @@ def test_member_role_cannot_add_edit_and_delete_channels(main_screen: MainWindow
community_screen = main_screen.left_panel.select_community('Super community')
with step('Verify that member cannot add new channel'):
with step('Verify that create channel or category button is not present'):
assert not community_screen.left_panel.is_create_channel_or_category_button_visible()
assert not community_screen.left_panel.does_create_channel_or_category_button_exist()
with step('Verify that add channel button is not present'):
assert not community_screen.left_panel.is_add_channels_button_visible()
with step('Right-click a channel on the left navigation bar'):