chore: add random user attributes usage where possible

This commit is contained in:
Anastasiya Semenkevich 2024-03-28 14:37:24 +03:00 committed by Anastasiya
parent 0ec1ddbdb0
commit 7994739d04
17 changed files with 55 additions and 29 deletions

View File

@ -32,8 +32,27 @@ community_user_2 = UserAccount('community_user_2', 'vSq5T702_p', [
'will', 'horn', 'tail', 'stock', 'puzzle', 'warfare', 'pledge', 'uniform', 'ozone', 'taste', 'someone', 'silk' 'will', 'horn', 'tail', 'stock', 'puzzle', 'warfare', 'pledge', 'uniform', 'ozone', 'taste', 'someone', 'silk'
], '0x935034600f2ba486324cee6ae3f96ad8c8915ac6') ], '0x935034600f2ba486324cee6ae3f96ad8c8915ac6')
user_for_syncing = UserAccount(''.join((random.choices(string.ascii_letters + user_with_random_attributes_1 = UserAccount(
string.digits, k=24))), '1vTC2,4R1=', [], '') ''.join((random.choice(
string.ascii_letters + string.digits + random.choice('_- '))
for i in range(5, 25))
).strip(' '),
''.join((random.choice(
string.ascii_letters + string.digits + string.punctuation)
for _ in range(10, 28))
), [], ''
)
user_with_random_attributes_2 = UserAccount(
''.join((random.choice(
string.ascii_letters + string.digits + random.choice('_- '))
for i in range(5, 25))
).strip(' '),
''.join((random.choice(
string.ascii_letters + string.digits + string.punctuation)
for _ in range(10, 28))
), [], ''
)
user_account_one_changed_password = UserAccount('squisher', 'NewPassword@12345', [], '') user_account_one_changed_password = UserAccount('squisher', 'NewPassword@12345', [], '')
user_account_one_changed_name = UserAccount('NewUserName', '0000000000', [], '') user_account_one_changed_name = UserAccount('NewUserName', '0000000000', [], '')

View File

@ -20,8 +20,8 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703087', '1-1 Chat') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703087', '1-1 Chat')
@pytest.mark.case(703087) @pytest.mark.case(703087)
def test_1x1_chat(multiple_instances): def test_1x1_chat(multiple_instances):
user_one: UserAccount = constants.user_account_one user_one: UserAccount = constants.user_with_random_attributes_1
user_two: UserAccount = constants.user_account_two user_two: UserAccount = constants.user_with_random_attributes_2
main_window = MainWindow() main_window = MainWindow()
messages_screen = MessagesScreen() messages_screen = MessagesScreen()
emoji = 'sunglasses' emoji = 'sunglasses'

View File

@ -36,7 +36,7 @@ def sync_screen(main_window) -> SyncCodeView:
@pytest.mark.case(703592) @pytest.mark.case(703592)
@pytest.mark.critical @pytest.mark.critical
def test_sync_device_during_onboarding(multiple_instances): def test_sync_device_during_onboarding(multiple_instances):
user: UserAccount = constants.user_for_syncing user: UserAccount = constants.user_with_random_attributes_1
main_window = MainWindow() main_window = MainWindow()
with multiple_instances(user_data=None) as aut_one, multiple_instances(user_data=None) as aut_two: with multiple_instances(user_data=None) as aut_one, multiple_instances(user_data=None) as aut_two:

View File

