chore(@e2e): various fixes for tests

This commit is contained in:
Anastasiya 2024-10-24 18:45:38 +03:00 committed by Anastasiya
parent 4409c20264
commit ca1182e3f9
24 changed files with 80 additions and 104 deletions

View File

@ -32,8 +32,7 @@ pytest_plugins = [
def setup_session_scope( def setup_session_scope(
init_testrail_api, init_testrail_api,
prepare_test_directory, prepare_test_directory,
start_squish_server, start_squish_server
close_apps_before_start
): ):
LOG.info('Session startup...') LOG.info('Session startup...')
yield yield

View File

@ -1,3 +1,4 @@
import os
import time import time
import allure import allure
@ -96,6 +97,7 @@ class AUT:
def startaut(self): def startaut(self):
LOG.info('Launching AUT: %s', self.path) LOG.info('Launching AUT: %s', self.path)
self.port = local_system.find_free_port(configs.squish.AUT_PORT, 100) self.port = local_system.find_free_port(configs.squish.AUT_PORT, 100)
command = [ command = [
str(configs.testpath.SQUISH_DIR / 'bin/startaut'), str(configs.testpath.SQUISH_DIR / 'bin/startaut'),
'--verbose', '--verbose',

View File

@ -92,14 +92,3 @@ def main_screen(user_account: UserAccount, main_window: MainWindow) -> MainWindo
main_window.authorize_user(user_account) main_window.authorize_user(user_account)
return main_window return main_window
@pytest.fixture(scope="session")
def close_apps_before_start():
if get_platform() == "Windows":
name = 'Status.exe'
else:
name = 'nim_status_client'
running_pids = get_pid_by_process_name(name)
if running_pids is not None:
for pid in running_pids:
kill_process(pid)

View File

@ -27,8 +27,7 @@ class AuthenticatePopup(BasePopup):
def authenticate(self, password: str): def authenticate(self, password: str):
self._password_text_edit.type_text(password) self._password_text_edit.type_text(password)
# TODO https://github.com/status-im/status-desktop/issues/15345 # TODO https://github.com/status-im/status-desktop/issues/15345
self._primary_button.click(timeout=60) self._primary_button.click()
self._authenticate_button.wait_until_hidden(10000)
@allure.step('Check if authenticate button is present') @allure.step('Check if authenticate button is present')
def is_authenticate_button_visible(self): def is_authenticate_button_visible(self):

View File

@ -118,7 +118,7 @@ class ProfilePopupFromMembers(ProfilePopup):
@allure.step('Click review contact request button') @allure.step('Click review contact request button')
def review_contact_request(self): def review_contact_request(self):
assert driver.waitFor(lambda: self._review_request_button.is_visible, 15000) self._review_request_button.wait_until_appears(15000)
self._review_request_button.click() self._review_request_button.click()
return AcceptRequestFromProfile().wait_until_appears() return AcceptRequestFromProfile().wait_until_appears()

View File

@ -28,5 +28,5 @@ class RemoveWalletAccountPopup(BasePopup):
@allure.step('Agree and confirm removing account') @allure.step('Agree and confirm removing account')
def agree_and_confirm(self): def agree_and_confirm(self):
self._have_pen_paper_checkbox.wait_until_appears().set(True) self._have_pen_paper_checkbox.set(True)
self.confirm() self.confirm()

View File

@ -47,7 +47,7 @@ class AccountPopup(BasePopup):
self._non_eth_checkbox = CheckBox(names.mainWallet_AddEditAccountPopup_NonEthDerivationPathCheckBox) self._non_eth_checkbox = CheckBox(names.mainWallet_AddEditAccountPopup_NonEthDerivationPathCheckBox)
def verify_add_account_popup_present(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC): def verify_add_account_popup_present(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
driver.waitFor(lambda: self._popup_header_title.exists, timeout_msec) driver.waitFor(lambda: self._popup_header_title.is_visible, timeout_msec)
assert (getattr(self._popup_header_title.object, 'text') assert (getattr(self._popup_header_title.object, 'text')
== WalletScreensHeaders.WALLET_ADD_ACCOUNT_POPUP_TITLE.value), \ == WalletScreensHeaders.WALLET_ADD_ACCOUNT_POPUP_TITLE.value), \
f"AccountPopup is not shown or has wrong title, \ f"AccountPopup is not shown or has wrong title, \

View File

@ -21,7 +21,12 @@ class QObject:
@property @property
@allure.step('Get object {0}') @allure.step('Get object {0}')
def object(self): def object(self):
return driver.waitForObject(self.real_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC) try:
obj = driver.waitForObject(self.real_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
except LookupError:
raise LookupError(f"Object {self.real_name} was not found within {configs.timeouts.UI_LOAD_TIMEOUT_MSEC}")
return obj
def set_text_property(self, text): def set_text_property(self, text):
self.object.forceActiveFocus() self.object.forceActiveFocus()

View File

@ -19,6 +19,7 @@ class TextEdit(QObject):
@text.setter @text.setter
@allure.step('Type text {1} {0}') @allure.step('Type text {1} {0}')
def text(self, value: str): def text(self, value: str):
if self.text:
self.clear() self.clear()
self.type_text(value) self.type_text(value)
assert driver.waitFor(lambda: self.text == value, configs.timeouts.UI_LOAD_TIMEOUT_MSEC), \ assert driver.waitFor(lambda: self.text == value, configs.timeouts.UI_LOAD_TIMEOUT_MSEC), \

View File

@ -228,4 +228,5 @@ class MainWindow(Window):
return ToastMessage().get_toast_messages() return ToastMessage().get_toast_messages()
except LookupError as err: except LookupError as err:
LOG.info(err) LOG.info(err)
assert time.monotonic() - started_at < timeout_msec, str(err) if time.monotonic() - started_at > timeout_msec:
raise LookupError(f'Notifications are not found')

View File

@ -106,7 +106,7 @@ copy_icon_CopyButton = {"container": ProfileContentItem, "objectName": "copy-ico
request_ID_verification_StatusFlatButton = {"checkable": False, "container": ProfileContentItem, "objectName": "requestIDVerification_StatusItem", "type": "StatusFlatButton", "visible": True} request_ID_verification_StatusFlatButton = {"checkable": False, "container": ProfileContentItem, "objectName": "requestIDVerification_StatusItem", "type": "StatusFlatButton", "visible": True}
send_Message_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "sendMessageButton", "type": "StatusButton", "visible": True} send_Message_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "sendMessageButton", "type": "StatusButton", "visible": True}
send_contact_request_StatusButton = {"checkable": False, "container": ProfileContentItem, "objectName": "profileDialog_sendContactRequestButton", "type": "StatusButton", "visible": True} send_contact_request_StatusButton = {"checkable": False, "container": ProfileContentItem, "objectName": "profileDialog_sendContactRequestButton", "type": "StatusButton", "visible": True}
review_contact_request_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "profileDialog_reviewContactRequestButton", "type": "StatusButton", "visible": True} review_contact_request_StatusButton = {"checkable": False, "container": ProfileContentItem, "objectName": "profileDialog_reviewContactRequestButton", "type": "StatusButton", "visible": True}
profileDialogView_ContentItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialogView", "type": "ContentItem", "visible": True} profileDialogView_ContentItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialogView", "type": "ContentItem", "visible": True}
menuButton_StatusFlatButton = {"checkable": False, "container": profileDialogView_ContentItem, "id": "menuButton", "type": "StatusFlatButton", "unnamed": 1, "visible": True} menuButton_StatusFlatButton = {"checkable": False, "container": profileDialogView_ContentItem, "id": "menuButton", "type": "StatusFlatButton", "unnamed": 1, "visible": True}
block_user_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "blockUserStatusAction", "type": "StatusMenuItem", "visible": True} block_user_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "blockUserStatusAction", "type": "StatusMenuItem", "visible": True}

