From daad4e6d4727b5caeeb42326c3215c87f692facc Mon Sep 17 00:00:00 2001 From: Anastasiya Semenkevich Date: Thu, 5 Sep 2024 14:40:46 +0300 Subject: [PATCH] chore: use env var for sensitive information --- test/e2e/configs/__init__.py | 1 + test/e2e/constants/user.py | 18 ------------------ test/e2e/constants/wallet.py | 14 ++++---------- .../test_buy_ens_name_in_settings.py | 9 +++++---- .../test_mint_owner_and_tokenmaster_tokens.py | 7 ++++--- .../transactions_tests/test_wallet_send_eth.py | 11 ++++++----- .../transactions_tests/test_wallet_send_nft.py | 9 +++++---- 7 files changed, 25 insertions(+), 44 deletions(-) diff --git a/test/e2e/configs/__init__.py b/test/e2e/configs/__init__.py index 795e02f84c..63af3a0f1e 100644 --- a/test/e2e/configs/__init__.py +++ b/test/e2e/configs/__init__.py @@ -21,6 +21,7 @@ if AUT_PATH is None: if get_platform() == "Windows" and 'bin' not in AUT_PATH: exit('Please use launcher from "bin" folder in "AUT_PATH"') AUT_PATH = SystemPath(AUT_PATH) +WALLET_SEED = os.getenv('WALLET_TEST_USER_SEED') # Save application logs AUT_DIR = path.dirname(AUT_PATH) diff --git a/test/e2e/constants/user.py b/test/e2e/constants/user.py index 1e714a6479..014acda034 100644 --- a/test/e2e/constants/user.py +++ b/test/e2e/constants/user.py @@ -31,23 +31,6 @@ class ReturningUser(UserAccount): self.status_address = status_address -class ReturningUsersData(Enum): - RETURNING_USER_ONE = ( - [ - 'rail', 'witness', 'era', 'asthma', 'empty', 'cheap', 'shed', 'pond', 'skate', 'amount', 'invite', 'year' - ], '0x3286c371ef648fe6232324b27ee0515f4ded24d9') - RETURNING_USER_TWO = ( - [ - 'measure', 'cube', 'cousin', 'debris', 'slam', 'ignore', 'seven', 'hat', 'satisfy', 'frown', 'casino', - 'inflict' - ], '0x99C096bB5F12bDe37DE9dbee8257Ebe2a5667C46') - WALLET_USER = ( - [ - 'vocal', 'fruit', 'ordinary', 'meadow', 'south', 'athlete', 'inherit', 'since', 'version', 'pitch', - 'oppose', 'lonely' - ], '0x26d6e10a6af4eb4d12ff4cf133a843eb4fa88d0b') - - user_account_one = UserAccount('squisher', '0000000000', [ 'rail', 'witness', 'era', 'asthma', 'empty', 'cheap', 'shed', 'pond', 'skate', 'amount', 'invite', 'year' ], '0x3286c371ef648fe6232324b27ee0515f4ded24d9') @@ -55,7 +38,6 @@ user_account_two = UserAccount('athletic', '0000000000', [ 'measure', 'cube', 'cousin', 'debris', 'slam', 'ignore', 'seven', 'hat', 'satisfy', 'frown', 'casino', 'inflict' ], '0x99C096bB5F12bDe37DE9dbee8257Ebe2a5667C46') - community_params = { 'name': ''.join(random.choices(string.ascii_letters + string.digits, k=30)), diff --git a/test/e2e/constants/wallet.py b/test/e2e/constants/wallet.py index 3c3b35252c..7b4b8c630d 100644 --- a/test/e2e/constants/wallet.py +++ b/test/e2e/constants/wallet.py @@ -14,6 +14,10 @@ class DerivationPathName(Enum): return random.choice(list(DerivationPathName)) +class WalletAddress(Enum): + RECEIVER_ADDRESS = '0x3286c371ef648fe6232324b27ee0515f4ded24d9' + + class DerivationPathValue(Enum): STATUS_ACCOUNT_DERIVATION_PATH = "m / 44' / 60' / 0' / 0 / 0" GENERATED_ACCOUNT_DERIVATION_PATH_1 = "m / 44' / 60' / 0' / 0 / 1" @@ -89,13 +93,3 @@ class WalletAccountPopup(Enum): WALLET_ACCOUNT_NAME_MIN = 'Account name must be at least 5 characters' WALLET_KEYPAIR_NAME_MIN = 'Key pair name must be at least 5 character(s)' WALLET_KEYPAIR_MIN = 'Key pair must be at least 5 character(s)' - - -class SeedPhrases(Enum): - TWELVE_WORDS_SEED = 'pelican chief sudden oval media rare swamp elephant lawsuit wheat knife initial' - EIGHTEEN_WORDS_SEED = 'kitten tiny cup admit cactus shrug shuffle accident century faith roof plastic beach police barely vacant sign blossom' - TWENTY_FOUR_WORDS_SEED = 'elite dinosaur flavor canoe garbage palace antique dolphin virtual mixed sand impact solution inmate hair pipe affair cage vote estate gloom lamp robust like' - - @classmethod - def select_random_seed(cls): - return random.choice(list(SeedPhrases)) diff --git a/test/e2e/tests/transactions_tests/test_buy_ens_name_in_settings.py b/test/e2e/tests/transactions_tests/test_buy_ens_name_in_settings.py index 3b5b4e2cdf..f8501f963e 100644 --- a/test/e2e/tests/transactions_tests/test_buy_ens_name_in_settings.py +++ b/test/e2e/tests/transactions_tests/test_buy_ens_name_in_settings.py @@ -3,10 +3,10 @@ import pytest from allure_commons._allure import step import configs -import constants import driver +from configs import WALLET_SEED from configs.timeouts import UI_LOAD_TIMEOUT_SEC -from constants import ReturningUser, ReturningUsersData +from constants import ReturningUser from scripts.utils.generators import random_ens_string from constants.wallet import WalletTransactions from tests.settings import marks @@ -34,12 +34,13 @@ def keys_screen(main_window) -> KeysView: @pytest.mark.case(704597) @pytest.mark.transaction @pytest.mark.parametrize('user_account', [ReturningUser( - seed_phrase=ReturningUsersData.WALLET_USER.value[0], - status_address=ReturningUsersData.WALLET_USER.value[1] + seed_phrase=WALLET_SEED.split(), + status_address='0x44ddd47a0c7681a5b0fa080a56cbb7701db4bb43' )]) @pytest.mark.parametrize('ens_name', [pytest.param(random_ens_string())]) def test_ens_name_purchase(keys_screen, main_window, user_account, ens_name): with step('Open import seed phrase view and enter seed phrase'): + input_view = keys_screen.open_import_seed_phrase_view().open_seed_phrase_input_view() input_view.input_seed_phrase(user_account.seed_phrase, True) profile_view = input_view.import_seed_phrase() diff --git a/test/e2e/tests/transactions_tests/test_mint_owner_and_tokenmaster_tokens.py b/test/e2e/tests/transactions_tests/test_mint_owner_and_tokenmaster_tokens.py index 445ee3e1d2..b29c53e10d 100644 --- a/test/e2e/tests/transactions_tests/test_mint_owner_and_tokenmaster_tokens.py +++ b/test/e2e/tests/transactions_tests/test_mint_owner_and_tokenmaster_tokens.py @@ -7,7 +7,8 @@ from allure_commons._allure import step import configs import constants import driver -from constants import ReturningUser, ReturningUsersData +from configs import WALLET_SEED +from constants import ReturningUser from tests.communities import marks from constants.community_settings import MintOwnerTokensElements from gui.components.onboarding.before_started_popup import BeforeStartedPopUp @@ -30,8 +31,8 @@ def keys_screen(main_window) -> KeysView: @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/727245', 'Mint owner token') @pytest.mark.case(727245) @pytest.mark.parametrize('user_account', [ReturningUser( - seed_phrase=ReturningUsersData.WALLET_USER.value[0], - status_address=ReturningUsersData.WALLET_USER.value[1] + seed_phrase=WALLET_SEED.split(), + status_address='0x44ddd47a0c7681a5b0fa080a56cbb7701db4bb43' )]) @pytest.mark.transaction def test_mint_owner_and_tokenmaster_tokens(keys_screen, main_window, user_account): diff --git a/test/e2e/tests/transactions_tests/test_wallet_send_eth.py b/test/e2e/tests/transactions_tests/test_wallet_send_eth.py index d470bd3ec8..f3079e2c03 100644 --- a/test/e2e/tests/transactions_tests/test_wallet_send_eth.py +++ b/test/e2e/tests/transactions_tests/test_wallet_send_eth.py @@ -4,8 +4,9 @@ from allure_commons._allure import step import configs import driver -from constants import ReturningUser, ReturningUsersData -from constants.wallet import WalletTransactions +from configs import WALLET_SEED +from constants import ReturningUser +from constants.wallet import WalletTransactions, WalletAddress from gui.components.onboarding.before_started_popup import BeforeStartedPopUp from gui.components.onboarding.beta_consent_popup import BetaConsentPopup from gui.components.signing_phrase_popup import SigningPhrasePopup @@ -27,11 +28,11 @@ def keys_screen(main_window) -> KeysView: @pytest.mark.case(704527) @pytest.mark.transaction @pytest.mark.parametrize('user_account', [ReturningUser( - seed_phrase=ReturningUsersData.WALLET_USER.value[0], - status_address=ReturningUsersData.WALLET_USER.value[1] + seed_phrase=WALLET_SEED.split(), + status_address='0x44ddd47a0c7681a5b0fa080a56cbb7701db4bb43' )]) @pytest.mark.parametrize('receiver_account_address, amount, asset', [ - pytest.param(ReturningUsersData.RETURNING_USER_ONE.value[1], 0, 'ETH') + pytest.param(WalletAddress.RECEIVER_ADDRESS.value, 0, 'ETH') ]) @pytest.mark.timeout(timeout=120) def test_wallet_send_0_eth(keys_screen, main_window, user_account, receiver_account_address, amount, asset): diff --git a/test/e2e/tests/transactions_tests/test_wallet_send_nft.py b/test/e2e/tests/transactions_tests/test_wallet_send_nft.py index f75d21122e..e6d4d84947 100644 --- a/test/e2e/tests/transactions_tests/test_wallet_send_nft.py +++ b/test/e2e/tests/transactions_tests/test_wallet_send_nft.py @@ -5,7 +5,8 @@ from allure_commons._allure import step import configs import constants import driver -from constants import ReturningUser, ReturningUsersData +from configs import WALLET_SEED +from constants import ReturningUser from constants.wallet import WalletTransactions from gui.components.onboarding.before_started_popup import BeforeStartedPopUp from gui.components.onboarding.beta_consent_popup import BetaConsentPopup @@ -28,11 +29,11 @@ def keys_screen(main_window) -> KeysView: @pytest.mark.case(704602) @pytest.mark.transaction @pytest.mark.parametrize('user_account', [[ReturningUser( - seed_phrase=ReturningUsersData.WALLET_USER.value[0], - status_address=ReturningUsersData.WALLET_USER.value[1] + seed_phrase=WALLET_SEED.split(), + status_address='0x44ddd47a0c7681a5b0fa080a56cbb7701db4bb43' )]]) @pytest.mark.parametrize('tab, receiver_account_address, amount, collectible', [ - pytest.param('Collectibles', ReturningUsersData.WALLET_USER.value[1], 1, 'Panda') + pytest.param('Collectibles', '0x44ddd47a0c7681a5b0fa080a56cbb7701db4bb43', 1, 'Panda') ]) @pytest.mark.timeout(timeout=120) @pytest.mark.skip(reason="https://github.com/status-im/status-desktop/issues/14862")