@ -26,7 +26,7 @@ def keys_screen(main_window) -> KeysView:
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/702989', @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/702989',
'Strength of the password') 'Strength of the password')
@pytest.mark.case(702989) @pytest.mark.case(702989)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@pytest.mark.skip(reason="https://github.com/status-im/status-desktop/issues/13783") @pytest.mark.skip(reason="https://github.com/status-im/status-desktop/issues/13783")
def test_check_password_strength_and_login(keys_screen, main_window, user_account): def test_check_password_strength_and_login(keys_screen, main_window, user_account):
values = [('abcdefghij', very_weak_lower_elements), values = [('abcdefghij', very_weak_lower_elements),

View File

@ -20,7 +20,7 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703007', @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703007',
'Change own display name from online identifier') 'Change own display name from online identifier')
@pytest.mark.case(703007) @pytest.mark.case(703007)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@pytest.mark.parametrize('new_name', [pytest.param('NewUserName')]) @pytest.mark.parametrize('new_name', [pytest.param('NewUserName')])
def test_change_own_display_name(main_screen: MainWindow, user_account, new_name): def test_change_own_display_name(main_screen: MainWindow, user_account, new_name):
with step('Open own profile popup and check name of user is correct'): with step('Open own profile popup and check name of user is correct'):
@ -42,8 +42,8 @@ def test_change_own_display_name(main_screen: MainWindow, user_account, new_name
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703004', 'Switch state to automatic') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703004', 'Switch state to automatic')
@pytest.mark.case(703002, 703003, 703004) @pytest.mark.case(703002, 703003, 703004)
def test_switch_state_to_offline_online_automatic(multiple_instances): def test_switch_state_to_offline_online_automatic(multiple_instances):
user_one: UserAccount = constants.user_account_one user_one: UserAccount = constants.user_with_random_attributes_1
user_two: UserAccount = constants.user_account_two user_two: UserAccount = constants.user_with_random_attributes_2
community_params = deepcopy(constants.community_params) community_params = deepcopy(constants.community_params)
community_params['name'] = f'{datetime.now():%d%m%Y_%H%M%S}' community_params['name'] = f'{datetime.now():%d%m%Y_%H%M%S}'
main_screen = MainWindow() main_screen = MainWindow()

View File

@ -16,7 +16,7 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704607', 'Unlock Keycard') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704607', 'Unlock Keycard')
@pytest.mark.case(704607) @pytest.mark.case(704607)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@pytest.mark.skip(reason="https://github.com/status-im/desktop-qa-automation/issues/274") @pytest.mark.skip(reason="https://github.com/status-im/desktop-qa-automation/issues/274")
def test_unlock_keycard_using_correct_puk(main_screen: MainWindow, user_account): def test_unlock_keycard_using_correct_puk(main_screen: MainWindow, user_account):
main_screen.prepare() main_screen.prepare()
@ -90,7 +90,7 @@ def test_unlock_keycard_using_correct_puk(main_screen: MainWindow, user_account)
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704608', 'Unlock Keycard: incorrect PUK') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704608', 'Unlock Keycard: incorrect PUK')
@pytest.mark.case(704608) @pytest.mark.case(704608)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@pytest.mark.skip(reason="https://github.com/status-im/desktop-qa-automation/issues/274") @pytest.mark.skip(reason="https://github.com/status-im/desktop-qa-automation/issues/274")
def test_unlock_keycard_using_incorrect_puk(main_screen: MainWindow, user_account): def test_unlock_keycard_using_incorrect_puk(main_screen: MainWindow, user_account):
main_screen.prepare() main_screen.prepare()

View File

@ -17,8 +17,8 @@ pytestmark = marks
@pytest.mark.case(703011) @pytest.mark.case(703011)
# TODO: reason='https://github.com/status-im/desktop-qa-automation/issues/346' # TODO: reason='https://github.com/status-im/desktop-qa-automation/issues/346'
def test_messaging_settings_accepting_request(multiple_instances): def test_messaging_settings_accepting_request(multiple_instances):
user_one: UserAccount = constants.user_account_one user_one: UserAccount = constants.user_with_random_attributes_1
user_two: UserAccount = constants.user_account_two user_two: UserAccount = constants.user_with_random_attributes_2
main_window = MainWindow() main_window = MainWindow()
with (multiple_instances(user_data=None) as aut_one, multiple_instances(user_data=None) as aut_two): with (multiple_instances(user_data=None) as aut_one, multiple_instances(user_data=None) as aut_two):

