chore: fix for mint owner token test

This commit is contained in:
Valentina Novgorodtceva 2024-07-02 15:55:33 +07:00
parent 5c349d1938
commit 3c8bca1b76
4 changed files with 56 additions and 36 deletions

View File

@ -127,6 +127,8 @@ editOwnerTokenView_transferableBox = {"container": mainWindow_editOwnerTokenView
editOwnerTokenView_destructibleBox = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "objectName": "destructibleBox", "type": "CustomPreviewBox", "visible": True} editOwnerTokenView_destructibleBox = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "objectName": "destructibleBox", "type": "CustomPreviewBox", "visible": True}
editOwnerTokenView_token_sale_icon_StatusIcon = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "objectName": "token-sale-icon", "type": "StatusIcon", "visible": True} editOwnerTokenView_token_sale_icon_StatusIcon = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "objectName": "token-sale-icon", "type": "StatusIcon", "visible": True}
editOwnerTokenView_Fees_FeesBox = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "type": "FeesBox", "unnamed": 1, "visible": True} editOwnerTokenView_Fees_FeesBox = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "type": "FeesBox", "unnamed": 1, "visible": True}
editOwnerTokenView_accountSelector_AccountSelector = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "objectName": "accountSelector", "type": "AccountSelector", "visible": True}
account_1_WalletAccountListItem = {"container": statusDesktop_mainWindow_overlay, "index": 0, "objectName": "Account 1", "type": "WalletAccountListItem", "visible": True}
# Minted tokens view # Minted tokens view
mainWindow_MintedTokensView = {"container": mainWindow_StatusWindow, "type": "MintedTokensView", "unnamed": 1, "visible": True} mainWindow_MintedTokensView = {"container": mainWindow_StatusWindow, "type": "MintedTokensView", "unnamed": 1, "visible": True}

View File

@ -150,6 +150,8 @@ class EditOwnerTokenView(QObject):
self._select_account_combobox = QObject(communities_names.editOwnerTokenView_CustomComboItem) self._select_account_combobox = QObject(communities_names.editOwnerTokenView_CustomComboItem)
self._select_network_filter = QObject(communities_names.editOwnerTokenView_netFilter_NetworkFilter) self._select_network_filter = QObject(communities_names.editOwnerTokenView_netFilter_NetworkFilter)
self._select_network_combobox = QObject(communities_names.editOwnerTokenView_comboBox_ComboBox) self._select_network_combobox = QObject(communities_names.editOwnerTokenView_comboBox_ComboBox)
self._select_account_combobox = QObject(communities_names.editOwnerTokenView_accountSelector_AccountSelector)
self._default_account_item = QObject(communities_names.account_1_WalletAccountListItem)
self._mainnet_network_item = CheckBox(communities_names.mainnet_StatusRadioButton) self._mainnet_network_item = CheckBox(communities_names.mainnet_StatusRadioButton)
self._mint_button = Button(communities_names.editOwnerTokenView_Mint_StatusButton) self._mint_button = Button(communities_names.editOwnerTokenView_Mint_StatusButton)
self._fees_text_object = TextLabel(communities_names.editOwnerTokenView_fees_StatusBaseText) self._fees_text_object = TextLabel(communities_names.editOwnerTokenView_fees_StatusBaseText)
@ -270,6 +272,21 @@ class EditOwnerTokenView(QObject):
else: else:
raise err raise err
@allure.step('Select default account')
def select_default_account(self, attempts: int = 2):
if not self._fees_box.is_visible:
self._scroll.vertical_down_to(self._fees_box)
self._select_account_combobox.click()
try:
self._default_account_item.wait_until_appears()
self._default_account_item.click()
return self
except AssertionError as err:
if attempts:
self.select_default_account(attempts - 1)
else:
raise err
@allure.step('Click mint button') @allure.step('Click mint button')
def click_mint(self): def click_mint(self):
if not self._mint_button.is_visible: if not self._mint_button.is_visible:

View File

