Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions gui/components/wallet/wallet_account_popups.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from gui.elements.object import QObject
from gui.elements.scroll import Scroll
from gui.elements.text_edit import TextEdit
from gui.elements.text_label import TextLabel


GENERATED_PAGES_LIMIT = 20
Expand All @@ -28,6 +29,7 @@ def __init__(self):
self._name_text_edit = TextEdit('mainWallet_AddEditAccountPopup_AccountName')
self._emoji_button = Button('mainWallet_AddEditAccountPopup_AccountEmojiPopupButton')
self._color_radiobutton = QObject('color_StatusColorRadioButton')
self._popup_header_title = TextLabel('mainWallet_AddEditAccountPopup_HeaderTitle')
# origin
self._origin_combobox = QObject('mainWallet_AddEditAccountPopup_SelectedOrigin')
self._watched_address_origin_item = QObject("mainWallet_AddEditAccountPopup_OriginOptionWatchOnlyAcc")
Expand All @@ -45,6 +47,10 @@ def __init__(self):
self._address_combobox_button = Button('mainWallet_AddEditAccountPopup_GeneratedAddressComponent')
self._non_eth_checkbox = CheckBox('mainWallet_AddEditAccountPopup_NonEthDerivationPathCheckBox')

def verify_account_popup_present(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
driver.waitFor(lambda: self._popup_header_title.exists, timeout_msec)
return self

@allure.step('Set name for account')
def set_name(self, value: str):
self._name_text_edit.text = value
Expand Down
1 change: 1 addition & 0 deletions gui/objects_map/component_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
mainWallet_AddEditAccountPopup_BackButton = {"container": statusDesktop_mainWindow, "objectName": "AddAccountPopup-BackButton", "type": "StatusBackButton", "visible": True}
mainWallet_AddEditAccountPopup_AccountNameComponent = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "AddAccountPopup-AccountName", "type": "StatusInput", "visible": True}
mainWallet_AddEditAccountPopup_AccountName = {"container": mainWallet_AddEditAccountPopup_AccountNameComponent, "type": "TextEdit", "unnamed": 1, "visible": True}
mainWallet_AddEditAccountPopup_HeaderTitle = {"container": statusDesktop_mainWindow_overlay, "objectName": "headerTitle", "type": "StatusBaseText", "visible": True}
mainWallet_AddEditAccountPopup_AccountColorComponent = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "AddAccountPopup-AccountColor", "type": "StatusColorSelectorGrid", "visible": True}
mainWallet_AddEditAccountPopup_AccountColorSelector = {"container": mainWallet_AddEditAccountPopup_AccountColorComponent, "type": "Repeater", "objectName": "statusColorRepeater", "visible": True, "enabled": True}
mainWallet_AddEditAccountPopup_AccountEmojiPopupButton = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "AddAccountPopup-AccountEmoji", "type": "StatusFlatRoundButton", "visible": True}
Expand Down
3 changes: 3 additions & 0 deletions gui/objects_map/settings_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@
settings_Wallet_MainView_Networks = {"container": statusDesktop_mainWindow, "objectName": "networksItem", "type": "StatusListItem"}
settings_Wallet_MainView_AddNewAccountButton = {"container": statusDesktop_mainWindow, "objectName": "settings_Wallet_MainView_AddNewAccountButton", "type": "StatusButton", "visible": True}
settingsContentBaseScrollView_accountOrderItem_StatusListItem = {"container": settingsContentBase_ScrollView, "objectName": "accountOrderItem", "type": "StatusListItem", "visible": True}
settingsContentBaseScrollView_savedAddressesItem_StatusListItem = {"container": settingsContentBase_ScrollView, "objectName": "savedAddressesItem", "type": "StatusListItem", "visible": True}
settingsContentBaseScrollView_StatusListItem = {"container": settingsContentBase_ScrollView, "type": "StatusListItem", "unnamed": 1, "visible": True}
settings_Wallet_NetworksView_TestNet_Toggle = {"container": statusDesktop_mainWindow, "objectName": "testnetModeSwitch", "type": "StatusSwitch"}
settings_Wallet_NetworksView_TestNet_Toggle_Title = {"container": settingsContentBase_ScrollView, "objectName": "statusListItemSubTitle", "type": "StatusTextWithLoadingState", "visible": True}
settings_Wallet_SavedAddresses_AddAddressButton = {"container": statusDesktop_mainWindow, "objectName": "addNewSavedAddressButton", "type": "StatusButton", "visible": True}
settings_Wallet_SavedAddress_ItemDelegate ={"container": settingsContentBase_ScrollView, "objectName": RegularExpression("savedAddressView_Delegate*"), "type": "SavedAddressesDelegate", "visible": True}
settingsContentBaseScrollView_Goerli_testnet_active_StatusBaseText = {"container": settingsContentBase_ScrollView, "type": "StatusBaseText", "unnamed": 1, "visible": True}
settingsContentBaseScrollView_accountsList_StatusListView = {"container": settingsContentBase_ScrollView, "id": "accountsList", "type": "StatusListView", "unnamed": 1, "visible": True}
settingsContentBaseScrollView_draggableDelegate_StatusDraggableListItem = {"checkable": False, "container": settingsContentBase_ScrollView, "id": "draggableDelegate", "type": "StatusDraggableListItem", "unnamed": 1, "visible": True}
Expand Down
50 changes: 46 additions & 4 deletions gui/screens/settings_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from constants import wallet_account_list_item
from constants.wallet import WalletNetworkSettings, WalletNetworkDefaultValues
from driver import objects_access
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