View File

@ -50,7 +50,7 @@ class LeftPanel(QObject):
def accounts(self) -> typing.List[constants.user.account_list_item]: def accounts(self) -> typing.List[constants.user.account_list_item]:
if 'title' in self._wallet_account_item.real_name.keys(): if 'title' in self._wallet_account_item.real_name.keys():
del self._wallet_account_item.real_name['title'] del self._wallet_account_item.real_name['title']
time.sleep(1) # to give a chance to build the list time.sleep(1) # to give a chance for the left panel to refresh
raw_data = driver.findAllObjects(self._wallet_account_item.real_name) raw_data = driver.findAllObjects(self._wallet_account_item.real_name)
accounts = [] accounts = []
if len(raw_data) > 0: if len(raw_data) > 0:
@ -98,8 +98,8 @@ class LeftPanel(QObject):
existing_accounts_names = [account.name for account in account_items] existing_accounts_names = [account.name for account in account_items]
if account_name in existing_accounts_names: if account_name in existing_accounts_names:
self._wallet_account_item.real_name['title'] = account_name self._wallet_account_item.real_name['title'] = account_name
time.sleep(0.5)
self._wallet_account_item.click() self._wallet_account_item.click()
time.sleep(0.5)
self._wallet_account_item.right_click() self._wallet_account_item.right_click()
return ContextMenu() return ContextMenu()
else: else:

