From 021d06deb80a5d41a9bbce25c68f192282531dc1 Mon Sep 17 00:00:00 2001 From: Anastasiya Semenkevich Date: Thu, 18 Jul 2024 11:44:36 +0300 Subject: [PATCH] chore: add background color verification for avatar --- test/e2e/constants/colors.py | 20 +++++++++++++++++++ test/e2e/gui/main_window.py | 6 +++--- .../test_onboarding_generate_new_keys.py | 13 +++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/test/e2e/constants/colors.py b/test/e2e/constants/colors.py index 65165b77df..8056f72fba 100644 --- a/test/e2e/constants/colors.py +++ b/test/e2e/constants/colors.py @@ -59,3 +59,23 @@ class ColorCodes(Enum): class EmojiCodes(Enum): SMILING_FACE_WITH_SUNGLASSES = '1f60e' THUMBSUP_SIGN = '1f44d' + + +class AvatarColors: + @staticmethod + def available_colors(): + return [ + "#2946C4", + "#887AF9", + "#51D0F0", + "#D37EF4", + "#FA6565", + "#FFCA0F", + "#7CDA00", + "#26A69A", + "#8B3131", + "#9B832F", + "#C0C0C0", + "#A9A9A9" + + ] diff --git a/test/e2e/gui/main_window.py b/test/e2e/gui/main_window.py index da39849015..748b1d7019 100644 --- a/test/e2e/gui/main_window.py +++ b/test/e2e/gui/main_window.py @@ -35,7 +35,7 @@ class LeftPanel(QObject): def __init__(self): super(LeftPanel, self).__init__(names.mainWindow_StatusAppNavBar) - self._profile_button = Button(names.mainWindow_ProfileNavBarButton) + self.profile_button = Button(names.mainWindow_ProfileNavBarButton) self._messages_button = Button(names.messages_navbar_StatusNavBarTabButton) self._communities_portal_button = Button(names.communities_Portal_navbar_StatusNavBarTabButton) self._community_template_button = Button(names.statusCommunityMainNavBarListView_CommunityNavBarButton) @@ -55,7 +55,7 @@ class LeftPanel(QObject): @property @allure.step('Get user badge color') def user_badge_color(self) -> str: - return str(self._profile_button.object.badge.color.name) + return str(self.profile_button.object.badge.color.name) @allure.step('Open messages screen') def open_messages_screen(self) -> MessagesScreen: @@ -65,7 +65,7 @@ class LeftPanel(QObject): @allure.step('Open online identifier') def open_online_identifier(self, attempts: int = 2) -> OnlineIdentifier: time.sleep(0.5) - self._profile_button.click() + self.profile_button.click() try: return OnlineIdentifier().wait_until_appears() except Exception as ex: diff --git a/test/e2e/tests/onboarding/test_onboarding_generate_new_keys.py b/test/e2e/tests/onboarding/test_onboarding_generate_new_keys.py index c34bf539d9..45e94e71ad 100755 --- a/test/e2e/tests/onboarding/test_onboarding_generate_new_keys.py +++ b/test/e2e/tests/onboarding/test_onboarding_generate_new_keys.py @@ -1,4 +1,3 @@ -import logging import random import string @@ -6,6 +5,7 @@ import allure import pytest from allure import step +import constants from . import marks import configs.timeouts @@ -30,8 +30,7 @@ def keys_screen(main_window) -> KeysView: @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703421', 'Generate new keys') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703010', 'Settings - Sign out & Quit') @pytest.mark.case(703421, 703010) -@pytest.mark.critical -# reason='https://github.com/status-im/status-desktop/issues/13013' +@pytest.mark.critical # TODO 'https://github.com/status-im/status-desktop/issues/13013' @pytest.mark.parametrize('user_name, password, user_image, zoom, shift', [ pytest.param( ''.join((random.choice( @@ -63,7 +62,6 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, keys_screen, with step('Click plus button and add user picture'): profile_view.set_profile_picture(configs.testpath.TEST_IMAGES / user_image) PictureEditPopup().set_zoom_shift_for_picture(zoom=zoom, shift=shift) - # TODO: find a way to verify the picture is there (changed to the custom one) assert profile_view.get_profile_image is not None, f'Profile picture was not set / applied' assert profile_view.is_next_button_enabled is True, \ f'Next button is not enabled on profile screen' @@ -105,6 +103,11 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, keys_screen, if not configs.system.TEST_MODE: BetaConsentPopup().confirm() + 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(), \ + f'Avatar color should be one of the allowed colors but is {avatar_color}' + with step('Open online identifier and check the data'): online_identifier = main_window.left_panel.open_online_identifier() assert online_identifier.get_user_name == user_name, \ @@ -133,7 +136,7 @@ def test_generate_new_keys_sign_out_from_settings(aut, main_window, keys_screen, assert share_profile_popup.is_profile_qr_code_visibile assert chat_key in profile_link, f'Profile link is wrong {profile_link}, it does not contain correct chat key' assert emoji_hash == emoji_hash_public_key, f'Public keys do not match' - share_profile_popup. close() + share_profile_popup.close() with step('Click left panel and open settings'): main_window.left_panel.click()