Expand All @@ -29,23 +30,41 @@ def __init__(self):
self._wallet_settings_add_new_account_button = Button('settings_Wallet_MainView_AddNewAccountButton')
self._wallet_network_button = Button('settings_Wallet_MainView_Networks')
self._account_order_button = Button('settingsContentBaseScrollView_accountOrderItem_StatusListItem')
self._saved_addresses_button = Button('settingsContentBaseScrollView_savedAddressesItem_StatusListItem')
self._status_account_in_keypair = QObject('settingsWalletAccountDelegate_Status_account')
self._wallet_account_from_keypair = QObject('settingsWalletAccountDelegate')
self._wallet_settings_keypair_item = QObject('settingsWalletKeyPairDelegate')
self._wallet_settings_total_balance_item = QObject('settingsWalletAccountTotalBalance')
self._wallet_settings_total_balance_toggle = CheckBox('settingsWalletAccountTotalBalanceToggle')

@allure.step('Open add account pop up in wallet settings')
def open_add_account_pop_up(self):
def open_add_account_pop_up(self, attempts: int = 2) -> 'AccountPopup':
self._wallet_settings_add_new_account_button.click()
return AccountPopup().wait_until_appears()
try:
return AccountPopup()
except Exception as ex:
if attempts:
return self.open_add_account_pop_up(attempts - 1)
else:
raise ex

@allure.step('Open saved addresses in wallet settings')
def open_saved_addresses(self, attempts: int = 2) -> 'SavedAddressesWalletSettings':
self._saved_addresses_button.click()
try:
return SavedAddressesWalletSettings()
except Exception as ex:
if attempts:
return self.open_saved_addresses(attempts - 1)
else:
raise ex

@allure.step('Open networks in wallet settings')
def open_networks(self, attempts: int = 2) -> 'NetworkWalletSettings':
self._wallet_network_button.click()
try:
return NetworkWalletSettings().wait_until_appears()
except AssertionError as err:
except Exception as err:
if attempts:
return self.open_networks(attempts - 1)
else:
Expand Down Expand Up @@ -170,11 +189,34 @@ def click_back_button(self):
self._back_button.click()


class SavedAddressesWalletSettings(WalletSettingsView):
def __init__(self):
super(SavedAddressesWalletSettings, self).__init__()
self.add_new_address_button = Button('settings_Wallet_SavedAddresses_AddAddressButton')
self.saved_address_item = QObject('settings_Wallet_SavedAddress_ItemDelegate')