View File

@ -9,6 +9,7 @@ from gui.components.signing_phrase_popup import SigningPhrasePopup
with step('Authenticate user action with password'): with step('Authenticate user action with password'):
def authenticate_with_password(user_account): def authenticate_with_password(user_account):
AuthenticatePopup().wait_until_appears().authenticate(user_account.password) AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
AuthenticatePopup().wait_until_hidden()
with step('Close signing phrase popup and open wallet send popup'): with step('Close signing phrase popup and open wallet send popup'):
def open_send_modal_for_account(main_window, account_name): def open_send_modal_for_account(main_window, account_name):

View File

@ -65,7 +65,7 @@ def random_mnemonic():
return words return words
def random_wallet_account_name(): def random_wallet_acc_keypair_name():
return ''.join((random.choice( return ''.join((random.choice(
string.ascii_letters + string.digits) string.ascii_letters + string.digits)
for _ in range(5, 21))) for _ in range(5, 21)))

View File

@ -38,7 +38,7 @@ def test_manage_community_screens_overview(main_screen: MainWindow):
assert airdrops_screen.is_new_airdrop_button_present is True, \ assert airdrops_screen.is_new_airdrop_button_present is True, \
f'New airdrop button should be disabled by default' f'New airdrop button should be disabled by default'
with step('Airdrops welcome image source path is correct'): with step('Airdrops welcome image source path is correct'):
assert AIRDROPS_WELCOME_IMAGE_PATH == str(airdrops_screen.airdrops_welcome_image_path) assert AIRDROPS_WELCOME_IMAGE_PATH in str(airdrops_screen.airdrops_welcome_image_path)
with step('Airdrops welcome title is correct'): with step('Airdrops welcome title is correct'):
assert airdrops_screen.airdrops_welcome_title == AirdropsElements.WELCOME_TITLE.value assert airdrops_screen.airdrops_welcome_title == AirdropsElements.WELCOME_TITLE.value
with step('Airdrops welcome subtitle is correct'): with step('Airdrops welcome subtitle is correct'):
@ -60,7 +60,7 @@ def test_manage_community_screens_overview(main_screen: MainWindow):
assert tokens_screen.is_mint_token_button_present is True, \ assert tokens_screen.is_mint_token_button_present is True, \
f'Mint token button should be present' f'Mint token button should be present'
with step('Tokens welcome image path is correct'): with step('Tokens welcome image path is correct'):
assert TOKENS_WELCOME_IMAGE_PATH == str(tokens_screen.tokens_welcome_image_path) assert TOKENS_WELCOME_IMAGE_PATH in str(tokens_screen.tokens_welcome_image_path)
with step('Tokens welcome title is correct'): with step('Tokens welcome title is correct'):
assert tokens_screen.tokens_welcome_title == TokensElements.WELCOME_TITLE.value assert tokens_screen.tokens_welcome_title == TokensElements.WELCOME_TITLE.value
with step('Tokens welcome subtitle is correct'): with step('Tokens welcome subtitle is correct'):
@ -83,7 +83,7 @@ def test_manage_community_screens_overview(main_screen: MainWindow):
assert permissions_settings.is_add_new_permission_button_present is True, \ assert permissions_settings.is_add_new_permission_button_present is True, \
f'Add new permission button should be visible' f'Add new permission button should be visible'
with step('Permission welcome image source path is correct'): with step('Permission welcome image source path is correct'):
assert PERMISSION_WELCOME_IMAGE_PATH == str(permissions_settings.permission_welcome_image_source) assert PERMISSION_WELCOME_IMAGE_PATH in str(permissions_settings.permission_welcome_image_source)
with step('Permission welcome title is correct'): with step('Permission welcome title is correct'):
assert permissions_settings.permission_welcome_title == PermissionsElements.WELCOME_TITLE.value assert permissions_settings.permission_welcome_title == PermissionsElements.WELCOME_TITLE.value
with step('Permission welcome subtitle is correct'): with step('Permission welcome subtitle is correct'):

