chore: use L2 networks for minting community tokens

This commit is contained in:
Anastasiya Semenkevich 2024-09-06 13:44:49 +03:00 committed by Anastasiya
parent fdefaf5a54
commit 43dff60e79
5 changed files with 40 additions and 74 deletions

View File

@ -30,7 +30,7 @@ class MintOwnerTokensElements(Enum):
MASTER_TOKEN_CHEKLIST_ELEMENT_3 = 'Ability to mint and airdrop Community tokens'
MASTER_TOKEN_CHEKLIST_ELEMENT_4 = 'Non-transferrable'
MASTER_TOKEN_CHEKLIST_ELEMENT_5 = 'Remotely destructible by the Owner token hodler'
SIGN_TRANSACTION_MINT_TITLE = ' Owner and TokenMaster tokens on Mainnet'
SIGN_TRANSACTION_MINT_TITLE = ' Owner and TokenMaster tokens on '
OWNER_TOKEN_NAME = 'Owner-'
MASTER_TOKEN_NAME = 'TMaster-'
OWNER_TOKEN_SYMBOL = 'OWN'

View File

@ -1,4 +1,5 @@
from gui.objects_map.names import statusDesktop_mainWindow, statusDesktop_mainWindow_overlay, mainWindow_StatusWindow
from objectmaphelper import *
# Map for communities screens, views locators
@ -115,6 +116,7 @@ arbitrum_NetworkSelectItemDelegate = {"container": statusDesktop_mainWindow_over
optimism_StatusRadioButton = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "objectName": "networkSelectionRadioButton_Optimism", "type": "StatusRadioButton", "visible": True}
mainnet_StatusRadioButton = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "objectName": "networkSelectionRadioButton_Mainnet", "type": "StatusRadioButton", "visible": True}
arbitrum_StatusRadioButton = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "objectName": "networkSelectionRadioButton_Arbitrum", "type": "StatusRadioButton", "visible": True}
networkItem_StatusRadioButton = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("networkSelectionRadioButton*"), "type": "StatusRadioButton", "visible": True}
editOwnerTokenView_Mint_StatusButton = {"checkable": False, "container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "objectName": "mintButton", "type": "StatusButton", "visible": True}
editOwnerTokenView_FeeRow = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "type": "FeeRow", "unnamed": 1, "visible": True}

View File