@allure.step('Click add new address button')
def open_add_saved_address_popup(self, attempt: int = 2) -> 'AddressPopup':
self.add_new_address_button.click()
try:
return AddressPopup()
except AssertionError as err:
if attempt:
self.open_add_saved_address_popup(attempt - 1)
else:
raise err

@allure.step('Get saved addresses names list')
def get_saved_address_names_list(self):
names = [str(address.name) for address in driver.findAllObjects(self.saved_address_item.real_name)]
return names


class NetworkWalletSettings(WalletSettingsView):

def __init__(self):
super(NetworkWalletSettings, self).__init__()
self._testnet_text_item = QObject('settingsContentBaseScrollView_Goerli_testnet_active_StatusBaseText')
self._testnet_text_item = QObject('s')
self._testnet_mode_toggle = Button('settings_Wallet_NetworksView_TestNet_Toggle')
self._testnet_mode_title = TextLabel('settings_Wallet_NetworksView_TestNet_Toggle_Title')
self._back_button = Button('main_toolBar_back_button')
Expand Down
4 changes: 2 additions & 2 deletions gui/screens/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ def address_names(self):
return names

@allure.step('Open add new address popup')
def open_add_address_popup(self, attempt=2) -> 'AddressPopup':
def open_add_saved_address_popup(self, attempt=2) -> 'AddressPopup':
self._add_new_address_button.click()
try:
return AddressPopup().wait_until_appears()
except AssertionError as err:
if attempt:
self.open_add_address_popup(attempt - 1)
self.open_add_saved_address_popup(attempt - 1)
else:
raise err

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import random
import string

import allure
import pytest
from allure_commons._allure import step

from gui.components.toast_message import ToastMessage
from . import marks

import configs
import driver
from gui.main_window import MainWindow

pytestmark = marks


@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704620',
'Saved addresses: Add new saved address (ethereum address)')
@pytest.mark.parametrize('name, address',
[
pytest.param(
''.join(random.choices(string.ascii_letters, k=24)),
'0x8397bc3c5a60a1883174f722403d63a8833312b7')
])
# @pytest.mark.case(704620) TODO: enable that after i test multiple references
def test_wallet_settings_add_saved_address(main_screen: MainWindow, address: str, name: str):
with (step('Open wallet settings - Saved addresses section')):
settings_saved_addresses = \
main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_saved_addresses()

with step('Click Add new address button and open add saved address popup'):
add_saved_address_popup = settings_saved_addresses.open_add_saved_address_popup()

with step('Fill in the form and preferred networks and add the address'):
add_saved_address_popup.add_saved_address(name, address)

with step('Verify toast message when adding saved address'):
messages = ToastMessage().get_toast_messages
assert f'{name} successfully added to your saved addresses' in messages, \
f"Toast message about adding saved address is not correct or not present. \
Current list of messages: {messages}"

with step('Verify recently added saved address is present in the list'):
assert driver.waitFor(
lambda: name in settings_saved_addresses.get_saved_address_names_list(),
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), f'Address: {name} not found'
2 changes: 2 additions & 0 deletions tests/settings/test_settings_sign_out_and_quit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703010', 'Settings - Sign out & Quit')
# TODO: Experimental link for testing multiple references in test rail report by nightly job. Has to be removed!
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704620', 'Wallet -> Settings -> Saved addresses: Add new saved address')
@pytest.mark.case(703010)
@pytest.mark.case(704620)
@pytest.mark.flaky
# reason='https://github.com/status-im/status-desktop/issues/13013'
def test_sign_out_and_quit(aut, main_screen: MainWindow):
Expand Down
2 changes: 1 addition & 1 deletion tests/wallet_main_screen/test_saved_addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_manage_saved_address(main_screen: MainWindow, name: str, address: str,
with step('Add new address'):
wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().confirm_phrase()
wallet.left_panel.open_saved_addresses().open_add_address_popup().add_saved_address(name, address)
wallet.left_panel.open_saved_addresses().open_add_saved_address_popup().add_saved_address(name, address)

with step('Verify toast message when adding saved address'):
messages = ToastMessage().get_toast_messages
Expand Down