View File

@ -133,14 +133,14 @@ def test_communities_send_accept_decline_request_remove_contact_from_profile(mul
assert driver.waitFor(lambda: not community_screen.left_panel.is_join_community_visible, assert driver.waitFor(lambda: not community_screen.left_panel.is_join_community_visible,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Join community button not hidden' configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Join community button not hidden'
with step(f'User {user_one.name} send contact request to {user_three.name} from user profile'): with step(f'User {user_one.name} send contact request to {user_three.name} from user profile from members list'):
community_screen = main_screen.left_panel.select_community(community.name) community_screen = main_screen.left_panel.select_community(community.name)
profile_popup = community_screen.right_panel.click_member(user_three.name) profile_popup = community_screen.right_panel.click_member(user_three.name)
profile_popup.send_request().send(f'Hello {user_three.name}') profile_popup.send_request().send(f'Hello {user_three.name}')
ProfilePopupFromMembers().wait_until_appears() ProfilePopupFromMembers().wait_until_appears()
main_screen.hide() main_screen.hide()
with step(f'User {user_three.name}, accept contact request from {user_one.name} from user profile'): with step(f'User {user_three.name}, accept contact request from {user_one.name} from user profile from members list'):
aut_three.attach() aut_three.attach()
main_screen.prepare() main_screen.prepare()
community_screen = main_screen.left_panel.select_community(community.name) community_screen = main_screen.left_panel.select_community(community.name)
@ -166,7 +166,8 @@ def test_communities_send_accept_decline_request_remove_contact_from_profile(mul
with step(f'User {user_three.name}, decline contact request from user profile {user_one.name}'): with step(f'User {user_three.name}, decline contact request from user profile {user_one.name}'):
aut_three.attach() aut_three.attach()
main_screen.prepare() main_screen.prepare()
profile_popup.review_contact_request().decline() profile_decline = community_screen.right_panel.click_member(user_one.name)
profile_decline.review_contact_request().decline()
with step(f'User {user_three.name} verify that send request button is available again in profile popup'): with step(f'User {user_three.name} verify that send request button is available again in profile popup'):
assert driver.waitFor(lambda: profile_popup.is_send_request_button_visible, assert driver.waitFor(lambda: profile_popup.is_send_request_button_visible,

View File

@ -6,7 +6,7 @@ from allure_commons._allure import step
from constants import RandomUser from constants import RandomUser
from helpers.WalletHelper import authenticate_with_password from helpers.WalletHelper import authenticate_with_password
from scripts.utils.generators import random_wallet_account_name from scripts.utils.generators import random_wallet_acc_keypair_name
import constants import constants
import driver import driver
@ -19,18 +19,10 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703033', 'Manage a generated account') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703033', 'Manage a generated account')
@pytest.mark.case(703033) @pytest.mark.case(703033)
@pytest.mark.parametrize('color, emoji, emoji_unicode, '
'new_color, new_emoji, new_emoji_unicode', [
pytest.param('#2a4af5', 'sunglasses', '1f60e',
'#216266', 'thumbsup', '1f44d')
])
@pytest.mark.critical @pytest.mark.critical
def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account, def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account,):
color: str, emoji: str, emoji_unicode: str,
new_color: str, new_emoji: str,
new_emoji_unicode: str):
with step('Create generated wallet account'): with step('Create generated wallet account'):
name = random_wallet_account_name() name = random_wallet_acc_keypair_name()
wallet = main_screen.left_panel.open_wallet() wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase() SigningPhrasePopup().wait_until_appears().confirm_phrase()
account_popup = wallet.left_panel.open_add_account_popup() account_popup = wallet.left_panel.open_add_account_popup()
@ -53,9 +45,9 @@ def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account
raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}') raise LookupError(f'Account {expected_account} not found in {wallet.left_panel.accounts}')
with step('Edit wallet account'): with step('Edit wallet account'):
new_name = random_wallet_account_name() new_name = random_wallet_acc_keypair_name()
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name) account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
account_popup.set_name(new_name).set_color(new_color).save_changes() account_popup.set_name(new_name).save_changes()
with step('Verify that the account is correctly displayed in accounts list'): with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(new_name, None, None) expected_account = constants.user.account_list_item(new_name, None, None)

View File

@ -5,10 +5,9 @@ import allure
import pytest import pytest
from allure_commons._allure import step from allure_commons._allure import step
from constants import RandomUser
from constants.wallet import WalletRenameKeypair, WalletAccountPopup from constants.wallet import WalletRenameKeypair, WalletAccountPopup
from helpers.WalletHelper import authenticate_with_password from helpers.WalletHelper import authenticate_with_password
from scripts.utils.generators import random_wallet_account_name from scripts.utils.generators import random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks from tests.wallet_main_screen import marks
import constants import constants
@ -35,7 +34,7 @@ def test_rename_keypair_test(main_screen: MainWindow, user_account, emoji: str,
wallet = main_screen.left_panel.open_wallet() wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase() SigningPhrasePopup().wait_until_appears().confirm_phrase()
account_popup = wallet.left_panel.open_add_account_popup() account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(random_wallet_account_name()).set_emoji(emoji) account_popup.set_name(random_wallet_acc_keypair_name()).set_emoji(emoji)
with step('Enter private key name less than 5 characters and verify that error appears'): with step('Enter private key name less than 5 characters and verify that error appears'):
pk_name_short = ''.join(random.choices(string.ascii_letters + string.digits, k=4)) pk_name_short = ''.join(random.choices(string.ascii_letters + string.digits, k=4))

View File

@ -19,6 +19,7 @@ pytestmark = marks
pytest.param(WalletNetworkSettings.EDIT_NETWORK_LIVE_TAB.value), pytest.param(WalletNetworkSettings.EDIT_NETWORK_LIVE_TAB.value),
pytest.param(WalletNetworkSettings.EDIT_NETWORK_TEST_TAB.value) pytest.param(WalletNetworkSettings.EDIT_NETWORK_TEST_TAB.value)
]) ])
@pytest.mark.xfail(reason="https://github.com/status-im/status-desktop/issues/16613")
def test_settings_networks_edit_restore_defaults(main_screen: MainWindow, network_tab: str): 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() networks = main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_networks()

