mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-24 21:39:24 +00:00
chore(@e2e): use random emoji and color for wallet accounts
This commit is contained in:
parent
a7ae1a7170
commit
3dfb5de6c6
@ -56,14 +56,10 @@ class ColorCodes(Enum):
|
||||
GRAY = '#939ba1'
|
||||
|
||||
|
||||
class EmojiCodes(Enum):
|
||||
SMILING_FACE_WITH_SUNGLASSES = '1f60e'
|
||||
THUMBSUP_SIGN = '1f44d'
|
||||
|
||||
|
||||
class AvatarColors:
|
||||
class UserPictureColors:
|
||||
# ui/StatusQ/src/StatusQ/Core/Theme/StatusLightTheme.qml
|
||||
@staticmethod
|
||||
def available_colors():
|
||||
def profile_colors():
|
||||
return [
|
||||
"#2946C4",
|
||||
"#887AF9",
|
||||
@ -79,3 +75,23 @@ class AvatarColors:
|
||||
"#A9A9A9"
|
||||
|
||||
]
|
||||
|
||||
|
||||
class WalletAccountColors:
|
||||
# ui/StatusQ/src/StatusQ/Core/Theme/StatusLightTheme.qml
|
||||
@staticmethod
|
||||
def wallet_account_colors():
|
||||
return [
|
||||
"#2A4AF5",
|
||||
"#7140FD",
|
||||
"#FF7D46",
|
||||
"#216266",
|
||||
"#2A799B",
|
||||
"#1992D7",
|
||||
"#F6AF3C",
|
||||
"#F66F8F",
|
||||
"#CB6256",
|
||||
"#C78F67",
|
||||
"#EC266C",
|
||||
"#09101C"
|
||||
]
|
||||
|
@ -9,7 +9,7 @@ from constants import ColorCodes
|
||||
from scripts.tools.image import Image
|
||||
from scripts.utils.generators import random_name_string, random_password_string, random_community_name, \
|
||||
random_community_description, random_community_introduction, random_community_leave_message, random_community_tags, \
|
||||
random_color
|
||||
random_color, random_wallet_acc_keypair_name, random_emoji_with_unicode, random_wallet_account_color
|
||||
|
||||
|
||||
@dataclass
|
||||
@ -82,6 +82,22 @@ user_account_two = UserAccount('athletic', '0000000000', [
|
||||
], '0x99C096bB5F12bDe37DE9dbee8257Ebe2a5667C46')
|
||||
|
||||
|
||||
@dataclass
|
||||
class WalletAccount:
|
||||
name: str = None
|
||||
color: str = None
|
||||
emoji: str = None
|
||||
|
||||
|
||||
class RandomWalletAccount(WalletAccount):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
name=random_wallet_acc_keypair_name(),
|
||||
color=random_wallet_account_color(),
|
||||
emoji=random_emoji_with_unicode()
|
||||
)
|
||||
|
||||
|
||||
account_list_item = namedtuple('AccountListItem', ['name', 'color', 'emoji'])
|
||||
wallet_account_list_item = namedtuple('WalletAccountListItem', ['name', 'icon_color', 'icon_emoji', 'object'])
|
||||
|
||||
|
@ -105,6 +105,7 @@ class AUT:
|
||||
str(self.path),
|
||||
f'--datadir={self.app_data}',
|
||||
f'--LOG_LEVEL={configs.testpath.LOG_LEVEL}',
|
||||
'--api-logging'
|
||||
]
|
||||
try:
|
||||
with open(configs.AUT_LOG_FILE, "ab") as log:
|
||||
|
69663
test/e2e/ext/test_files/emojis_unicodes_list.json
Normal file
69663
test/e2e/ext/test_files/emojis_unicodes_list.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -95,7 +95,7 @@ class AccountPopup(BasePopup):
|
||||
@allure.step('Set emoji for account')
|
||||
def set_emoji(self, value: str):
|
||||
self._emoji_button.click()
|
||||
EmojiPopup().wait_until_appears(timeout_msec=10000).select(value)
|
||||
EmojiPopup().wait_until_appears(timeout_msec=10000).select(value.strip(':'))
|
||||
return self
|
||||
|
||||
@allure.step('Get emoji id from account header')
|
||||
|
@ -57,13 +57,13 @@ class LeftPanel(QObject):
|
||||
for account_item in raw_data:
|
||||
name = str(account_item.title)
|
||||
# TODO: to fix properly with account data class implementation
|
||||
# color = str(account_item.asset.color.name).lower()
|
||||
# emoji = ''
|
||||
# for child in walk_children(account_item):
|
||||
# if hasattr(child, 'emojiId'):
|
||||
# emoji = str(child.emojiId)
|
||||
# break
|
||||
accounts.append(constants.user.account_list_item(name, None, None))
|
||||
color = str(account_item.asset.color.name).lower()
|
||||
emoji = ''
|
||||
for child in walk_children(account_item):
|
||||
if hasattr(child, 'emojiId'):
|
||||
emoji = str(child.emojiId)
|
||||
break
|
||||
accounts.append(constants.user.account_list_item(name, color, emoji.split('-')[0]))
|
||||
else:
|
||||
raise LookupError("Account items were not found")
|
||||
return accounts
|
||||
|
@ -1,10 +1,12 @@
|
||||
import json
|
||||
import random
|
||||
import string
|
||||
from zpywallet import HDWallet
|
||||
from zpywallet.network import EthereumMainNet
|
||||
from eth_account.hdaccount import generate_mnemonic, Mnemonic
|
||||
|
||||
from constants import user
|
||||
import configs
|
||||
from constants import user, WalletAccountColors
|
||||
|
||||
|
||||
def random_name_string():
|
||||
@ -80,3 +82,15 @@ def get_wallet_address_from_mnemonic(mnemonic_data) -> str:
|
||||
|
||||
def random_text_message():
|
||||
return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(1, 141))
|
||||
|
||||
|
||||
def random_emoji_with_unicode() -> tuple:
|
||||
with open(configs.testpath.TEST_FILES / 'emojis_unicodes_list.json', "r", encoding="utf-8") as file:
|
||||
data = json.load(file)
|
||||
random_item = random.choice(data)
|
||||
return random_item['shortname'], random_item['unicode']
|
||||
|
||||
|
||||
def random_wallet_account_color():
|
||||
color = random.choice(WalletAccountColors.wallet_account_colors())
|
||||
return color.lower()
|
||||
|
@ -12,26 +12,26 @@ import constants
|
||||
from driver.aut import AUT
|
||||
from gui.components.signing_phrase_popup import SigningPhrasePopup
|
||||
from gui.main_window import MainWindow
|
||||
from scripts.utils.generators import random_emoji_with_unicode, random_wallet_account_color, \
|
||||
random_wallet_acc_keypair_name
|
||||
|
||||
|
||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704459',
|
||||
'User can add one more account after restarting the app')
|
||||
@pytest.mark.case(704459, 738724, 738782, 738786)
|
||||
@pytest.mark.parametrize('name, color, emoji, emoji_unicode,',
|
||||
[
|
||||
pytest.param('GenAcc1', '#2a4af5', 'sunglasses', '1f60e')
|
||||
])
|
||||
@pytest.mark.parametrize('name2, color2, emoji2, emoji_unicode2,',
|
||||
[
|
||||
pytest.param('GenAcc2', '#2a4af5', 'sunglasses', '1f60e')
|
||||
])
|
||||
@pytest.mark.critical
|
||||
@pytest.mark.smoke
|
||||
def test_add_generated_account_restart_add_again(
|
||||
aut: AUT, main_screen: MainWindow, user_account,
|
||||
color: str, emoji: str, emoji_unicode: str, name: str,
|
||||
color2: str, emoji2: str, emoji_unicode2: str, name2: str,
|
||||
):
|
||||
aut: AUT, main_screen: MainWindow, user_account):
|
||||
|
||||
emoji_data1 = random_emoji_with_unicode()
|
||||
name1 = random_wallet_acc_keypair_name()
|
||||
color1 = random_wallet_account_color()
|
||||
|
||||
emoji_data2 = random_emoji_with_unicode()
|
||||
name2 = random_wallet_acc_keypair_name()
|
||||
color2 = random_wallet_account_color()
|
||||
|
||||
with step('Open wallet and choose default account'):
|
||||
default_name = WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_NAME.value
|
||||
wallet = main_screen.left_panel.open_wallet()
|
||||
@ -47,7 +47,7 @@ def test_add_generated_account_restart_add_again(
|
||||
with step('Add the first generated wallet account'):
|
||||
wallet = main_screen.left_panel.open_wallet()
|
||||
account_popup = wallet.left_panel.open_add_account_popup()
|
||||
account_popup.set_name(name).save_changes()
|
||||
account_popup.set_name(name1).set_emoji(emoji_data1[0]).set_color(color1).save_changes()
|
||||
authenticate_with_password(user_account)
|
||||
account_popup.wait_until_hidden()
|
||||
|
||||
@ -55,10 +55,10 @@ def test_add_generated_account_restart_add_again(
|
||||
assert len(main_screen.wait_for_notification()) == 1, \
|
||||
f"Multiple toast messages appeared"
|
||||
message = main_screen.wait_for_notification()[0]
|
||||
assert message == f'"{name}" successfully added'
|
||||
assert message == f'"{name1}" successfully added'
|
||||
|
||||
with step('Verify that the account is correctly displayed in accounts list'):
|
||||
expected_account = constants.user.account_list_item(name, None, None)
|
||||
expected_account = constants.user.account_list_item(name1, color1.lower(), emoji_data1[1].split('-')[0])
|
||||
started_at = time.monotonic()
|
||||
while expected_account not in wallet.left_panel.accounts:
|
||||
time.sleep(1)
|
||||
@ -74,7 +74,7 @@ def test_add_generated_account_restart_add_again(
|
||||
assert not SigningPhrasePopup().ok_got_it_button.is_visible, \
|
||||
f"Signing phrase should not be present because it has been hidden in the first step"
|
||||
account_popup = wallet.left_panel.open_add_account_popup()
|
||||
account_popup.set_name(name2).save_changes()
|
||||
account_popup.set_name(name2).set_emoji(emoji_data2[0]).set_color(color2).save_changes()
|
||||
authenticate_with_password(user_account)
|
||||
account_popup.wait_until_hidden()
|
||||
|
||||
@ -85,7 +85,7 @@ def test_add_generated_account_restart_add_again(
|
||||
assert message == f'"{name2}" successfully added'
|
||||
|
||||
with step('Verify that the account is correctly displayed in accounts list'):
|
||||
expected_account = constants.user.account_list_item_2(name2, None, None)
|
||||
expected_account = constants.user.account_list_item_2(name2, color2.lower(), emoji_data2[1].split('-')[0])
|
||||
started_at = time.monotonic()
|
||||
while expected_account not in wallet.left_panel.accounts:
|
||||
time.sleep(1)
|
||||
|
@ -5,7 +5,8 @@ import pytest
|
||||
from allure_commons._allure import step
|
||||
|
||||
from helpers.WalletHelper import authenticate_with_password
|
||||
from scripts.utils.generators import random_wallet_acc_keypair_name
|
||||
from scripts.utils.generators import random_wallet_acc_keypair_name, random_emoji_with_unicode, \
|
||||
random_wallet_account_color
|
||||
|
||||
import constants
|
||||
import driver
|
||||
@ -17,10 +18,13 @@ from gui.main_window import MainWindow
|
||||
@pytest.mark.critical
|
||||
def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account,):
|
||||
with step('Create generated wallet account'):
|
||||
emoji_data = random_emoji_with_unicode()
|
||||
name = random_wallet_acc_keypair_name()
|
||||
color = random_wallet_account_color()
|
||||
|
||||
wallet = main_screen.left_panel.open_wallet()
|
||||
account_popup = wallet.left_panel.open_add_account_popup()
|
||||
account_popup.set_name(name).save_changes()
|
||||
account_popup.set_name(name).set_emoji(emoji_data[0]).set_color(color).save_changes()
|
||||
authenticate_with_password(user_account)
|
||||
account_popup.wait_until_hidden()
|
||||
|
||||
@ -31,7 +35,7 @@ def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account
|
||||
assert message == f'"{name}" successfully added'
|
||||
|
||||
with step('Verify that the account is correctly displayed in accounts list'):
|
||||
expected_account = constants.user.account_list_item(name, None, None)
|
||||
expected_account = constants.user.account_list_item(name, color.lower(), emoji_data[1].split('-')[0])
|
||||
started_at = time.monotonic()
|
||||
while expected_account not in wallet.left_panel.accounts:
|
||||
time.sleep(1)
|
||||
@ -40,11 +44,13 @@ def test_add_edit_delete_generated_account(main_screen: MainWindow, user_account
|
||||
|
||||
with step('Edit wallet account'):
|
||||
new_name = random_wallet_acc_keypair_name()
|
||||
new_emoji_data = random_emoji_with_unicode()
|
||||
new_color = random_wallet_account_color()
|
||||
account_popup = wallet.left_panel.open_edit_account_popup_from_context_menu(name)
|
||||
account_popup.set_name(new_name).save_changes()
|
||||
account_popup.set_name(new_name).set_emoji(new_emoji_data[0]).set_color(new_color).save_changes()
|
||||
|
||||
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, new_color.lower(), new_emoji_data[1].split('-')[0])
|
||||
started_at = time.monotonic()
|
||||
while expected_account not in wallet.left_panel.accounts:
|
||||
time.sleep(1)
|
||||
|
@ -95,7 +95,7 @@ def test_generate_account_back_up_seed_sign_out(aut, main_window, user_account,
|
||||
|
||||
with step('Verify that user avatar background color'):
|
||||
avatar_color = str(main_window.left_panel.profile_button.object.identicon.asset.color.name).upper()
|
||||
assert avatar_color in constants.AvatarColors.available_colors(), \
|
||||
assert avatar_color in constants.UserPictureColors.profile_colors(), \
|
||||
f'Avatar color should be one of the allowed colors but is {avatar_color}'
|
||||
|
||||
with step('Open online identifier and check the data'):
|
||||
|
@ -3,6 +3,9 @@ import time
|
||||
import allure
|
||||
import pytest
|
||||
from allure_commons._allure import step
|
||||
|
||||
from scripts.utils.generators import random_emoji_with_unicode, random_wallet_acc_keypair_name, \
|
||||
random_wallet_account_color
|
||||
from tests.wallet_main_screen import marks
|
||||
|
||||
import constants
|
||||
@ -15,19 +18,21 @@ pytestmark = marks
|
||||
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703026', 'Manage a watch-only account')
|
||||
@pytest.mark.case(703026, 738788, 738815)
|
||||
@pytest.mark.smoke
|
||||
@pytest.mark.skip(reason="https://github.com/status-im/status-desktop/issues/15933")
|
||||
# TODO: to add a step of account removal
|
||||
@pytest.mark.parametrize('address, name, color, emoji, emoji_unicode', [
|
||||
pytest.param('0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A', 'AccWatch1', '#2a4af5',
|
||||
'sunglasses', '1f60e')
|
||||
@pytest.mark.parametrize('address', [
|
||||
pytest.param('0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A')
|
||||
])
|
||||
def test_plus_button_add_watched_address(
|
||||
main_screen: MainWindow, address: str, color: str, emoji: str, emoji_unicode: str,
|
||||
name: str):
|
||||
def test_plus_button_add_watched_address(main_screen: MainWindow, address: str):
|
||||
|
||||
emoji_data = random_emoji_with_unicode()
|
||||
name = random_wallet_acc_keypair_name()
|
||||
color = random_wallet_account_color()
|
||||
|
||||
with step('Add watched address with plus action button'):
|
||||
wallet = main_screen.left_panel.open_wallet()
|
||||
account_popup = wallet.left_panel.open_add_account_popup()
|
||||
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_watched_address(address).save_changes()
|
||||
account_popup.set_name(name).set_emoji(
|
||||
emoji_data[0]).set_color(color).set_origin_watched_address(address).save_changes()
|
||||
account_popup.wait_until_hidden()
|
||||
|
||||
with step('Check authentication popup does not appear'):
|
||||
@ -41,7 +46,7 @@ def test_plus_button_add_watched_address(
|
||||
assert message == f'"{name}" successfully added'
|
||||
|
||||
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, color.lower(), emoji_data[1].split('-')[0])
|
||||
started_at = time.monotonic()
|
||||
while expected_account not in wallet.left_panel.accounts:
|
||||
time.sleep(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user