chore(@edit_network): add verifications for checkbox and error messages (#138)

This commit is contained in:
Anastasiya Semenkevich 2023-10-06 12:05:32 +06:00 committed by GitHub
parent b25af97160
commit b9129b96af
4 changed files with 62 additions and 12 deletions

View File

@ -13,6 +13,7 @@ class WalletNetworkSettings(Enum):
TESTNET_SUBTITLE = 'Switch entire Status app to testnet only mode'
TESTNET_ENABLED_TOAST_MESSAGE = 'Testnet mode turned on'
TESTNET_DISABLED_TOAST_MESSAGE = 'Testnet mode turned off'
ACKNOWLEDGMENT_CHECKBOX_TEXT = 'I understand that changing network settings can cause unforeseen issues, errors, security risks and potentially even loss of funds.'
class WalletNetworkNaming(Enum):
@ -28,5 +29,10 @@ class WalletNetworkNaming(Enum):
class WalletNetworkDefaultValues(Enum):
ETHEREUM_LIVE_MAIN = 'https://eth-archival.gateway.pokt.network/v1/lb/********'
ETHEREUM_LIVE_MAIN = 'https://eth-archival.gateway.pokt.network/v1/lb/************************'
ETHEREUM_LIVE_FAILOVER = 'https://mainnet.infura.io/v3/********************************'
class WalletEditNetworkErrorMessages(Enum):
PINGUNSUCCESSFUL = 'RPC appears to be either offline or this is not a valid JSON RPC endpoint URL'
PINGVERIFIED = 'RPC successfully reached'

View File

@ -78,8 +78,10 @@ editNetworkMainRpcInput = {"container": statusDesktop_mainWindow, "objectName":
editNetworkFailoverRpcUrlInput = {"container": statusDesktop_mainWindow, "objectName": "editNetworkFailoverRpcUrlInput", "type": "TextEdit", "visible": True}
editNetworkExplorerInput = {"container": statusDesktop_mainWindow, "objectName": "editNetworkExplorerInput", "type": "TextEdit"}
editNetworkAknowledgmentCheckbox = {"container": statusDesktop_mainWindow, "objectName": "editNetworkAknowledgmentCheckbox", "type": "StatusCheckBox", "visible": True}
editNetworkRevertButton = {"container": statusDesktop_mainWindow, "objectName": "editNetworkRevertButton", "type": "StatusButton", "visible": True}
editNetworkRevertButton = {"container": statusDesktop_mainWindow, "objectName": "editNetworkRevertButton", "type": "StatusButton", "visible": True, "enabled": True}
editNetworkSaveButton = {"container": statusDesktop_mainWindow, "objectName": "editNetworkSaveButton", "type": "StatusButton"}
mainRpcUrlInputObject = {"container": settingsContentBase_ScrollView, "objectName": "mainRpcInputObject", "type": "StatusInput", "visible": True}
failoverRpcUrlInputObject = {"container": settingsContentBase_ScrollView, "objectName": "failoverRpcUrlInputObject", "type": "StatusInput", "visible": True}
# Profile View
mainWindow_MyProfileView = {"container": statusDesktop_mainWindow, "type": "MyProfileView", "unnamed": 1, "visible": True}

View File

@ -446,6 +446,8 @@ class EditNetworkSettings(WalletSettingsView):
self._network_save_changes = Button('editNetworkSaveButton')
self._network_edit_view_back_button = Button('main_toolBar_back_button')
self._network_edit_scroll = Scroll('settingsContentBaseScrollView_Flickable')
self._network_edit_main_rpc_url_error_message = QObject('mainRpcUrlInputObject')
self._network_edit_failover_rpc_url_error_message = QObject('failoverRpcUrlInputObject')
@allure.step('Verify elements for the edit network view')
def check_available_elements_on_edit_view(self):
@ -462,19 +464,19 @@ class EditNetworkSettings(WalletSettingsView):
self._network_edit_scroll.vertical_down_to(self._network_acknowledgment_checkbox)
assert driver.waitFor(lambda: self._network_acknowledgment_checkbox.exists,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f"Acknowldegment checkbox is not present"
self._network_edit_scroll.vertical_down_to(self._network_revert_to_default)
assert driver.waitFor(lambda: self._network_revert_to_default.exists,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f"Revert to default button is not present"
assert self._network_save_changes.exists
assert self._network_save_changes.exists, f"Save changes button is not present"
@allure.step('Edit the rpc input field')
@allure.step('Edit Main RPC url input field')
def edit_network_main_json_rpc_url_input(self, test_value):
self._network_main_json_rpc_url.text = test_value
@allure.step('Edit the rpc input field')
@allure.step('Edit Failover RPC url input field')
def edit_network_failover_json_rpc_url_input(self, test_value):
self._network_failover_json_rpc_url.text = test_value
@ -483,10 +485,32 @@ class EditNetworkSettings(WalletSettingsView):
self._network_acknowledgment_checkbox.set(value)
return self
@allure.step('Get the text for consent when changing RPC urls')
def get_acknowledgement_checkbox_text(self, attr):
text = str(self._network_acknowledgment_checkbox.get_object_attribute(attr))
return text
@allure.step('Get error message for Main RPC URL input')
def get_main_rpc_url_error_message_text(self):
error = str(self._network_edit_main_rpc_url_error_message.object.errorMessageCmp.text)
return error
@allure.step('Get error message for Failover RPC URL input')
def get_failover_rpc_url_error_message_text(self):
error = str(self._network_edit_failover_rpc_url_error_message.object.errorMessageCmp.text)
return error
@allure.step('Click Revert to default button')
def click_network_revert_to_default(self):
def revert_to_default(self, attempts=2):
current_value_main = self._network_main_json_rpc_url.text
current_value_failover = self._network_failover_json_rpc_url.text
self._network_edit_scroll.vertical_down_to(self._network_revert_to_default)
self._network_revert_to_default.click()
if (current_value_main == self._network_main_json_rpc_url.text
and current_value_failover == self._network_failover_json_rpc_url.text):
assert attempts > 0, "value not reverted"
time.sleep(1)
self.revert_to_default(attempts-1)
@allure.step('Get value from Main json rpc input')
def get_edit_network_main_json_rpc_url_value(self):

View File

@ -7,7 +7,8 @@ from allure import step
import configs
import constants
import driver
from constants.wallet import WalletNetworkSettings, WalletNetworkNaming, WalletNetworkDefaultValues
from constants.wallet import WalletNetworkSettings, WalletNetworkNaming, WalletNetworkDefaultValues, \
WalletEditNetworkErrorMessages
from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.components.wallet.authenticate_popup import AuthenticatePopup
from gui.components.wallet.testnet_mode_banner import TestnetModeBanner
@ -143,24 +144,41 @@ def test_settings_networks_edit_restore_defaults(main_screen: MainWindow):
with step('Click in Main JSON RPC URL and paste incorrect URL'):
edit_network_form.edit_network_main_json_rpc_url_input("https://eth-archival.gateway.pokt.network/v1/lb/")
with step('Check error message'):
assert edit_network_form.self._network_edit_error_message() == 'test'
with step('Check error message for Main JSON RPC URL input'):
assert driver.waitFor(
lambda: edit_network_form.get_main_rpc_url_error_message_text() == WalletEditNetworkErrorMessages.PINGUNSUCCESSFUL.value)
with step('Click in Failover JSON RPC URL and paste incorrect URL'):
edit_network_form.edit_network_failover_json_rpc_url_input("https://eth-archival.gateway.pokt.network/v1/lb/")
with step('Check error message for Failover JSON RPC URL input'):
assert driver.waitFor(
lambda: edit_network_form.get_failover_rpc_url_error_message_text() == WalletEditNetworkErrorMessages.PINGUNSUCCESSFUL.value)
with step('Check the acknowledgment checkbox'):
edit_network_form.check_acknowledgement_checkbox(True)
with step('Check the acknowledgment text'):
assert edit_network_form.get_acknowledgement_checkbox_text(
'text') == WalletNetworkSettings.ACKNOWLEDGMENT_CHECKBOX_TEXT.value
with step('Click Revert to default button and restore values'):
edit_network_form.click_network_revert_to_default()
edit_network_form.revert_to_default()
with step('Check value in Main JSON RPC URL input'):
assert edit_network_form.get_edit_network_main_json_rpc_url_value() == WalletNetworkDefaultValues.ETHEREUM_LIVE_MAIN.value
with step('Check successful connection message for Main JSON RPC URL input'):
assert driver.waitFor(
lambda: edit_network_form.get_main_rpc_url_error_message_text() == WalletEditNetworkErrorMessages.PINGVERIFIED.value)
with (step('Check value in Failover JSON RPC URL input')):
assert edit_network_form.get_edit_network_failover_json_rpc_url_value() == WalletNetworkDefaultValues.ETHEREUM_LIVE_FAILOVER.value
with step('Check successful connection message for Failover JSON RPC URL input'):
assert driver.waitFor(
lambda: edit_network_form.get_failover_rpc_url_error_message_text() == WalletEditNetworkErrorMessages.PINGVERIFIED.value)
with step('Verify the acknowledgment checkbox is unchecked'):
assert edit_network_form.check_acknowledgement_checkbox(False)