fix(@wallet_manage_accounts_test): fix test for watched address (#162)
* fix(@wallet_manage_accounts_test): fix test for watched address * Start squish server on new port --------- Co-authored-by: Vladimir Druzhinin <vlado@status.im>
This commit is contained in:
parent
4e22a69423
commit
0b09050410
|
@ -1,2 +1,3 @@
|
|||
AUT_PORT = 61500
|
||||
MAX_INSTANCES = 3
|
||||
SERVET_PORT = 4322
|
||||
|
|
|
@ -19,7 +19,7 @@ class AUT:
|
|||
self,
|
||||
app_path: system_path.SystemPath = configs.APP_DIR,
|
||||
host: str = '127.0.0.1',
|
||||
port: int = configs.squish.AUT_PORT,
|
||||
port: int = local_system.find_free_port(configs.squish.AUT_PORT, 1000),
|
||||
user_data: SystemPath = None
|
||||
):
|
||||
super(AUT, self).__init__()
|
||||
|
@ -71,8 +71,6 @@ class AUT:
|
|||
SquishServer().set_aut_timeout()
|
||||
|
||||
if configs.ATTACH_MODE:
|
||||
while local_system.find_process_by_port(self.port):
|
||||
self.port += 1000
|
||||
SquishServer().add_attachable_aut(self.aut_id, self.port)
|
||||
command = [
|
||||
configs.testpath.SQUISH_DIR / 'bin' / 'startaut',
|
||||
|
|
|
@ -14,7 +14,7 @@ class SquishServer:
|
|||
def __init__(
|
||||
self,
|
||||
host: str = '127.0.0.1',
|
||||
port: int = 4322
|
||||
port: int = local_system.find_free_port(configs.squish.SERVET_PORT, 100)
|
||||
):
|
||||
self.path = configs.testpath.SQUISH_DIR / 'bin' / 'squishserver'
|
||||
self.config = configs.testpath.ROOT / 'squish_server.ini'
|
||||
|
|
|
@ -21,3 +21,4 @@ def start_squish_server():
|
|||
squish_server.stop()
|
||||
if squish_server.config.exists():
|
||||
allure.attach.file(str(squish_server.config), 'Squish server config')
|
||||
squish_server.config.unlink()
|
||||
|
|
|
@ -8,8 +8,23 @@ class ContextMenu(QObject):
|
|||
def __init__(self):
|
||||
super(ContextMenu, self).__init__('contextMenu_PopupItem')
|
||||
self._menu_item = QObject('contextMenuItem')
|
||||
self._context_add_watched_address_option = QObject('contextMenuItem_AddWatchOnly')
|
||||
self._context_delete_account_option = QObject('contextMenuItem_Delete')
|
||||
self._context_edit_account_option = QObject('contextMenuItem_Edit')
|
||||
|
||||
@allure.step('Select in context menu')
|
||||
def select(self, value: str):
|
||||
self._menu_item.real_name['text'] = value
|
||||
self._menu_item.click()
|
||||
|
||||
@allure.step('Select add watched address option from context menu')
|
||||
def select_add_watched_address_from_context_menu(self):
|
||||
self._context_add_watched_address_option.click()
|
||||
|
||||
@allure.step('Select delete account option from context menu')
|
||||
def select_delete_account_from_context_menu(self):
|
||||
self._context_delete_account_option.click()
|
||||
|
||||
@allure.step('Select edit account option from context menu')
|
||||
def select_edit_account_from_context_menu(self):
|
||||
self._context_edit_account_option.click()
|
||||
|
|
|
@ -165,7 +165,9 @@ mainWallet_Saved_Addresses_Popup_Network_Selector_Arbitrum_network_tag = {"conta
|
|||
# Context Menu
|
||||
contextMenu_PopupItem = {"container": statusDesktop_mainWindow_overlay, "type": "PopupItem", "unnamed": 1, "visible": True}
|
||||
contextMenuItem = {"container": statusDesktop_mainWindow_overlay, "type": "StatusBaseText", "unnamed": 1, "visible": True}
|
||||
|
||||
contextMenuItem_AddWatchOnly = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-AddWatchOnlyAccountAction*"), "type": "StatusMenuItem"}
|
||||
contextMenuItem_Delete = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-DeleteAction*"), "type": "StatusMenuItem"}
|
||||
contextMenuItem_Edit = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-EditAction*"), "type": "StatusMenuItem"}
|
||||
# Confirmation Popup
|
||||
confirmButton = {"container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("confirm*"), "type": "StatusButton"}
|
||||
|
||||
|
|
|
@ -82,14 +82,14 @@ class LeftPanel(QObject):
|
|||
self._wallet_account_item.wait_until_appears().open_context_menu()
|
||||
return ContextMenu().wait_until_appears()
|
||||
|
||||
@allure.step('Open account popup for editing')
|
||||
def open_edit_account_popup(self, account_name: str, attempt: int = 2) -> AccountPopup:
|
||||
@allure.step('Open account popup for editing from context menu')
|
||||
def open_edit_account_popup_from_context_menu(self, account_name: str, attempt: int = 2) -> AccountPopup:
|
||||
try:
|
||||
self._open_context_menu_for_account(account_name).select('Edit')
|
||||
self._open_context_menu_for_account(account_name).select_edit_account_from_context_menu()
|
||||
return AccountPopup().wait_until_appears()
|
||||
except:
|
||||
if attempt:
|
||||
return self.open_edit_account_popup(account_name, attempt - 1)
|
||||
return self.open_edit_account_popup_from_context_menu(account_name, attempt - 1)
|
||||
else:
|
||||
raise
|
||||
|
||||
|
@ -104,25 +104,19 @@ class LeftPanel(QObject):
|
|||
else:
|
||||
raise err
|
||||
|
||||
@allure.step('Open account popup for watch only account')
|
||||
def open_add_watch_only_account_popup(self, attempt: int = 2) -> AccountPopup:
|
||||
try:
|
||||
self._open_context_menu().select('Add watch-only account')
|
||||
@allure.step('Select add watched address from context menu')
|
||||
def select_add_watched_address_from_context_menu(self) -> AccountPopup:
|
||||
self._open_context_menu().select_add_watched_address_from_context_menu()
|
||||
return AccountPopup().wait_until_appears()
|
||||
except:
|
||||
if attempt:
|
||||
return self.open_add_watch_only_account_popup(attempt - 1)
|
||||
else:
|
||||
raise
|
||||
|
||||
@allure.step('Delete account from list')
|
||||
def delete_account(self, account_name: str, attempt: int = 2) -> RemoveWalletAccountPopup:
|
||||
@allure.step('Delete account from the list from context menu')
|
||||
def delete_account_from_context_menu(self, account_name: str, attempt: int = 2) -> RemoveWalletAccountPopup:
|
||||
try:
|
||||
self._open_context_menu_for_account(account_name).select('Delete')
|
||||
self._open_context_menu_for_account(account_name).select_delete_account_from_context_menu()
|
||||
return RemoveWalletAccountPopup().wait_until_appears()
|
||||
except:
|
||||
if attempt:
|
||||
return self.delete_account(account_name, attempt - 1)
|
||||
return self.delete_account_from_context_menu(account_name, attempt - 1)
|
||||
else:
|
||||
raise
|
||||
|
||||
|
|
|
@ -23,6 +23,12 @@ def find_process_by_port(port: int) -> int:
|
|||
pass
|
||||
|
||||
|
||||
def find_free_port(start: int, step: int):
|
||||
while find_process_by_port(start):
|
||||
start+=step
|
||||
return start
|
||||
|
||||
|
||||
def wait_for_close(pid: int, timeout_sec: int = configs.timeouts.PROCESS_TIMEOUT_SEC):
|
||||
started_at = time.monotonic()
|
||||
while True:
|
||||
|
|
|
@ -27,7 +27,7 @@ def test_edit_default_wallet_account(main_screen: MainWindow, name: str, new_nam
|
|||
wallet.left_panel.select_account(name)
|
||||
|
||||
with step('Edit wallet account'):
|
||||
account_popup = wallet.left_panel.open_edit_account_popup(name)
|
||||
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
|
||||
account_popup.set_name(new_name).set_emoji(new_emoji).set_color(new_color).save()
|
||||
|
||||
with step('Verify that the account is correctly displayed in accounts list'):
|
||||
|
@ -64,19 +64,19 @@ def test_manage_watch_only_account(main_screen: MainWindow, address: str, color:
|
|||
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
|
||||
|
||||
with step('Delete wallet account'):
|
||||
wallet.left_panel.delete_account(name).confirm()
|
||||
wallet.left_panel.delete_account_from_context_menu(name).confirm()
|
||||
|
||||
with step('Verify that the account is not displayed in accounts list'):
|
||||
assert driver.waitFor(lambda: name not in [account.name for account in wallet.left_panel.accounts], 10000), \
|
||||
f'Account with {name} is still displayed even it should not be'
|
||||
|
||||
with step('Create watch-only wallet account via context menu'):
|
||||
account_popup = wallet.left_panel.open_add_watch_only_account_popup()
|
||||
account_popup = wallet.left_panel.select_add_watched_address_from_context_menu()
|
||||
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_eth_address(address).save()
|
||||
account_popup.wait_until_hidden()
|
||||
|
||||
with step('Edit wallet account'):
|
||||
account_popup = wallet.left_panel.open_edit_account_popup(name)
|
||||
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
|
||||
account_popup.set_name(new_name).set_emoji(new_emoji).set_color(new_color).save()
|
||||
|
||||
with step('Verify that the account is correctly displayed in accounts list'):
|
||||
|
@ -116,7 +116,7 @@ def test_manage_generated_account(main_screen: MainWindow, user_account,
|
|||
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
|
||||
|
||||
with step('Edit wallet account'):
|
||||
account_popup = wallet.left_panel.open_edit_account_popup(name)
|
||||
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
|
||||
account_popup.set_name(new_name).set_emoji(new_emoji).set_color(new_color).save()
|
||||
|
||||
with step('Verify that the account is correctly displayed in accounts list'):
|
||||
|
@ -128,7 +128,7 @@ def test_manage_generated_account(main_screen: MainWindow, user_account,
|
|||
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
|
||||
|
||||
with step('Delete wallet account with agreement'):
|
||||
wallet.left_panel.delete_account(new_name).agree_and_confirm()
|
||||
wallet.left_panel.delete_account_from_context_menu(new_name).agree_and_confirm()
|
||||
|
||||
with step('Verify that the account is not displayed in accounts list'):
|
||||
assert driver.waitFor(lambda: new_name not in [account.name for account in wallet.left_panel.accounts], 10000), \
|
||||
|
@ -165,7 +165,7 @@ def test_manage_custom_generated_account(main_screen: MainWindow, user_account,
|
|||
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
|
||||
|
||||
with step('Delete wallet account with agreement'):
|
||||
wallet.left_panel.delete_account(name).agree_and_confirm()
|
||||
wallet.left_panel.delete_account_from_context_menu(name).agree_and_confirm()
|
||||
|
||||
with step('Verify that the account is not displayed in accounts list'):
|
||||
assert driver.waitFor(lambda: name not in [account.name for account in wallet.left_panel.accounts], 10000), \
|
||||
|
@ -202,7 +202,7 @@ def test_private_key_imported_account(main_screen: MainWindow, user_account,
|
|||
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
|
||||
|
||||
with step('Edit wallet account'):
|
||||
account_popup = wallet.left_panel.open_edit_account_popup(name)
|
||||
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
|
||||
account_popup.set_name(new_name).set_emoji(new_emoji).set_color(new_color).save()
|
||||
|
||||
with step('Verify that the account is correctly displayed in accounts list'):
|
||||
|
@ -214,7 +214,7 @@ def test_private_key_imported_account(main_screen: MainWindow, user_account,
|
|||
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
|
||||
|
||||
with step('Delete wallet account'):
|
||||
wallet.left_panel.delete_account(new_name).confirm()
|
||||
wallet.left_panel.delete_account_from_context_menu(new_name).confirm()
|
||||
|
||||
with step('Verify that the account is not displayed in accounts list'):
|
||||
assert driver.waitFor(lambda: new_name not in [account.name for account in wallet.left_panel.accounts], 10000), \
|
||||
|
@ -260,7 +260,7 @@ def test_seed_phrase_imported_account(main_screen: MainWindow, user_account,
|
|||
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
|
||||
|
||||
with step('Edit wallet account'):
|
||||
account_popup = wallet.left_panel.open_edit_account_popup(name)
|
||||
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
|
||||
account_popup.set_name(new_name).set_emoji(new_emoji).set_color(new_color).save()
|
||||
|
||||
with step('Verify that the account is correctly displayed in accounts list'):
|
||||
|
@ -272,7 +272,7 @@ def test_seed_phrase_imported_account(main_screen: MainWindow, user_account,
|
|||
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
|
||||
|
||||
with step('Delete wallet account with agreement'):
|
||||
wallet.left_panel.delete_account(new_name).agree_and_confirm()
|
||||
wallet.left_panel.delete_account_from_context_menu(new_name).agree_and_confirm()
|
||||
|
||||
with step('Verify that the account is not displayed in accounts list'):
|
||||
assert driver.waitFor(lambda: new_name not in [account.name for account in wallet.left_panel.accounts], 10000), \
|
||||
|
@ -308,7 +308,7 @@ def test_seed_phrase_generated_account(main_screen: MainWindow, user_account,
|
|||
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
|
||||
|
||||
with step('Edit wallet account'):
|
||||
account_popup = wallet.left_panel.open_edit_account_popup(name)
|
||||
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
|
||||
account_popup.set_name(new_name).set_emoji(new_emoji).set_color(new_color).save()
|
||||
|
||||
with step('Verify that the account is correctly displayed in accounts list'):
|
||||
|
@ -320,7 +320,7 @@ def test_seed_phrase_generated_account(main_screen: MainWindow, user_account,
|
|||
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
|
||||
|
||||
with step('Delete wallet account with agreement'):
|
||||
wallet.left_panel.delete_account(new_name).agree_and_confirm()
|
||||
wallet.left_panel.delete_account_from_context_menu(new_name).agree_and_confirm()
|
||||
|
||||
with step('Verify that the account is not displayed in accounts list'):
|
||||
assert driver.waitFor(lambda: new_name not in [account.name for account in wallet.left_panel.accounts], 10000), \
|
||||
|
|
Loading…
Reference in New Issue