@ -103,27 +103,27 @@ class TokensOwnerTokenSettingsView(QObject):
@allure.step('Verify text on owner token panel')
def verify_text_on_owner_token_panel(self):
assert str(self.get_text_labels_from_owner_token_panel[
1].text) == MintOwnerTokensElements.OWNER_TOKEN_CHEKLIST_ELEMENT_1.value, f'Actual text is {self.get_text_labels_from_owner_token_panel[2].text}'
assert str(self.get_text_labels_from_owner_token_panel[
2].text) == MintOwnerTokensElements.OWNER_TOKEN_CHEKLIST_ELEMENT_2.value, f'Actual text is {self.get_text_labels_from_owner_token_panel[3].text}'
assert str(self.get_text_labels_from_owner_token_panel[
3].text) == MintOwnerTokensElements.OWNER_TOKEN_CHEKLIST_ELEMENT_3.value, f'Actual text is {self.get_text_labels_from_owner_token_panel[4].text}'
assert str(self.get_text_labels_from_owner_token_panel[
4].text) == MintOwnerTokensElements.OWNER_TOKEN_CHEKLIST_ELEMENT_4.value, f'Actual text is {self.get_text_labels_from_owner_token_panel[5].text}'
assert str(self.get_text_labels_from_owner_token_panel[2].text) \
== MintOwnerTokensElements.OWNER_TOKEN_CHEKLIST_ELEMENT_1.value, f'Actual text is {self.get_text_labels_from_owner_token_panel[2].text}'
assert str(self.get_text_labels_from_owner_token_panel[3].text) \
== MintOwnerTokensElements.OWNER_TOKEN_CHEKLIST_ELEMENT_2.value, f'Actual text is {self.get_text_labels_from_owner_token_panel[3].text}'
assert str(self.get_text_labels_from_owner_token_panel[4].text) \
== MintOwnerTokensElements.OWNER_TOKEN_CHEKLIST_ELEMENT_3.value, f'Actual text is {self.get_text_labels_from_owner_token_panel[4].text}'
assert str(self.get_text_labels_from_owner_token_panel[5].text) \
== MintOwnerTokensElements.OWNER_TOKEN_CHEKLIST_ELEMENT_4.value, f'Actual text is {self.get_text_labels_from_owner_token_panel[5].text}'
@allure.step('Verify text on master token panel')
def verify_text_on_master_token_panel(self):
assert str(self.get_text_labels_from_master_token_panel[
1].text) == MintOwnerTokensElements.MASTER_TOKEN_CHEKLIST_ELEMENT_1.value, f'Actual text is {self.get_text_labels_from_master_token_panel[1].text}'
3].text) == MintOwnerTokensElements.MASTER_TOKEN_CHEKLIST_ELEMENT_1.value, f'Actual text is {self.get_text_labels_from_master_token_panel[3].text}'
assert str(self.get_text_labels_from_master_token_panel[
2].text) == MintOwnerTokensElements.MASTER_TOKEN_CHEKLIST_ELEMENT_2.value, f'Actual text is {self.get_text_labels_from_master_token_panel[2].text}'
4].text) == MintOwnerTokensElements.MASTER_TOKEN_CHEKLIST_ELEMENT_2.value, f'Actual text is {self.get_text_labels_from_master_token_panel[4].text}'
assert str(self.get_text_labels_from_master_token_panel[
3].text) == MintOwnerTokensElements.MASTER_TOKEN_CHEKLIST_ELEMENT_3.value, f'Actual text is {self.get_text_labels_from_master_token_panel[3].text}'
5].text) == MintOwnerTokensElements.MASTER_TOKEN_CHEKLIST_ELEMENT_3.value, f'Actual text is {self.get_text_labels_from_master_token_panel[5].text}'
assert str(self.get_text_labels_from_master_token_panel[
4].text) == MintOwnerTokensElements.MASTER_TOKEN_CHEKLIST_ELEMENT_4.value, f'Actual text is {self.get_text_labels_from_master_token_panel[4].text}'
6].text) == MintOwnerTokensElements.MASTER_TOKEN_CHEKLIST_ELEMENT_4.value, f'Actual text is {self.get_text_labels_from_master_token_panel[6].text}'
assert str(self.get_text_labels_from_master_token_panel[
5].text) == MintOwnerTokensElements.MASTER_TOKEN_CHEKLIST_ELEMENT_5.value, f'Actual text is {self.get_text_labels_from_master_token_panel[5].text}'
7].text) == MintOwnerTokensElements.MASTER_TOKEN_CHEKLIST_ELEMENT_5.value, f'Actual text is {self.get_text_labels_from_master_token_panel[5].text}'
@property
@allure.step('Get all text from master token panel')
@ -151,6 +151,9 @@ class EditOwnerTokenView(QObject):
self._select_network_filter = QObject(communities_names.editOwnerTokenView_netFilter_NetworkFilter)
self._select_network_combobox = QObject(communities_names.editOwnerTokenView_comboBox_ComboBox)
self._mainnet_network_item = CheckBox(communities_names.mainnet_StatusRadioButton)
self.optimism_network_item = CheckBox(communities_names.optimism_StatusRadioButton)
self.arbitrum_network_item = CheckBox(communities_names.arbitrum_StatusRadioButton)
self.network_item = CheckBox(communities_names.networkItem_StatusRadioButton)
self._mint_button = Button(communities_names.editOwnerTokenView_Mint_StatusButton)
self._fees_text_object = TextLabel(communities_names.editOwnerTokenView_fees_StatusBaseText)
self._crown_icon = QObject(communities_names.editOwnerTokenView_crown_icon_StatusIcon)
@ -255,20 +258,17 @@ class EditOwnerTokenView(QObject):
destructible_box = self.get_destructible_boxes()[index]
return str(destructible_box.value)
@allure.step('Select Mainnet network')
def select_mainnet_network(self, attempts: int = 2):
def select_network(self, network_name):
if not self._fees_box.is_visible:
self._scroll.vertical_scroll_down(self._fees_box)
self._select_network_filter.click()
try:
self._mainnet_network_item.wait_until_appears()
self._mainnet_network_item.click()
network_options = driver.findAllObjects(self.network_item.real_name)
assert network_options, f'Network options are not displayed'
for item in network_options:
if str(getattr(item, 'objectName', '')).endswith(network_name):
QObject(item).click()
break
return self
except AssertionError as err:
if attempts:
self.select_mainnet_network(attempts - 1)
else:
raise err
@allure.step('Click mint button')
def click_mint(self):

View File

@ -102,7 +102,7 @@ class LeftPanel(QObject):
@allure.step('Open advanced settings')
@handle_settings_opening(AdvancedSettingsView, '10-SettingsMenuItem')
def open_advanced_settings(self, click_attempts: int = 2) -> 'AdvancedSettingsView':
assert AdvancedSettingsView().exists, 'Advanced settings view was not opened'
assert AdvancedSettingsView().wait_until_appears(), 'Advanced settings view was not opened'
return AdvancedSettingsView()

View File

