chore: removed duplicated method, updated test according to changes

This commit is contained in:
Valentina Novgorodtceva 2024-07-17 15:07:35 +07:00 committed by Anastasiya
parent 44808424a4
commit b0f373f1dc
5 changed files with 48 additions and 12 deletions

View File

@ -0,0 +1,27 @@
import allure
import configs
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.text_label import TextLabel
from gui.objects_map import names
class RPCChangeRestartPopup(BasePopup):
def __init__(self):
super(RPCChangeRestartPopup, self).__init__()
self._save_restart_later_button = Button(names.save_and_restart_later_StatusFlatButton)
self._save_restart_now_button = Button(names.save_and_restart_Status_StatusButton)
self._restart_required_text = TextLabel(names.restart_required_StatusBaseText)
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._save_restart_now_button.wait_until_appears(timeout_msec)
return self
@allure.step('Click Save and restart later button')
def save_and_restart_later(self):
self._save_restart_later_button.click()
self._save_restart_later_button.wait_until_hidden()
return self

View File

@ -242,6 +242,11 @@ mainWallet_Remove_Account_Popup_HavePenPaperCheckBox = {"checkable": True, "cont
mainWallet_Remove_Account_Popup_ConfirmButton = {"container": statusDesktop_mainWindow, "objectName": "RemoveAccountPopup-ConfirmButton", "type": "StatusButton", "visible": True}
mainWallet_Remove_Account_Popup_CancelButton = {"container": statusDesktop_mainWindow, "objectName": "RemoveAccountPopup-CancelButton", "type": "StatusFlatButton", "visible": True}
# RPC change restart popup
save_and_restart_later_StatusFlatButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "laterButton", "type": "StatusFlatButton", "visible": True}
save_and_restart_Status_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "saveButton", "type": "StatusButton", "visible": True}
restart_required_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "objectName": "mustBeRestartedText","type": "StatusBaseText", "visible": True}
# Add saved address popup
mainWallet_Saved_Addreses_Popup_Name_Input = {"container": statusDesktop_mainWindow, "objectName": "savedAddressNameInput", "type": "TextEdit"}
mainWallet_Saved_Addreses_Popup_Address_Input = {"container": statusDesktop_mainWindow, "objectName": "savedAddressAddressInput", "type": "StatusInput"}

View File

@ -12,6 +12,7 @@ from constants.wallet import WalletNetworkSettings, WalletNetworkDefaultValues
from driver import objects_access
from driver.objects_access import walk_children
from gui.components.settings.rename_keypair_popup import RenameKeypairPopup
from gui.components.wallet.RPCChangeRestartPopup import RPCChangeRestartPopup
from gui.components.wallet.add_saved_address_popup import AddressPopup
from gui.components.wallet.popup_delete_account_from_settings import RemoveAccountConfirmationSettings
from gui.components.wallet.testnet_mode_popup import TestnetModePopup
@ -329,6 +330,11 @@ class EditNetworkSettings(WalletSettingsView):
self._network_edit_main_rpc_url_error_message = QObject(settings_names.mainRpcUrlInputObject)
self._network_edit_failover_rpc_url_error_message = QObject(settings_names.failoverRpcUrlInputObject)
@allure.step('Click back button')
def click_network_back(self):
self._network_edit_view_back_button.click()
return NetworkWalletSettings().wait_until_appears()
@allure.step('Select Live Network tab')
def click_live_network_tab(self):
self._live_network_tab.click()
@ -347,12 +353,12 @@ class EditNetworkSettings(WalletSettingsView):
self._network_edit_scroll.vertical_scroll_down(self._network_revert_to_default)
self._network_revert_to_default.click()
try:
return NetworkWalletSettings().wait_until_appears()
return RPCChangeRestartPopup().wait_until_appears()
except AssertionError:
if attempts:
self.click_revert_to_default_and_go_to_networks_main_screen(attempts - 1)
else:
raise f"Networks screen was not opened"
raise f"RPC change requires restart popup did not appear"
@allure.step('Verify elements for the edit network view')
def check_available_elements_on_edit_view(self, network_tab):
@ -467,12 +473,6 @@ class EditNetworkSettings(WalletSettingsView):
time.sleep(1)
self.revert_to_default(attempts - 1)
@allure.step('Click Revert to default button and redirect to Networks screen')
def click_revert_to_default_and_go_to_networks_main_screen(self):
self._network_edit_scroll.vertical_scroll_down(self._network_revert_to_default)
self._network_revert_to_default.click()
return NetworkWalletSettings().wait_until_appears()
@allure.step('Get value from Main json rpc input')
def get_edit_network_main_json_rpc_url_value(self):
return self._network_main_json_rpc_url.text

View File

@ -16,10 +16,9 @@ pytestmark = marks
'Network: Network: Editing network -> Restore defaults')
@pytest.mark.case(703515)
@pytest.mark.parametrize('network_tab', [
pytest.param(WalletNetworkSettings.EDIT_NETWORK_LIVE_TAB.value)
# pytest.param(WalletNetworkSettings.EDIT_NETWORK_TEST_TAB.value)
pytest.param(WalletNetworkSettings.EDIT_NETWORK_LIVE_TAB.value),
pytest.param(WalletNetworkSettings.EDIT_NETWORK_TEST_TAB.value)
])
# TODO: https://github.com/status-im/status-desktop/issues/14228
def test_settings_networks_edit_restore_defaults(main_screen: MainWindow, network_tab: str):
networks = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_networks()
@ -60,7 +59,7 @@ def test_settings_networks_edit_restore_defaults(main_screen: MainWindow, networ
'text') == WalletNetworkSettings.ACKNOWLEDGMENT_CHECKBOX_TEXT.value
with step('Click Revert to default button and go to Networks screen'):
edit_network_form.click_revert_to_default_and_go_to_networks_main_screen()
edit_network_form.click_revert_to_default_and_go_to_networks_main_screen().save_and_restart_later()
with step('Verify toast message appears for reverting to defaults'):
if network_tab == WalletNetworkSettings.EDIT_NETWORK_LIVE_TAB.value:
@ -76,6 +75,8 @@ def test_settings_networks_edit_restore_defaults(main_screen: MainWindow, networ
assert message == WalletNetworkSettings.REVERT_TO_DEFAULT_TEST_MAINNET_TOAST_MESSAGE.value, \
f"Toast message is incorrect, current message is {message}"
edit_network_form.click_network_back()
with step('Open Ethereum Mainnet network item to edit'):
edit_network_form = networks.click_network_item_to_open_edit_view(
WalletNetworkNaming.ETHEREUM_MAINNET_NETWORK_ID.value)

View File

@ -367,6 +367,7 @@ ColumnLayout {
}
StatusBaseText {
objectName: "mustBeRestartedText"
text: qsTr("For new JSON RPC URLs to take effect, Status must be restarted. Are you ready to do this now?")
font.pixelSize: 15
anchors.left: parent.left
@ -385,6 +386,7 @@ ColumnLayout {
rightButtons: [
StatusFlatButton {
id: laterButton
objectName: "laterButton"
text: qsTr("Save and restart later")
type: StatusBaseButton.Type.Normal
onClicked: {
@ -395,6 +397,7 @@ ColumnLayout {
},
StatusButton {
id: saveButton
objectName: "saveButton"
type: StatusBaseButton.Type.Normal
text: qsTr("Save and restart Status")
focus: true