View File

@ -17,8 +17,8 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704611', 'Reply to identity request') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704611', 'Reply to identity request')
@pytest.mark.case(704611) @pytest.mark.case(704611)
def test_messaging_settings_identity_verification(multiple_instances): def test_messaging_settings_identity_verification(multiple_instances):
user_one: UserAccount = constants.user_account_one user_one: UserAccount = constants.user_with_random_attributes_1
user_two: UserAccount = constants.user_account_two user_two: UserAccount = constants.user_with_random_attributes_2
main_window = MainWindow() main_window = MainWindow()
with multiple_instances(user_data=None) as aut_one, multiple_instances(user_data=None) as aut_two: with multiple_instances(user_data=None) as aut_one, multiple_instances(user_data=None) as aut_two:

View File

@ -11,11 +11,13 @@ from gui.main_window import MainWindow
pytestmark = marks pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704610', 'Reject a contact request with a chat key')
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704610',
'Reject a contact request with a chat key')
@pytest.mark.case(704610) @pytest.mark.case(704610)
def test_messaging_settings_rejecting_request(multiple_instances): def test_messaging_settings_rejecting_request(multiple_instances):
user_one: UserAccount = constants.user_account_one user_one: UserAccount = constants.user_with_random_attributes_1
user_two: UserAccount = constants.user_account_two user_two: UserAccount = constants.user_with_random_attributes_2
main_window = MainWindow() main_window = MainWindow()
with multiple_instances(user_data=None) as aut_one, multiple_instances(user_data=None) as aut_two: with multiple_instances(user_data=None) as aut_one, multiple_instances(user_data=None) as aut_two:

View File