View File

@ -5,6 +5,7 @@ import pytest
from allure import step from allure import step
from helpers.WalletHelper import authenticate_with_password from helpers.WalletHelper import authenticate_with_password
from scripts.utils.generators import random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks from tests.wallet_main_screen import marks
import constants import constants
@ -17,18 +18,15 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703036', @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703036',
'Manage an account created from the generated seed phrase') 'Manage an account created from the generated seed phrase')
@pytest.mark.case(703036) @pytest.mark.case(703036)
@pytest.mark.parametrize('name, color, emoji, emoji_unicode, keypair_name', [ def test_plus_button_manage_account_added_for_new_seed(main_screen: MainWindow, user_account):
pytest.param('SPAcc', '#2a4af5', 'sunglasses', '1f60e', name = random_wallet_acc_keypair_name()
'SPKeyPair')]) keypair_name = random_wallet_acc_keypair_name()
def test_plus_button_manage_account_added_for_new_seed(main_screen: MainWindow, user_account,
name: str, color: str, emoji: str,
emoji_unicode: str,
keypair_name: str):
with step('Create generated seed phrase wallet account'): with step('Create generated seed phrase wallet account'):
wallet = main_screen.left_panel.open_wallet() wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase() SigningPhrasePopup().wait_until_appears().confirm_phrase()
account_popup = wallet.left_panel.open_add_account_popup() account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_new_seed_phrase( account_popup.set_name(name).set_origin_new_seed_phrase(
keypair_name).save_changes() keypair_name).save_changes()
authenticate_with_password(user_account) authenticate_with_password(user_account)
account_popup.wait_until_hidden() account_popup.wait_until_hidden()
@ -40,7 +38,7 @@ def test_plus_button_manage_account_added_for_new_seed(main_screen: MainWindow,
assert message == f'"{name}" successfully added' assert message == f'"{name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'): with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode) expected_account = constants.user.account_list_item(name, None, None)
started_at = time.monotonic() started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts: while expected_account not in wallet.left_panel.accounts:
time.sleep(1) time.sleep(1)