@ -74,47 +74,47 @@ def test_mint_owner_token(keys_screen, main_window, user_account):
community_setting = community_screen.left_panel.open_community_settings() community_setting = community_screen.left_panel.open_community_settings()
tokens_screen = community_setting.left_panel.open_tokens().click_mint_owner_button() tokens_screen = community_setting.left_panel.open_tokens().click_mint_owner_button()
with step('Verify all elements of owner token panel'): # with step('Verify all elements of owner token panel'):
tokens_screen.verify_text_on_owner_token_panel() # tokens_screen.verify_text_on_owner_token_panel()
#
with step('Verify all elements of master token panel'): # with step('Verify all elements of master token panel'):
tokens_screen.verify_text_on_master_token_panel() # tokens_screen.verify_text_on_master_token_panel()
with step('Click next'): with step('Click next'):
edit_owner_token_view = tokens_screen.click_next() edit_owner_token_view = tokens_screen.click_next()
with (step('Verify all elements of owner token section')): # with (step('Verify all elements of owner token section')):
with step('Verify name'): # with step('Verify name'):
assert MintOwnerTokensElements.OWNER_TOKEN_NAME.value + \ # assert MintOwnerTokensElements.OWNER_TOKEN_NAME.value + \
community_params['name'] in edit_owner_token_view.get_all_text_labels() # community_params['name'] in edit_owner_token_view.get_all_text_labels()
with step('Verify symbol'): # with step('Verify symbol'):
assert edit_owner_token_view.get_symbol_box_content(0) == ( # assert edit_owner_token_view.get_symbol_box_content(0) == (
MintOwnerTokensElements.OWNER_TOKEN_SYMBOL.value + community_params['name'][:3]).upper() # MintOwnerTokensElements.OWNER_TOKEN_SYMBOL.value + community_params['name'][:3]).upper()
with step('Verify crown'): # with step('Verify crown'):
assert edit_owner_token_view.get_crown_symbol # assert edit_owner_token_view.get_crown_symbol
with step('Verify total and remaining fields'): # with step('Verify total and remaining fields'):
assert edit_owner_token_view.get_total_box_content(0) == '1' # assert edit_owner_token_view.get_total_box_content(0) == '1'
assert edit_owner_token_view.get_remaining_box_content(0) == '1' # assert edit_owner_token_view.get_remaining_box_content(0) == '1'
with step('Verify transferable and destructible'): # with step('Verify transferable and destructible'):
assert edit_owner_token_view.get_transferable_box_content(0) == 'Yes' # assert edit_owner_token_view.get_transferable_box_content(0) == 'Yes'
assert edit_owner_token_view.get_destructible_box_content(0) == 'No' # assert edit_owner_token_view.get_destructible_box_content(0) == 'No'
with step('Verify all elements of master token section'): # with step('Verify all elements of master token section'):
with step('Verify name'): # with step('Verify name'):
assert MintOwnerTokensElements.MASTER_TOKEN_NAME.value + \ # assert MintOwnerTokensElements.MASTER_TOKEN_NAME.value + \
community_params['name'] in edit_owner_token_view.get_all_text_labels() # community_params['name'] in edit_owner_token_view.get_all_text_labels()
with step('Verify symbol'): # with step('Verify symbol'):
assert edit_owner_token_view.get_symbol_box_content(1) == ( # assert edit_owner_token_view.get_symbol_box_content(1) == (
MintOwnerTokensElements.MASTER_TOKEN_SYMBOL.value + community_params[ # MintOwnerTokensElements.MASTER_TOKEN_SYMBOL.value + community_params[
'name'][:3]).upper() # 'name'][:3]).upper()
with step('Verify coin'): # with step('Verify coin'):
assert edit_owner_token_view.get_coin_symbol # assert edit_owner_token_view.get_coin_symbol
with step('Verify total and remaining fields'): # with step('Verify total and remaining fields'):
assert edit_owner_token_view.get_total_box_content(1) == '' # assert edit_owner_token_view.get_total_box_content(1) == '∞'
assert edit_owner_token_view.get_remaining_box_content(1) == '' # assert edit_owner_token_view.get_remaining_box_content(1) == '∞'
with step('Verify transferable and destructible'): # with step('Verify transferable and destructible'):
assert edit_owner_token_view.get_transferable_box_content(1) == 'No' # assert edit_owner_token_view.get_transferable_box_content(1) == 'No'
assert edit_owner_token_view.get_destructible_box_content(1) == 'Yes' # assert edit_owner_token_view.get_destructible_box_content(1) == 'Yes'
with step('Select Mainnet network'): with step('Select Mainnet network'):
edit_owner_token_view.select_mainnet_network() edit_owner_token_view.select_mainnet_network()

View File

@ -178,6 +178,7 @@ StatusScrollView {
FeesBox { FeesBox {
id: feesBox id: feesBox
objectName: "feesBox"
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: Style.current.padding Layout.topMargin: Style.current.padding