test: test_ens_name_purchase added

This commit is contained in:
Valentina Novgorodtceva 2023-12-11 14:20:57 +07:00 committed by Valentina1133
parent eeaba5822d
commit 4f69111778
6 changed files with 186 additions and 1 deletions

View File

@ -44,3 +44,6 @@ wallet_account_list_item_2 = namedtuple('WalletAccountListItem', ['name', 'icon'
wallet_account = namedtuple('PrivateKeyAddressPair', ['private_key', 'wallet_address'])
private_key_address_pair_1 = wallet_account('2daa36a3abe381a9c01610bf10fda272fbc1b8a22179a39f782c512346e3e470',
'0xd89b48cbcb4244f84a4fb5d3369c120e8f8aa74e')
ens_user_name = ''.join(
random.choices(string.digits + string.ascii_lowercase, k=8))

View File

@ -47,6 +47,10 @@ class SendPopup(BasePopup):
self._amount_text_edit.text = str(amount)
self._ens_address_text_edit.type_text(address)
driver.waitFor(lambda: self._send_button.is_visible, timeout_msec=6000)
self.click_send()
@allure.step('Click send button')
def click_send(self):
self._send_button.click()
def is_arbitrum_network_identified(self) -> bool:

View File

@ -131,4 +131,19 @@ settings_Sync_New_Device_Header = {"container": settingsContentBase_ScrollView,
settings_Sync_New_Device_SubTitle = {"container": settingsContentBase_ScrollView, "objectName": "syncNewDeviceSubTitleTextLabel", "type": "StatusBaseText", "visible": True}
#Sing out and quit View
signOutConfirmationButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "signOutConfirmation", "type": "StatusButton", "visible": True}
signOutConfirmationButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "signOutConfirmation", "type": "StatusButton", "visible": True}
# ENS usernames View
mainWindow_EnsWelcomeView = {"container": statusDesktop_mainWindow, "type": "EnsWelcomeView", "unnamed": 1, "visible": True}
mainWindow_Start_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow, "objectName": "ensStartButton", "type": "StatusButton", "visible": True}
mainWindow_EnsSearchView = {"container": statusDesktop_mainWindow, "type": "EnsSearchView", "unnamed": 1, "visible": True}
mainWindow_ensUsernameInput_StyledTextField = {"container": statusDesktop_mainWindow, "echoMode": 0, "objectName": "ensUsernameInput", "type": "StyledTextField", "visible": True}
mainWindow_ensNextButton_StatusRoundButton = {"container": statusDesktop_mainWindow, "objectName": "ensNextButton", "type": "StatusRoundButton", "visible": True}
ens_StatusBaseText = {"container": mainWindow_EnsSearchView, "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_EnsTermsAndConditionsView = {"container": statusDesktop_mainWindow, "type": "EnsTermsAndConditionsView", "unnamed": 1, "visible": True}
mainWindow_sview_StatusScrollView = {"container": statusDesktop_mainWindow, "id": "sview", "type": "StatusScrollView", "unnamed": 1, "visible": True}
sview_walletAddressLbl_StatusDescriptionListItem = {"container": mainWindow_sview_StatusScrollView, "id": "walletAddressLbl", "type": "StatusDescriptionListItem", "unnamed": 1, "visible": True}
sview_keyLbl_StatusDescriptionListItem = {"container": mainWindow_sview_StatusScrollView, "id": "keyLbl", "type": "StatusDescriptionListItem", "unnamed": 1, "visible": True}
sview_ensAgreeTerms_StatusCheckBox = {"checkable": True, "container": mainWindow_sview_StatusScrollView, "objectName": "ensAgreeTerms", "type": "StatusCheckBox", "visible": True}
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}

View File

@ -1,9 +1,12 @@
import time
import allure
from gui.components.back_up_your_seed_phrase_popup import BackUpYourSeedPhrasePopUp
from gui.elements.object import QObject
from gui.elements.scroll import Scroll
from gui.screens.settings_communities import CommunitiesSettingsView
from gui.screens.settings_ens_usernames import ENSSettingsView
from gui.screens.settings_keycard import KeycardSettingsView
from gui.screens.settings_messaging import MessagingSettingsView
from gui.screens.settings_profile import ProfileSettingsView
@ -76,6 +79,12 @@ class LeftPanel(QObject):
self._open_settings('13-MainMenuItem')
return KeycardSettingsView()
@allure.step('Open ENS usernames settings')
def open_ens_usernames_settings(self) -> ENSSettingsView:
time.sleep(1)
self._open_settings('2-MainMenuItem')
return ENSSettingsView()
class SettingsScreen(QObject):

View File