View File

@ -5,6 +5,7 @@ import pytest
from allure_commons._allure import step from allure_commons._allure import step
from helpers.WalletHelper import authenticate_with_password from helpers.WalletHelper import authenticate_with_password
from scripts.utils.generators import random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks from tests.wallet_main_screen import marks
import constants import constants
@ -18,20 +19,16 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703029', 'Manage a private key imported account') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703029', 'Manage a private key imported account')
@pytest.mark.case(703029) @pytest.mark.case(703029)
@pytest.mark.parametrize('address_pair', [constants.user.private_key_address_pair_1]) @pytest.mark.parametrize('address_pair', [constants.user.private_key_address_pair_1])
@pytest.mark.parametrize('name, color, emoji, emoji_unicode, ' def test_plus_button_manage_account_from_private_key(main_screen: MainWindow, user_account, address_pair):
'new_name, new_color, new_emoji, new_emoji_unicode', [
pytest.param('PrivKeyAcc1', '#2a4af5', 'sunglasses', '1f60e', name = random_wallet_acc_keypair_name()
'PrivKeyAcc1edited', '#216266', 'thumbsup', '1f44d') new_name = random_wallet_acc_keypair_name()
])
def test_plus_button_manage_account_from_private_key(main_screen: MainWindow, user_account, address_pair,
name: str, color: str, emoji: str, emoji_unicode: str,
new_name: str, new_color: str, new_emoji: str,
new_emoji_unicode: str):
with step('Import an account within private key'): with step('Import an account within private key'):
wallet = main_screen.left_panel.open_wallet() wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase() SigningPhrasePopup().wait_until_appears().confirm_phrase()
account_popup = wallet.left_panel.open_add_account_popup() account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_private_key( account_popup.set_name(name).set_origin_private_key(
address_pair.private_key, address_pair.private_key[:5]).save_changes() address_pair.private_key, address_pair.private_key[:5]).save_changes()
authenticate_with_password(user_account) authenticate_with_password(user_account)
account_popup.wait_until_hidden() account_popup.wait_until_hidden()
@ -43,7 +40,7 @@ def test_plus_button_manage_account_from_private_key(main_screen: MainWindow, us
assert message == f'"{name}" successfully added' assert message == f'"{name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'): with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode) expected_account = constants.user.account_list_item(name, None, None)
started_at = time.monotonic() started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts: while expected_account not in wallet.left_panel.accounts:
time.sleep(1) time.sleep(1)
@ -62,10 +59,10 @@ def test_plus_button_manage_account_from_private_key(main_screen: MainWindow, us
with step('Edit wallet account'): with step('Edit wallet account'):
main_screen.left_panel.open_wallet() main_screen.left_panel.open_wallet()
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(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_changes() account_popup.set_name(new_name).save_changes()
with step('Verify that the account is correctly displayed in accounts list'): with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(new_name, new_color.lower(), new_emoji_unicode) expected_account = constants.user.account_list_item(new_name, None, None)
started_at = time.monotonic() started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts: while expected_account not in wallet.left_panel.accounts:
time.sleep(1) time.sleep(1)

View File

@ -7,7 +7,7 @@ from allure_commons._allure import step
from constants.wallet import WalletSeedPhrase from constants.wallet import WalletSeedPhrase
from helpers.WalletHelper import authenticate_with_password from helpers.WalletHelper import authenticate_with_password
from scripts.utils.generators import random_mnemonic from scripts.utils.generators import random_mnemonic, random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks from tests.wallet_main_screen import marks
import constants import constants
@ -20,23 +20,16 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703030', 'Manage a seed phrase imported account') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703030', 'Manage a seed phrase imported account')
@pytest.mark.case(703030) @pytest.mark.case(703030)
@pytest.mark.parametrize('name, color, emoji, emoji_unicode, ' def test_plus_button_manage_account_from_seed_phrase(main_screen: MainWindow, user_account):
'new_name, new_color, new_emoji, new_emoji_unicode', [ name = random_wallet_acc_keypair_name()
pytest.param('SPAcc24', '#2a4af5', 'sunglasses', '1f60e', new_name = random_wallet_acc_keypair_name()
'SPAcc24edited', '#216266', 'thumbsup', '1f44d'
)
])
def test_plus_button_manage_account_from_seed_phrase(main_screen: MainWindow, user_account,
name: str, color: str, emoji: str, emoji_unicode: str,
new_name: str, new_color: str, new_emoji: str,
new_emoji_unicode: str):
with step('Create imported seed phrase wallet account'): with step('Create imported seed phrase wallet account'):
mnemonic_data = random_mnemonic() mnemonic_data = random_mnemonic()
wallet = main_screen.left_panel.open_wallet() wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase() SigningPhrasePopup().wait_until_appears().confirm_phrase()
account_popup = wallet.left_panel.open_add_account_popup() account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_emoji(emoji).set_color( account_popup.set_name(name).open_add_new_account_popup().import_new_seed_phrase(mnemonic_data.split())
color).open_add_new_account_popup().import_new_seed_phrase(mnemonic_data.split())
account_popup.save_changes() account_popup.save_changes()
authenticate_with_password(user_account) authenticate_with_password(user_account)
account_popup.wait_until_hidden() account_popup.wait_until_hidden()
@ -48,7 +41,7 @@ def test_plus_button_manage_account_from_seed_phrase(main_screen: MainWindow, us
assert message == f'"{name}" successfully added' assert message == f'"{name}" successfully added'
with step('Verify that the account is correctly displayed in accounts list'): with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode) expected_account = constants.user.account_list_item(name, None, None)
started_at = time.monotonic() started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts: while expected_account not in wallet.left_panel.accounts:
time.sleep(1) time.sleep(1)
@ -63,7 +56,7 @@ def test_plus_button_manage_account_from_seed_phrase(main_screen: MainWindow, us
with step('Try to re-import seed phrase and verify that correct error appears'): with step('Try to re-import seed phrase and verify that correct error appears'):
account_popup = wallet.left_panel.open_add_account_popup() account_popup = wallet.left_panel.open_add_account_popup()
add_new_account = account_popup.set_name(name).set_emoji(emoji).set_color(color).open_add_new_account_popup() add_new_account = account_popup.set_name(name).open_add_new_account_popup()
add_new_account.enter_new_seed_phrase(mnemonic_data.split()) add_new_account.enter_new_seed_phrase(mnemonic_data.split())
assert add_new_account.get_already_added_error() == WalletSeedPhrase.WALLET_SEED_PHRASE_ALREADY_ADDED.value assert add_new_account.get_already_added_error() == WalletSeedPhrase.WALLET_SEED_PHRASE_ALREADY_ADDED.value
@ -73,13 +66,14 @@ def test_plus_button_manage_account_from_seed_phrase(main_screen: MainWindow, us
with step('Add the same account again and check derivation path'): with step('Add the same account again and check derivation path'):
add_new_account_popup = wallet.left_panel.open_add_account_popup() add_new_account_popup = wallet.left_panel.open_add_account_popup()
add_same_account = add_new_account_popup.set_name(name).set_emoji(emoji).set_color(color).open_add_new_account_popup() add_same_account = add_new_account_popup.set_name(name).open_add_new_account_popup()
add_same_account.import_new_seed_phrase(mnemonic_data.split()) add_same_account.import_new_seed_phrase(mnemonic_data.split())
add_new_account_popup.save_changes() add_new_account_popup.save_changes()
authenticate_with_password(user_account) authenticate_with_password(user_account)
add_new_account_popup.wait_until_hidden() add_new_account_popup.wait_until_hidden()
with step('Verify derivation path'): with step('Verify derivation path'):
wallet.left_panel.click()
edit_account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name) edit_account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
edit_account_popup.copy_derivation_path_button.click() edit_account_popup.copy_derivation_path_button.click()
derivation_path = pyperclip.paste() derivation_path = pyperclip.paste()

View File

@ -6,7 +6,7 @@ import pytest
from allure_commons._allure import step from allure_commons._allure import step
from constants.wallet import DerivationPathName from constants.wallet import DerivationPathName
from scripts.utils.generators import random_wallet_account_name from scripts.utils.generators import random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks from tests.wallet_main_screen import marks
import constants import constants
@ -18,26 +18,20 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703028', 'Manage a custom generated account') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703028', 'Manage a custom generated account')
@pytest.mark.case(703028) @pytest.mark.case(703028)
@pytest.mark.parametrize( @pytest.mark.xfail
'color, emoji, emoji_unicode', def test_plus_button_manage_generated_account_custom_derivation_path(main_screen: MainWindow, user_account):
[
pytest.param('#216266', 'sunglasses', '1f60e')
])
def test_plus_button_manage_generated_account_custom_derivation_path(main_screen: MainWindow, user_account,
color: str, emoji: str,
emoji_unicode: str):
with step('Create generated wallet account'): with step('Create generated wallet account'):
name = random_wallet_account_name() name = random_wallet_acc_keypair_name()
wallet = main_screen.left_panel.open_wallet() wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase() SigningPhrasePopup().wait_until_appears().confirm_phrase()
account_popup = wallet.left_panel.open_add_account_popup() account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_derivation_path( account_popup.set_name(name).set_derivation_path(
DerivationPathName.select_random_path_name().value, DerivationPathName.select_random_path_name().value,
random.randrange(2, 100), random.randrange(2, 100),
user_account.password).save_changes() user_account.password).save_changes()
with step('Verify that the account is correctly displayed in accounts list'): with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(name, color.lower(), emoji_unicode) expected_account = constants.user.account_list_item(name, None, None)
started_at = time.monotonic() started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts: while expected_account not in wallet.left_panel.accounts:
time.sleep(1) time.sleep(1)

View File

@ -3,6 +3,9 @@ import time
import allure import allure
import pytest import pytest
from allure_commons._allure import step from allure_commons._allure import step
from constants.wallet import WalletNetworkSettings
from scripts.utils.generators import random_wallet_acc_keypair_name
from tests.wallet_main_screen import marks from tests.wallet_main_screen import marks
import constants import constants
@ -12,11 +15,11 @@ from gui.main_window import MainWindow
pytestmark = marks pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703022', 'Edit default wallet account') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703022', 'Edit default wallet account')
@pytest.mark.case(703022) @pytest.mark.case(703022)
@pytest.mark.parametrize('name, new_name, new_color, new_emoji, new_emoji_unicode', [ def test_context_menu_edit_default_account(main_screen: MainWindow, user_account):
pytest.param('Account 1', 'MyPrimaryAccount', '#216266', 'sunglasses', '1f60e')
]) name = WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_NAME.value
def test_context_menu_edit_default_account(main_screen: MainWindow, name: str, new_name: str, new_color: str, new_emoji: str, new_name = random_wallet_acc_keypair_name()
new_emoji_unicode: str):
with step('Select wallet account'): with step('Select wallet account'):
wallet = main_screen.left_panel.open_wallet() wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase() SigningPhrasePopup().wait_until_appears().confirm_phrase()
@ -29,10 +32,10 @@ def test_context_menu_edit_default_account(main_screen: MainWindow, name: str, n
with step('Edit wallet account'): with step('Edit wallet account'):
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(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_changes() account_popup.set_name(new_name).save_changes()
with step('Verify that the account is correctly displayed in accounts list'): with step('Verify that the account is correctly displayed in accounts list'):
expected_account = constants.user.account_list_item(new_name, new_color.lower(), new_emoji_unicode) expected_account = constants.user.account_list_item(new_name, None, None)
started_at = time.monotonic() started_at = time.monotonic()
while expected_account not in wallet.left_panel.accounts: while expected_account not in wallet.left_panel.accounts:
time.sleep(1) time.sleep(1)