diff --git a/test/e2e/constants/community_settings.py b/test/e2e/constants/community_settings.py index 987f72e70a..22e2a6093d 100644 --- a/test/e2e/constants/community_settings.py +++ b/test/e2e/constants/community_settings.py @@ -19,6 +19,26 @@ class TokensElements(Enum): INFOBOX_TEXT = 'In order to Mint, Import and Airdrop community tokens, you first need to mint your Owner token which will give you permissions to access the token management features for your community.' +class MintOwnerTokensElements(Enum): + OWNER_TOKEN_CHEKLIST_ELEMENT_1 = 'Only 1 will ever exist' + OWNER_TOKEN_CHEKLIST_ELEMENT_2 = 'Hodler is the owner of the Community' + OWNER_TOKEN_CHEKLIST_ELEMENT_3 = 'Ability to airdrop / destroy TokenMaster token' + OWNER_TOKEN_CHEKLIST_ELEMENT_4 = 'Ability to mint and airdrop Community tokens' + MASTER_TOKEN_CHEKLIST_ELEMENT_1 = 'Unlimited supply' + MASTER_TOKEN_CHEKLIST_ELEMENT_2 = 'Grants full Community admin rights' + 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' + OWNER_TOKEN_NAME = 'Owner-' + MASTER_TOKEN_NAME = 'TMaster-' + OWNER_TOKEN_SYMBOL = 'OWN' + MASTER_TOKEN_SYMBOL = 'TM' + TOAST_AIRDROPPING_TOKEN_1 = 'Airdropping ' + TOAST_AIRDROPPING_TOKEN_2 = ' Owner token to you...' + TOAST_TOKENS_BEING_MINTED = ' Owner and TokenMaster tokens are being minted...' + + class AirdropsElements(Enum): WELCOME_TITLE = "Airdrop community tokens" WELCOME_SUBTITLE = 'You can mint custom tokens and collectibles for your community' diff --git a/test/e2e/gui/components/sign_transaction_popup.py b/test/e2e/gui/components/sign_transaction_popup.py new file mode 100644 index 0000000000..d4c32094b4 --- /dev/null +++ b/test/e2e/gui/components/sign_transaction_popup.py @@ -0,0 +1,42 @@ +import allure + +import configs +from gui.components.community.authenticate_popup import AuthenticatePopup +from gui.elements.button import Button +from gui.elements.object import QObject +from gui.objects_map import names + + +class SignTransactionPopup(QObject): + + def __init__(self): + super(SignTransactionPopup, self).__init__() + self._sign_transaction_button = Button(names.sign_transaction_StatusButton) + self._cancel_button = Button(names.cancel_transaction_StatusButton) + self._fee_row = QObject(names.o_FeeRow) + self._fee_total_row = QObject(names.feeTotalRow_FeeRow) + + @property + @allure.step('Get fee title') + def get_fee_title(self) -> str: + return str(self._fee_row.object.title) + + @property + @allure.step('Get fee total value') + def get_fee_total_value(self) -> str: + return str(self._fee_total_row.object.feeText) + + @allure.step('Wait until appears {0}') + def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + self._sign_transaction_button.wait_until_appears(timeout_msec) + return self + + @allure.step('Wait until hidden {0}') + def wait_until_hidden(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): + self._sign_transaction_button.wait_until_hidden() + + @allure.step('Sign transaction') + def sign_transaction(self, user_password): + self._sign_transaction_button.click() + self.wait_until_hidden() + AuthenticatePopup().wait_until_appears().authenticate(user_password) diff --git a/test/e2e/gui/objects_map/communities_names.py b/test/e2e/gui/objects_map/communities_names.py index d24b172208..5f5dc09360 100644 --- a/test/e2e/gui/objects_map/communities_names.py +++ b/test/e2e/gui/objects_map/communities_names.py @@ -89,6 +89,46 @@ checkListText_2_Tokens = {"container": mainWindow_MintedTokensView, "objectName" mint_Owner_Tokens_InfoBoxPanel = {"container": mainWindow_MintedTokensView, "type": "StatusInfoBoxPanel", "unnamed": 1, "visible": True} mint_Owner_Tokens_StatusButton = {"checkable": False, "container": mainWindow_MintedTokensView, "id": "button", "type": "StatusButton", "unnamed": 1, "visible": True} +# Owner Token settings view +mainWindow_ownerTokenPage_SettingsPage = {"container": mainWindow_StatusWindow, "id": "ownerTokenPage", "type": "SettingsPage", "unnamed": 1, "visible": True} +mainWindow_OwnerTokenWelcomeView = {"container": mainWindow_StatusWindow, "type": "OwnerTokenWelcomeView", "unnamed": 1, "visible": True} +ownerToken_InfoPanel = {"container": mainWindow_OwnerTokenWelcomeView, "type": "InfoPanel", "unnamed": 1, "visible": True} +tokenMasterToken_InfoPanel = {"container": mainWindow_OwnerTokenWelcomeView, "occurrence": 2, "type": "InfoPanel", "unnamed": 1, "visible": True} +next_StatusButton = {"checkable": False, "container": mainWindow_OwnerTokenWelcomeView, "type": "StatusButton", "unnamed": 1, "visible": True} +owner_token_StatusBaseText = {"container": ownerToken_InfoPanel, "type": "StatusBaseText", "unnamed": 1, "visible": True} +token_master_StatusBaseText = {"container": tokenMasterToken_InfoPanel, "type": "StatusBaseText", "unnamed": 1, "visible": True} +o_Flickable = {"container": mainWindow_OwnerTokenWelcomeView, "type": "Flickable", "unnamed": 1, "visible": True} + +# Edit owner token view +mainWindow_editOwnerTokenView_EditOwnerTokenView = {"container": mainWindow_StatusWindow, "id": "editOwnerTokenView", "type": "EditOwnerTokenView", "unnamed": 1, "visible": True} +editOwnerTokenView_Flickable = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "type": "Flickable", "unnamed": 1, "visible": True} +editOwnerTokenView_CustomComboItem = {"checkable": False, "container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "type": "CustomComboItem", "unnamed": 1, "visible": True} +editOwnerTokenView_comboBox_ComboBox = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "id": "comboBox", "occurrence": 2, "type": "ComboBox", "unnamed": 1, "visible": True} +mainnet_NetworkSelectItemDelegate = {"container": statusDesktop_mainWindow_overlay, "index": 0, "objectName": "Mainnet", "type": "NetworkSelectItemDelegate", "visible": True} +optimism_NetworkSelectItemDelegate = {"container": statusDesktop_mainWindow_overlay, "index": 1, "objectName": "Optimism", "type": "NetworkSelectItemDelegate", "visible": True} +arbitrum_NetworkSelectItemDelegate = {"container": statusDesktop_mainWindow_overlay, "index": 2, "objectName": "Arbitrum", "type": "NetworkSelectItemDelegate", "visible": True} +editOwnerTokenView_Mint_StatusButton = {"checkable": False, "container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "type": "StatusButton", "unnamed": 1, "visible": True} +editOwnerTokenView_FeeRow = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "type": "FeeRow", "unnamed": 1, "visible": True} +editOwnerTokenView_fees_StatusBaseText = {"container": editOwnerTokenView_FeeRow, "type": "StatusBaseText", "unnamed": 1, "visible": True} + +editOwnerTokenView_Owner_StatusBaseText = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "type": "StatusBaseText", "unnamed": 1, "visible": True} +editOwnerTokenView_crown_icon_StatusIcon = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "objectName": "crown-icon", "type": "StatusIcon", "visible": True} +editOwnerTokenView_symbolBox = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "objectName": "symbolBox", "type": "CustomPreviewBox", "visible": True} +editOwnerTokenView_totalBox = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "objectName": "totalBox", "type": "CustomPreviewBox", "visible": True} +editOwnerTokenView_remainingBox = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "objectName": "remainingBox", "type": "CustomPreviewBox", "visible": True} +editOwnerTokenView_transferableBox = {"container": mainWindow_editOwnerTokenView_EditOwnerTokenView, "objectName": "transferableBox", "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} + +# Minted tokens view +mainWindow_MintedTokensView = {"container": mainWindow_StatusWindow, "type": "MintedTokensView", "unnamed": 1, "visible": True} +specialCollectible_PrivilegedTokenArtworkPanel = {"container": mainWindow_MintedTokensView, "id": "specialCollectible", "type": "PrivilegedTokenArtworkPanel", "unnamed": 1, "visible": True} +specialCollectible_PrivilegedTokenArtworkPanel_2 = {"container": mainWindow_MintedTokensView, "id": "specialCollectible", "occurrence": 2, "type": "PrivilegedTokenArtworkPanel", "unnamed": 1, "visible": True} +o_CollectibleView_2 = {"container": mainWindow_MintedTokensView, "index": 1, "type": "CollectibleView", "unnamed": 1, "visible": True} +o_CollectibleView = {"container": mainWindow_MintedTokensView, "index": 0, "type": "CollectibleView", "unnamed": 1, "visible": True} +token_sale_icon_StatusIcon = {"container": mainWindow_MintedTokensView, "objectName": "token-sale-icon", "type": "StatusIcon", "visible": True} +crown_icon_StatusIcon = {"container": mainWindow_MintedTokensView, "objectName": "crown-icon", "type": "StatusIcon", "visible": True} + # Airdrops View mainWindow_airdropPanel_AirdropsSettingsPanel = {"container": mainWindow_StatusWindow, "id": "airdropPanel", "type": "AirdropsSettingsPanel", "unnamed": 1, "visible": True} mainWindow_WelcomeSettingsView = {"container": mainWindow_StatusWindow, "type": "WelcomeSettingsView", "unnamed": 1, "visible": True} diff --git a/test/e2e/gui/objects_map/names.py b/test/e2e/gui/objects_map/names.py index dddfbab6e9..46cb0a0749 100644 --- a/test/e2e/gui/objects_map/names.py +++ b/test/e2e/gui/objects_map/names.py @@ -192,6 +192,12 @@ selected_tags_text = {"container": statusDesktop_mainWindow_overlay, "type": "St # Signing phrase popup signPhrase_Ok_Button = {"container": statusDesktop_mainWindow, "type": "StatusFlatButton", "objectName": "signPhraseModalOkButton", "visible": True} +# Sign transaction popup +cancel_transaction_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "cancelButton", "text": "Cancel", "type": "StatusButton", "visible": True} +sign_transaction_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "signTransactionButton", "text": "Sign transaction", "type": "StatusButton", "visible": True} +o_FeeRow = {"container": statusDesktop_mainWindow_overlay, "type": "FeeRow", "unnamed": 1, "visible": True} +feeTotalRow_FeeRow = {"container": statusDesktop_mainWindow_overlay, "id": "feeTotalRow", "type": "FeeRow", "unnamed": 1, "visible": True} + # Remove account popup: mainWallet_Remove_Account_Popup_Account_Notification = {"container": statusDesktop_mainWindow, "objectName": "RemoveAccountPopup-Notification", "type": "StatusBaseText", "visible": True} mainWallet_Remove_Account_Popup_Account_Path_Component = {"container": statusDesktop_mainWindow, "objectName": "RemoveAccountPopup-DerivationPath", "type": "StatusInput", "visible": True} @@ -632,6 +638,11 @@ sview_ensAgreeTerms_StatusCheckBox = {"checkable": True, "container": mainWindow mainWindow_Register_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow, "objectName": "ensStartTransaction", "text": "Register", "type": "StatusButton", "visible": True} mainWindow_EnsRegisteredView = {"container": statusDesktop_mainWindow, "type": "EnsRegisteredView", "unnamed": 1, "visible": True} +# Advanced view +mainWindow_AdvancedView = {"container": mainWindow_StatusWindow, "type": "AdvancedView", "unnamed": 1, "visible": True} +mainWindow_settingsContentBaseScrollView_StatusScrollView = {"container": mainWindow_StatusWindow, "objectName": "settingsContentBaseScrollView", "type": "StatusScrollView", "visible": True} +manageCommunitiesOnTestnetButton_StatusSettingsLineButton = {"container": mainWindow_settingsContentBaseScrollView_StatusScrollView, "objectName": "manageCommunitiesOnTestnetButton", "type": "StatusSettingsLineButton", "visible": True} + # ONBOARDING NAMES mainWindow_onboardingBackButton_StatusRoundButton = {"container": statusDesktop_mainWindow, "objectName": "onboardingBackButton", "type": "StatusRoundButton", "visible": True} diff --git a/test/e2e/gui/screens/community_settings.py b/test/e2e/gui/screens/community_settings.py index 2d06245945..8497a10656 100644 --- a/test/e2e/gui/screens/community_settings.py +++ b/test/e2e/gui/screens/community_settings.py @@ -18,6 +18,7 @@ from gui.elements.scroll import Scroll from gui.elements.text_edit import TextEdit from gui.elements.text_label import TextLabel from gui.objects_map import communities_names, names +from gui.screens.community_settings_tokens import TokensView from scripts.tools.image import Image @@ -299,63 +300,6 @@ class MembersView(QObject): kick_member_popup.confirm_kicking() - -class TokensView(QObject): - def __init__(self): - super(TokensView, self).__init__(communities_names.mainWindow_mintPanel_MintTokensSettingsPanel) - self._mint_token_button = Button(communities_names.mainWindow_Mint_token_StatusButton) - self._welcome_image = QObject(communities_names.welcomeSettingsTokens_Image) - self._welcome_title = TextLabel(communities_names.welcomeSettingsTokens_Title) - self._welcome_subtitle = TextLabel(communities_names.welcomeSettingsTokensSubtitle) - self._welcome_checklist_1 = TextLabel(communities_names.checkListText_0_Tokens) - self._welcome_checklist_2 = TextLabel(communities_names.checkListText_1_Tokens) - self._welcome_checklist_3 = TextLabel(communities_names.checkListText_2_Tokens) - self._get_started_infobox = QObject(communities_names.mint_Owner_Tokens_InfoBoxPanel) - self._mint_owner_token_button = Button(communities_names.mint_Owner_Tokens_StatusButton) - - @property - @allure.step('Get mint token button enable state') - def is_mint_token_button_present(self) -> bool: - return self._mint_token_button.exists - - @property - @allure.step('Get tokens welcome image path') - def tokens_welcome_image_path(self) -> str: - return self._welcome_image.object.source.path - - @property - @allure.step('Get tokens welcome title') - def tokens_welcome_title(self) -> str: - return self._welcome_title.text - - @property - @allure.step('Get tokens welcome subtitle') - def tokens_welcome_subtitle(self) -> str: - return self._welcome_subtitle.text - - @property - @allure.step('Get tokens checklist') - def tokens_checklist(self) -> typing.List[str]: - tokens_checklist = [str(self._welcome_checklist_1.object.text), str(self._welcome_checklist_2.object.text), - str(self._welcome_checklist_3.object.text)] - return tokens_checklist - - @property - @allure.step('Get tokens info box title') - def tokens_infobox_title(self) -> str: - return str(self._get_started_infobox.object.title) - - @property - @allure.step('Get tokens info box text') - def tokens_infobox_text(self) -> str: - return str(self._get_started_infobox.object.text) - - @property - @allure.step('Get tokens mint owner token button visibility state') - def is_tokens_owner_token_button_visible(self) -> bool: - return self._mint_owner_token_button.is_visible - - class AirdropsView(QObject): def __init__(self): super(AirdropsView, self).__init__(communities_names.mainWindow_airdropPanel_AirdropsSettingsPanel) diff --git a/test/e2e/gui/screens/community_settings_tokens.py b/test/e2e/gui/screens/community_settings_tokens.py new file mode 100644 index 0000000000..f7e0506dc7 --- /dev/null +++ b/test/e2e/gui/screens/community_settings_tokens.py @@ -0,0 +1,307 @@ +import typing + +import allure + +import configs +import driver +from constants.community_settings import MintOwnerTokensElements +from gui.components.sign_transaction_popup import SignTransactionPopup +from gui.elements.button import Button +from gui.elements.object import QObject +from gui.elements.scroll import Scroll +from gui.elements.text_label import TextLabel +from gui.objects_map import communities_names + + +class TokensView(QObject): + def __init__(self): + super(TokensView, self).__init__(communities_names.mainWindow_mintPanel_MintTokensSettingsPanel) + self._mint_token_button = Button(communities_names.mainWindow_Mint_token_StatusButton) + self._welcome_image = QObject(communities_names.welcomeSettingsTokens_Image) + self._welcome_title = TextLabel(communities_names.welcomeSettingsTokens_Title) + self._welcome_subtitle = TextLabel(communities_names.welcomeSettingsTokensSubtitle) + self._welcome_checklist_1 = TextLabel(communities_names.checkListText_0_Tokens) + self._welcome_checklist_2 = TextLabel(communities_names.checkListText_1_Tokens) + self._welcome_checklist_3 = TextLabel(communities_names.checkListText_2_Tokens) + self._get_started_infobox = QObject(communities_names.mint_Owner_Tokens_InfoBoxPanel) + self._mint_owner_token_button = Button(communities_names.mint_Owner_Tokens_StatusButton) + + @property + @allure.step('Get mint token button visibility state') + def is_mint_token_button_present(self) -> bool: + return self._mint_token_button.exists + + @property + @allure.step('Get mint token button enable state') + def is_mint_token_button_enabled(self) -> bool: + return driver.waitForObjectExists(self._mint_token_button.real_name, + configs.timeouts.UI_LOAD_TIMEOUT_MSEC).enabled + + @property + @allure.step('Get tokens welcome image path') + def tokens_welcome_image_path(self) -> str: + return self._welcome_image.object.source.path + + @property + @allure.step('Get tokens welcome title') + def tokens_welcome_title(self) -> str: + return self._welcome_title.text + + @property + @allure.step('Get tokens welcome subtitle') + def tokens_welcome_subtitle(self) -> str: + return self._welcome_subtitle.text + + @property + @allure.step('Get tokens checklist') + def tokens_checklist(self) -> typing.List[str]: + tokens_checklist = [str(self._welcome_checklist_1.object.text), str(self._welcome_checklist_2.object.text), + str(self._welcome_checklist_3.object.text)] + return tokens_checklist + + @property + @allure.step('Get tokens info box title') + def tokens_infobox_title(self) -> str: + return str(self._get_started_infobox.object.title) + + @property + @allure.step('Get tokens info box text') + def tokens_infobox_text(self) -> str: + return str(self._get_started_infobox.object.text) + + @property + @allure.step('Get tokens mint owner token button visibility state') + def is_tokens_owner_token_button_visible(self) -> bool: + return self._mint_owner_token_button.is_visible + + @allure.step('Click mint owner button') + def click_mint_owner_button(self): + self._mint_owner_token_button.click() + return TokensOwnerTokenSettingsView().wait_until_appears() + + +class TokensOwnerTokenSettingsView(QObject): + def __init__(self): + super(TokensOwnerTokenSettingsView, self).__init__(communities_names.mainWindow_ownerTokenPage_SettingsPage) + self._scroll = Scroll(communities_names.o_Flickable) + self._owner_token_section = QObject(communities_names.ownerToken_InfoPanel) + self._token_master_token_section = QObject(communities_names.tokenMasterToken_InfoPanel) + self._next_button = Button(communities_names.next_StatusButton) + self._owner_token_text_object = TextLabel(communities_names.owner_token_StatusBaseText) + self._token_master_text_object = TextLabel(communities_names.token_master_StatusBaseText) + + @property + @allure.step('Get all text from owner token panel') + def get_text_labels_from_owner_token_panel(self) -> list: + if not self._owner_token_section.is_visible: + self._scroll.vertical_scroll_to(self._owner_token_section) + owner_token_text_labels = [] + for item in driver.findAllObjects(self._owner_token_text_object.real_name): + owner_token_text_labels.append(item) + return sorted(owner_token_text_labels, key=lambda item: item.y) + + @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}' + + @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}' + 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}' + 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}' + 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}' + 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}' + + @property + @allure.step('Get all text from master token panel') + def get_text_labels_from_master_token_panel(self) -> list: + if not self._token_master_token_section.is_visible: + self._scroll.vertical_scroll_to(self._token_master_token_section) + master_token_text_labels = [] + for item in driver.findAllObjects(self._token_master_text_object.real_name): + master_token_text_labels.append(item) + return sorted(master_token_text_labels, key=lambda item: item.y) + + @allure.step('Click next button') + def click_next(self): + if not self._next_button.is_visible: + self._scroll.vertical_down_to(self._next_button) + self._next_button.click() + return EditOwnerTokenView().wait_until_appears() + + +class EditOwnerTokenView(QObject): + def __init__(self): + super(EditOwnerTokenView, self).__init__(communities_names.mainWindow_editOwnerTokenView_EditOwnerTokenView) + self._scroll = Scroll(communities_names.editOwnerTokenView_Flickable) + self._select_account_combobox = QObject(communities_names.editOwnerTokenView_CustomComboItem) + self._select_network_combobox = QObject(communities_names.editOwnerTokenView_comboBox_ComboBox) + self._mainnet_network_item = QObject(communities_names.mainnet_NetworkSelectItemDelegate) + 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) + self._coin_icon = QObject(communities_names.editOwnerTokenView_token_sale_icon_StatusIcon) + self._symbol_box = QObject(communities_names.editOwnerTokenView_symbolBox) + self._total_box = QObject(communities_names.editOwnerTokenView_totalBox) + self._remaining_box = QObject(communities_names.editOwnerTokenView_remainingBox) + self._transferable_box = QObject(communities_names.editOwnerTokenView_transferableBox) + self._destructible_box = QObject(communities_names.editOwnerTokenView_destructibleBox) + self._edit_owner_token_text_object = TextLabel(communities_names.editOwnerTokenView_Owner_StatusBaseText) + + @property + @allure.step('Get fee title') + def get_fee_title(self) -> str: + return str(self.object.feeLabel) + + @property + @allure.step('Get fee total value') + def get_fee_total_value(self) -> str: + return str(self.object.feeText) + + @property + @allure.step('Get crown symbol') + def get_crown_symbol(self) -> bool: + return self._crown_icon.exists + + @property + @allure.step('Get coin symbol') + def get_coin_symbol(self) -> bool: + return self._coin_icon.exists + + @allure.step('Get text labels') + def get_all_text_labels(self) -> list: + text_labels = [] + for item in driver.findAllObjects(self._edit_owner_token_text_object.real_name): + text_labels.append(str(item.text)) + return text_labels + + @allure.step('Get all symbol boxes') + def get_symbol_boxes(self): + symbol_boxes = [] + for item in driver.findAllObjects(self._symbol_box.real_name): + symbol_boxes.append(item) + sorted(symbol_boxes, key=lambda item: item.y) + return symbol_boxes + + @allure.step('Get all total boxes') + def get_total_boxes(self): + total_boxes = [] + for item in driver.findAllObjects(self._total_box.real_name): + total_boxes.append(item) + sorted(total_boxes, key=lambda item: item.y) + return total_boxes + + @allure.step('Get all remaining boxes') + def get_remaining_boxes(self): + remaining_boxes = [] + for item in driver.findAllObjects(self._remaining_box.real_name): + remaining_boxes.append(item) + sorted(remaining_boxes, key=lambda item: item.y) + return remaining_boxes + + @allure.step('Get all destructible boxes') + def get_destructible_boxes(self): + destructible_boxes = [] + for item in driver.findAllObjects(self._destructible_box.real_name): + destructible_boxes.append(item) + sorted(destructible_boxes, key=lambda item: item.y) + return destructible_boxes + + @allure.step('Get all transferable boxes') + def get_transferable_boxes(self): + transferable_boxes = [] + for item in driver.findAllObjects(self._transferable_box.real_name): + transferable_boxes.append(item) + sorted(transferable_boxes, key=lambda item: item.y) + return transferable_boxes + + @allure.step('Get owner symbol box content') + def get_symbol_box_content(self, index: int) -> str: + symbol_box = self.get_symbol_boxes()[index] + return str(symbol_box.value) + + @allure.step('Get total box content') + def get_total_box_content(self, index: int) -> str: + total_box = self.get_total_boxes()[index] + return str(total_box.value) + + @allure.step('Get remaining box content') + def get_remaining_box_content(self, index: int) -> str: + remaining_box = self.get_remaining_boxes()[index] + return str(remaining_box.value) + + @allure.step('Get transferable box content') + def get_transferable_box_content(self, index: int) -> str: + transferable_box = self.get_transferable_boxes()[index] + return str(transferable_box.value) + + @allure.step('Get destructible box content') + def get_destructible_box_content(self, index: int) -> str: + destructible_box = self.get_destructible_boxes()[index] + return str(destructible_box.value) + + @allure.step('Select Mainnet network') + def select_mainnet_network(self): + if not self._select_network_combobox.is_visible: + self._scroll.vertical_down_to(self._select_network_combobox) + self._select_network_combobox.click() + self._mainnet_network_item.click() + return self + + @allure.step('Click mint button') + def click_mint(self): + if not self._mint_button.is_visible: + self._scroll.vertical_down_to(self._mint_button) + self._mint_button.click() + return SignTransactionPopup().wait_until_appears() + + +class MintedTokensView(QObject): + def __init__(self): + super(MintedTokensView, self).__init__(communities_names.mainWindow_MintedTokensView) + self._coin_symbol = QObject(communities_names.token_sale_icon_StatusIcon) + self._crown_symbol = QObject(communities_names.crown_icon_StatusIcon) + self._master_token = QObject(communities_names.o_CollectibleView) + self._owner_token = QObject(communities_names.o_CollectibleView_2) + + @property + @allure.step('Check crown symbol is visible on owner token') + def does_crown_exist(self) -> bool: + return self._crown_symbol.exists + + @property + @allure.step('Check coin symbol is visible on master token') + def does_coin_exist(self) -> bool: + return self._coin_symbol.exists + + @property + @allure.step('Get title of owner token') + def get_owner_token_title(self) -> str: + return str(self._owner_token.object.title) + + @property + @allure.step('Get title of master token') + def get_master_token_title(self) -> str: + return str(self._master_token.object.title) + + @property + @allure.step('Get status of owner token') + def get_owner_token_status(self) -> str: + return str(self._owner_token.object.subTitle) + + @property + @allure.step('Get status of master token') + def get_master_token_status(self) -> str: + return str(self._master_token.object.subTitle) diff --git a/test/e2e/gui/screens/settings_ens_usernames.py b/test/e2e/gui/screens/settings_ens_usernames.py index 5f27654bfe..a356dbf02e 100644 --- a/test/e2e/gui/screens/settings_ens_usernames.py +++ b/test/e2e/gui/screens/settings_ens_usernames.py @@ -14,7 +14,7 @@ class ENSSettingsView(QObject): def __init__(self): super().__init__(names.mainWindow_EnsWelcomeView) - self._start_button = Scroll(names.mainWindow_Start_StatusButton) + self._start_button = Button(names.mainWindow_Start_StatusButton) @allure.step('Start purhasing ens username') def start(self): diff --git a/test/e2e/tests/communities/test_communities_mint_owner_token.py b/test/e2e/tests/communities/test_communities_mint_owner_token.py new file mode 100644 index 0000000000..8e973f47af --- /dev/null +++ b/test/e2e/tests/communities/test_communities_mint_owner_token.py @@ -0,0 +1,149 @@ +import time + +import allure +import pytest +from allure_commons._allure import step + +import configs +import constants +import driver +from . import marks +from constants.community_settings import MintOwnerTokensElements +from gui.components.onboarding.before_started_popup import BeforeStartedPopUp +from gui.components.onboarding.beta_consent_popup import BetaConsentPopup +from gui.components.splash_screen import SplashScreen +from gui.screens.community_settings_tokens import MintedTokensView +from gui.screens.onboarding import KeysView, WelcomeToStatusView, BiometricsView, YourEmojihashAndIdenticonRingView + +pytestmark = marks + + +@pytest.fixture +def keys_screen(main_window) -> KeysView: + with step('Open Generate new keys view'): + BeforeStartedPopUp().get_started() + wellcome_screen = WelcomeToStatusView().wait_until_appears() + return wellcome_screen.get_keys() + + +@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/727245', 'Mint owner token') +@pytest.mark.case(727245) +@pytest.mark.parametrize('user_account', [constants.user.user_with_funds]) +def test_mint_owner_token(keys_screen, main_window, user_account): + with step('Open import seed phrase view and enter seed phrase'): + input_view = keys_screen.open_import_seed_phrase_view().open_seed_phrase_input_view() + input_view.input_seed_phrase(user_account.seed_phrase, True) + profile_view = input_view.import_seed_phrase() + profile_view.set_display_name(user_account.name) + + with step('Finalize onboarding and open main screen'): + create_password_view = profile_view.next() + confirm_password_view = create_password_view.create_password(user_account.password) + confirm_password_view.confirm_password(user_account.password) + if configs.system.IS_MAC: + BiometricsView().wait_until_appears().prefer_password() + SplashScreen().wait_until_appears().wait_until_hidden() + next_view = YourEmojihashAndIdenticonRingView().verify_emojihash_view_present().next() + if configs.system.IS_MAC: + next_view.start_using_status() + SplashScreen().wait_until_appears().wait_until_hidden() + if not configs.system.TEST_MODE: + BetaConsentPopup().confirm() + + with step('Enable creation of community option'): + settings = main_window.left_panel.open_settings() + settings.left_panel.open_advanced_settings().enable_creation_of_communities() + + with step('Set testnet mode'): + settings = main_window.left_panel.open_settings() + wallet_settings = settings.left_panel.open_wallet_settings() + wallet_settings.open_networks().switch_testnet_mode_toggle().turn_on_testnet_mode_in_testnet_modal() + + with step('Switch manage community on testnet option'): + settings.left_panel.open_advanced_settings().switch_manage_on_community() + + with step('Create simple community'): + community_params = constants.community_params + main_window.create_community(community_params['name'], community_params['description'], + community_params['intro'], community_params['outro'], + community_params['logo']['fp'], community_params['banner']['fp']) + community_screen = main_window.left_panel.select_community(community_params['name']) + + with step('Open mint owner token view'): + 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('Select Mainnet network in edit network view and click mint'): + 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('Verify all elements of master token section'): + select_network = edit_owner_token_view.select_mainnet_network() + + 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) + assert driver.waitFor(lambda: edit_owner_token_view.get_fee_total_value != '', + configs.timeouts.UI_LOAD_TIMEOUT_MSEC) + + with step('Start minting'): + start_minting = select_network.click_mint() + + with step('Verify fee text and sign transaction'): + assert start_minting.get_fee_title == 'Mint ' + community_params[ + 'name'] + MintOwnerTokensElements.SIGN_TRANSACTION_MINT_TITLE.value + 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[ + 'name'] + MintOwnerTokensElements.TOAST_AIRDROPPING_TOKEN_2.value) in toast_messages, + configs.timeouts.UI_LOAD_TIMEOUT_MSEC) + assert driver.waitFor(lambda: (community_params[ + 'name'] + MintOwnerTokensElements.TOAST_TOKENS_BEING_MINTED.value) in toast_messages, + configs.timeouts.UI_LOAD_TIMEOUT_MSEC)