@ -0,0 +1,73 @@
import allure
import configs.timeouts
import driver
from gui.components.wallet.send_popup import SendPopup
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.elements.scroll import Scroll
from gui.elements.text_edit import TextEdit
class ENSSettingsView(QObject):
def __init__(self):
super().__init__('mainWindow_EnsWelcomeView')
self._start_button = Scroll('mainWindow_Start_StatusButton')
@allure.step('Start purhasing ens username')
def start(self):
self._start_button.click()
return ENSSearchView().wait_until_appears()
class ENSSearchView(QObject):
def __init__(self):
super(ENSSearchView, self).__init__('mainWindow_EnsSearchView')
self._username_text_field = TextEdit('mainWindow_ensUsernameInput_StyledTextField')
self._next_button = Button('mainWindow_ensNextButton_StatusRoundButton')
self._ens_text_note = QObject('ens_StatusBaseText')
@allure.step('Enter user name to text field')
def enter_user_name(self, name: str):
self._username_text_field.text = name
return self._next_button.wait_until_appears()
@allure.step('Click next button')
def click_next_button(self):
self._next_button.click()
return ENSTermsAndConditionsView().wait_until_appears()
@allure.step('Get all text notes from ens search view')
def ens_text_notes(self):
return [str(note.text) for note in driver.findAllObjects(self._ens_text_note.real_name)]
class ENSTermsAndConditionsView(QObject):
def __init__(self):
super(ENSTermsAndConditionsView, self).__init__('mainWindow_EnsTermsAndConditionsView')
self._agree_terms_checkbox = TextEdit('sview_ensAgreeTerms_StatusCheckBox')
self._register_button = Button('mainWindow_Register_StatusButton')
@allure.step('Get registered button enabled state')
def is_register_button_enabled(self) -> bool:
return driver.waitForObjectExists(self._register_button.real_name,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC).enabled
@allure.step('Register ens username')
def register_ens_name(self):
self.check_agree_terms_checkbox()
driver.waitFor(lambda: self.is_register_button_enabled(), configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
self._register_button.click()
return SendPopup().wait_until_appears()
@allure.step('Check agree terms checkbox')
def check_agree_terms_checkbox(self):
self._agree_terms_checkbox.click()
class ENSRegisteredView(QObject):
def __init__(self):
super(ENSRegisteredView, self).__init__('mainWindow_EnsRegisteredView')

View File

@ -0,0 +1,81 @@
import allure
import pytest
from allure_commons._allure import step
import configs
import constants
import driver
from configs.timeouts import UI_LOAD_TIMEOUT_SEC
from constants.wallet import WalletTransactions
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.components.wallet.authenticate_popup import AuthenticatePopup
from gui.components.wallet.send_popup import SendPopup
from gui.screens.onboarding import KeysView, AllowNotificationsView, WelcomeToStatusView, BiometricsView
from gui.screens.settings_ens_usernames import ENSRegisteredView
@pytest.fixture
def keys_screen(main_window) -> KeysView:
with step('Open Generate new keys view'):
if configs.system.IS_MAC:
AllowNotificationsView().wait_until_appears().allow()
BeforeStartedPopUp().get_started()
wellcome_screen = WelcomeToStatusView().wait_until_appears()
return wellcome_screen.get_keys()
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704597',
'Settings -> ENS usernames: buy ENS name on testnet')
@pytest.mark.case(704597)
@pytest.mark.parametrize('user_account', [constants.user.user_with_funds])
@pytest.mark.parametrize('ens_name', [pytest.param(constants.user.ens_user_name)])
def test_ens_name_purchase(keys_screen, main_window, user_account, ens_name):
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'):
details_view = profile_view.next()
create_password_view = details_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()
if not configs.system.TEST_MODE:
BetaConsentPopup().confirm()
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('Open ENS usernames settings and enter user name'):
ens_settings = settings.left_panel.open_ens_usernames_settings().start()
ens_settings.enter_user_name(ens_name)
if driver.waitFor(lambda: 'Username already taken :(' in ens_settings.ens_text_notes(), UI_LOAD_TIMEOUT_SEC):
ens_settings.enter_user_name(ens_name)
with step('Verify that user name is available'):
assert driver.waitFor(lambda: '✓ Username available!' in ens_settings.ens_text_notes(), UI_LOAD_TIMEOUT_SEC)
with step('Register ens username'):
register_ens = ens_settings.click_next_button().register_ens_name()
with step('Confirm sending amount for purchasing ens username in send popup'):
register_ens.click_send()
assert driver.waitFor(lambda: SendPopup().is_mainnet_network_identified, configs.timeouts.UI_LOAD_TIMEOUT_SEC)
with step('Enter password in authenticate popup'):
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
with step('Verify toast message with Transaction pending appears'):
assert WalletTransactions.TRANSACTION_PENDING_TOAST_MESSAGE.value in ' '.join(
main_window.wait_for_notification())
with step('Verify username registered view appears'):
ENSRegisteredView().wait_until_appears()