@ -1,3 +1,4 @@
import random
import time
import allure
@ -31,7 +32,6 @@ def keys_screen(main_window) -> KeysView:
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/727245', 'Mint owner token')
@pytest.mark.case(727245)
@pytest.mark.transaction
@pytest.mark.skip('temp skip test to fix it using L2 networks')
def test_mint_owner_and_tokenmaster_tokens(keys_screen, main_window, user_account):
user_account = ReturningUser(
seed_phrase=WALLET_SEED.split(),
@ -67,6 +67,7 @@ def test_mint_owner_and_tokenmaster_tokens(keys_screen, main_window, user_accoun
wallet_settings.open_networks().switch_testnet_mode_toggle().turn_on_testnet_mode_in_testnet_modal()
with step('Switch manage community on testnet option'):
settings = main_window.left_panel.open_settings()
settings.left_panel.open_advanced_settings().switch_manage_on_community()
with step('Create simple community'):
@ -80,54 +81,17 @@ def test_mint_owner_and_tokenmaster_tokens(keys_screen, main_window, user_accoun
community_setting = community_screen.left_panel.open_community_settings()
tokens_screen = community_setting.left_panel.open_tokens().click_mint_owner_button()
with step('Verify all elements of owner token panel'):
tokens_screen.verify_text_on_owner_token_panel()
with step('Verify all elements of master token panel'):
tokens_screen.verify_text_on_master_token_panel()
with step('Click next'):
edit_owner_token_view = tokens_screen.click_next()
with (step('Verify all elements of owner token section')):
with step('Verify name'):
assert MintOwnerTokensElements.OWNER_TOKEN_NAME.value + \
community_params['name'] in edit_owner_token_view.get_all_text_labels()
with step('Verify symbol'):
assert edit_owner_token_view.get_symbol_box_content(0) == (
MintOwnerTokensElements.OWNER_TOKEN_SYMBOL.value + community_params['name'][:3]).upper()
with step('Verify crown'):
assert edit_owner_token_view.get_crown_symbol
with step('Verify total and remaining fields'):
assert edit_owner_token_view.get_total_box_content(0) == '1'
assert edit_owner_token_view.get_remaining_box_content(0) == '1'
with step('Verify transferable and destructible'):
assert edit_owner_token_view.get_transferable_box_content(0) == 'Yes'
assert edit_owner_token_view.get_destructible_box_content(0) == 'No'
with step('Verify all elements of master token section'):
with step('Verify name'):
assert MintOwnerTokensElements.MASTER_TOKEN_NAME.value + \
community_params['name'] in edit_owner_token_view.get_all_text_labels()
with step('Verify symbol'):
assert edit_owner_token_view.get_symbol_box_content(1) == (
MintOwnerTokensElements.MASTER_TOKEN_SYMBOL.value + community_params[
'name'][:3]).upper()
with step('Verify coin'):
assert edit_owner_token_view.get_coin_symbol
with step('Verify total and remaining fields'):
assert edit_owner_token_view.get_total_box_content(1) == ''
assert edit_owner_token_view.get_remaining_box_content(1) == ''
with step('Verify transferable and destructible'):
assert edit_owner_token_view.get_transferable_box_content(1) == 'No'
assert edit_owner_token_view.get_destructible_box_content(1) == 'Yes'
with step('Select Mainnet network'):
edit_owner_token_view.select_mainnet_network()
with step('Select network'):
network_name = random.choice(['Arbitrum', 'Optimism']) # no mainnet because of prices
edit_owner_token_view.select_network(network_name)
with step('Verify fees title and gas fees exist'):
assert driver.waitFor(lambda: edit_owner_token_view.get_fee_title == 'Mint ' + community_params[
'name'] + MintOwnerTokensElements.SIGN_TRANSACTION_MINT_TITLE.value, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
'name'] + MintOwnerTokensElements.SIGN_TRANSACTION_MINT_TITLE.value + network_name,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
assert driver.waitFor(lambda: edit_owner_token_view.get_fee_total_value != '',
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
@ -136,16 +100,12 @@ def test_mint_owner_and_tokenmaster_tokens(keys_screen, main_window, user_accoun
with step('Verify fee text and sign transaction'):
assert start_minting.get_fee_title == 'Mint ' + community_params[
'name'] + MintOwnerTokensElements.SIGN_TRANSACTION_MINT_TITLE.value
'name'] + MintOwnerTokensElements.SIGN_TRANSACTION_MINT_TITLE.value + network_name
assert start_minting.get_fee_total_value != ''
start_minting.sign_transaction(user_account.password)
time.sleep(1)
minted_tokens_view = MintedTokensView()
with step('Verify that status of both tokens is Minting'):
assert minted_tokens_view.get_owner_token_status == 'Minting...'
assert minted_tokens_view.get_master_token_status == 'Minting...'
with step('Verify toast messages about started minting process appears'):
toast_messages = main_window.wait_for_notification()
assert driver.waitFor(lambda: (MintOwnerTokensElements.TOAST_AIRDROPPING_TOKEN_1.value + community_params[
@ -154,3 +114,7 @@ def test_mint_owner_and_tokenmaster_tokens(keys_screen, main_window, user_accoun
assert driver.waitFor(lambda: (community_params[
'name'] + MintOwnerTokensElements.TOAST_TOKENS_BEING_MINTED.value) in toast_messages,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
with step('Verify that status of both tokens'):
assert driver.waitFor(lambda: (minted_tokens_view.get_owner_token_status == '1 of 1 (you hodl)'), 15000)
assert driver.waitFor(lambda: (minted_tokens_view.get_master_token_status == ''), 15000)