@ -15,11 +15,13 @@ from gui.main_window import MainWindow
from gui.screens.settings_wallet import WalletSettingsView from gui.screens.settings_wallet import WalletSettingsView
pytestmark = marks pytestmark = marks
@pytest.mark.critical @pytest.mark.critical
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704454', @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704454',
'Account view interactions: Delete generated account') 'Account view interactions: Delete generated account')
@pytest.mark.case(704454) @pytest.mark.case(704454)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@pytest.mark.parametrize('account_name, color, emoji, emoji_unicode', @pytest.mark.parametrize('account_name, color, emoji, emoji_unicode',
[ [
pytest.param(''.join(random.choices(string.ascii_letters + pytest.param(''.join(random.choices(string.ascii_letters +

View File

@ -18,7 +18,7 @@ pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/edit/703598', @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/edit/703598',
'Add new account from wallet settings screen') 'Add new account from wallet settings screen')
@pytest.mark.case(703598) @pytest.mark.case(703598)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@pytest.mark.parametrize('account_name, color, emoji, emoji_unicode', @pytest.mark.parametrize('account_name, color, emoji, emoji_unicode',
[ [
pytest.param(''.join(random.choices(string.ascii_letters + pytest.param(''.join(random.choices(string.ascii_letters +

View File

@ -13,10 +13,12 @@ from gui.components.toast_message import ToastMessage
from gui.main_window import MainWindow from gui.main_window import MainWindow
pytestmark = marks pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704459', @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704459',
'User can add one more account after restarting the app') 'User can add one more account after restarting the app')
@pytest.mark.case(704459) @pytest.mark.case(704459)
@pytest.mark.parametrize('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@pytest.mark.parametrize('name, color, emoji, emoji_unicode,', @pytest.mark.parametrize('name, color, emoji, emoji_unicode,',
[ [
pytest.param('GenAcc1', '#2a4af5', 'sunglasses', '1f60e') pytest.param('GenAcc1', '#2a4af5', 'sunglasses', '1f60e')
@ -79,4 +81,3 @@ def test_add_generated_account_restart_add_again(
time.sleep(1) time.sleep(1)
if time.monotonic() - started_at > 15: if time.monotonic() - started_at > 15:
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}')

View File

@ -18,7 +18,7 @@ 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('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@pytest.mark.parametrize('name, color, emoji, emoji_unicode, ' @pytest.mark.parametrize('name, color, emoji, emoji_unicode, '
'new_name, new_color, new_emoji, new_emoji_unicode, keypair_name', [ 'new_name, new_color, new_emoji, new_emoji_unicode, keypair_name', [
pytest.param('SPAcc', '#2a4af5', 'sunglasses', '1f60e', pytest.param('SPAcc', '#2a4af5', 'sunglasses', '1f60e',

View File

@ -17,7 +17,7 @@ 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('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@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, ' @pytest.mark.parametrize('name, color, emoji, emoji_unicode, '
'new_name, new_color, new_emoji, new_emoji_unicode', [ 'new_name, new_color, new_emoji, new_emoji_unicode', [

View File

@ -17,7 +17,7 @@ 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('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@pytest.mark.parametrize('name, color, emoji, emoji_unicode, ' @pytest.mark.parametrize('name, color, emoji, emoji_unicode, '
'new_name, new_color, new_emoji, new_emoji_unicode, seed_phrase', [ 'new_name, new_color, new_emoji, new_emoji_unicode, seed_phrase', [
pytest.param('SPAcc24', '#2a4af5', 'sunglasses', '1f60e', pytest.param('SPAcc24', '#2a4af5', 'sunglasses', '1f60e',

View File

@ -13,9 +13,11 @@ from gui.components.wallet.authenticate_popup import AuthenticatePopup
from gui.main_window import MainWindow from gui.main_window import MainWindow
pytestmark = marks 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('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@pytest.mark.parametrize('name, color, emoji, emoji_unicode, ' @pytest.mark.parametrize('name, color, emoji, emoji_unicode, '
'new_name, new_color, new_emoji, new_emoji_unicode', [ 'new_name, new_color, new_emoji, new_emoji_unicode', [
pytest.param('GenAcc1', '#2a4af5', 'sunglasses', '1f60e', pytest.param('GenAcc1', '#2a4af5', 'sunglasses', '1f60e',
@ -23,7 +25,8 @@ pytestmark = marks
]) ])
def test_plus_button_manage_generated_account(main_screen: MainWindow, user_account, def test_plus_button_manage_generated_account(main_screen: MainWindow, user_account,
color: str, emoji: str, emoji_unicode: str, color: str, emoji: str, emoji_unicode: str,
name: str, new_name: str, new_color: str, new_emoji: str, new_emoji_unicode: str): name: str, new_name: str, new_color: str, new_emoji: str,
new_emoji_unicode: str):
with step('Create generated wallet account'): with step('Create generated 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()

View File

@ -8,7 +8,6 @@ from tests.wallet_main_screen import marks
import constants import constants
import driver import driver
from gui.components.signing_phrase_popup import SigningPhrasePopup from gui.components.signing_phrase_popup import SigningPhrasePopup
from gui.components.toast_message import ToastMessage
from gui.main_window import MainWindow from gui.main_window import MainWindow
pytestmark = marks pytestmark = marks
@ -16,7 +15,7 @@ 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('user_account', [constants.user.user_account_one]) @pytest.mark.parametrize('user_account', [constants.user.user_with_random_attributes_1])
@pytest.mark.parametrize('derivation_path, generated_address_index, name, color, emoji, emoji_unicode, new_name, new_color, new_emoji, new_emoji_unicode', @pytest.mark.parametrize('derivation_path, generated_address_index, name, color, emoji, emoji_unicode, new_name, new_color, new_emoji, new_emoji_unicode',
[ [
pytest.param('Ethereum', '5', 'Ethereum', '#216266', 'sunglasses', '1f60e', 'EthEdited', '#216266', 'thumbsup', '1f44d'), pytest.param('Ethereum', '5', 'Ethereum', '#216266', 'sunglasses', '1f60e', 'EthEdited', '#216266', 'thumbsup', '1f44d'),