chore: add verification for identicon ring on the profile screen

This commit is contained in:
Anastasiya Semenkevich 2023-12-21 19:10:48 +03:00 committed by Anastasiya
parent 838c916fc2
commit 3deeeda620
5 changed files with 18 additions and 11 deletions

View File

@ -65,6 +65,7 @@ mainWindow_Plug_in_Keycard_reader_StatusBaseText = {"container": mainWindow_Keyc
mainWindow_InsertDetailsView = {"container": statusDesktop_mainWindow, "type": "InsertDetailsView", "unnamed": 1, "visible": True}
updatePicButton_StatusRoundButton = {"container": mainWindow_InsertDetailsView, "id": "updatePicButton", "type": "StatusRoundButton", "unnamed": 1, "visible": True}
mainWindow_CanvasItem = {"container": mainWindow_InsertDetailsView, "type": "CanvasItem", "unnamed": 1, "visible": True}
mainWindow_IdenticonRing = {"container": statusDesktop_mainWindow, "type": "StatusIdenticonRing", "unnamed": 1, "visible": True}
mainWindow_Next_StatusButton = {"container": statusDesktop_mainWindow, "objectName": "onboardingDetailsViewNextButton", "type": "StatusButton", "visible": True}
mainWindow_inputLayout_ColumnLayout = {"container": statusDesktop_mainWindow, "id": "inputLayout", "type": "ColumnLayout", "unnamed": 1, "visible": True}
mainWindow_statusBaseInput_StatusBaseInput = {"container": mainWindow_inputLayout_ColumnLayout, "objectName": "onboardingDisplayNameInput", "type": "TextEdit", "visible": True}

View File

@ -264,6 +264,7 @@ class YourProfileView(OnboardingView):
self._next_button = Button('mainWindow_Next_StatusButton')
self._login_input_object = QObject('mainWindow_nameInput_StatusInput')
self._clear_icon = QObject('mainWindow_clear_icon_StatusIcon')
self._identicon_ring = QObject('mainWindow_IdenticonRing')
@property
@allure.step('Get next button enabled state')
@ -272,9 +273,14 @@ class YourProfileView(OnboardingView):
@property
@allure.step('Get profile image')
def profile_image(self) -> Image:
def get_profile_image(self) -> Image:
return self._profile_image.image
@property
@allure.step('Check identicon ring visiblity')
def is_identicon_ring_visible(self):
return self._identicon_ring.is_visible
@property
@allure.step('Get error messages')
def get_error_message(self) -> str:
@ -304,10 +310,10 @@ class YourProfileView(OnboardingView):
return PictureEditPopup().wait_until_appears()
@allure.step('Open Emoji and Icon view')
def next(self, attempts: int = 2) -> 'EmojiAndIconView':
def next(self, attempts: int = 2) -> 'YourEmojihashAndIdenticonRingView':
self._next_button.click()
try:
return EmojiAndIconView().wait_until_appears()
return YourEmojihashAndIdenticonRingView().wait_until_appears()
except AssertionError as err:
if attempts:
return self.next(attempts - 1)
@ -320,10 +326,10 @@ class YourProfileView(OnboardingView):
return KeysView().wait_until_appears()
class EmojiAndIconView(OnboardingView):
class YourEmojihashAndIdenticonRingView(OnboardingView):
def __init__(self):
super(EmojiAndIconView, self).__init__('mainWindow_InsertDetailsView')
super(YourEmojihashAndIdenticonRingView, self).__init__('mainWindow_InsertDetailsView')
self._profile_image = QObject('mainWindow_welcomeScreenUserProfileImage_StatusSmartIdenticon')
self._chat_key_text_label = TextLabel('mainWindow_insertDetailsViewChatKeyTxt_StyledText')
self._next_button = Button('mainWindow_Next_StatusButton')
@ -483,7 +489,7 @@ class CreatePasswordView(OnboardingView):
@allure.step('Go back')
def back(self):
self._back_button.click()
return EmojiAndIconView().wait_until_appears()
return YourEmojihashAndIdenticonRingView().wait_until_appears()
class ConfirmPasswordView(OnboardingView):

View File

@ -43,14 +43,11 @@ def keys_screen(main_window) -> KeysView:
string.ascii_letters + string.digits + string.punctuation)
for _ in range(10, 28))
),
# TODO: add .tiff and .heif if https://github.com/status-im/status-desktop/issues/13077 is fixed
random.choice(['sample_JPEG_1920×1280.jpeg', 'file_example_PNG_3MB.png', 'file_example_JPG_2500kB.jpg']),
5,
shift_image(0, 1000, 1000, 0))
])
def test_generate_new_keys(main_window, keys_screen, user_name: str, password, user_image: str, zoom: int, shift):
with step('Click generate new keys and click back button'):
keys_screen.generate_new_keys().back()
with step('Click generate new keys and open profile view'):
profile_view = keys_screen.generate_new_keys()
@ -61,13 +58,16 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
profile_view.set_display_name(user_name)
assert profile_view.get_display_name() == user_name, \
f'Display name is empty or was not filled in'
assert not profile_view.get_error_message, \
f'Error message {profile_view.get_error_message} is present when it should not'
with step('Click plus button and add user picture'):
if user_image is not None:
profile_picture_popup = profile_view.set_user_image(configs.testpath.TEST_IMAGES / user_image)
profile_picture_popup.make_picture(zoom=zoom, shift=shift)
assert not profile_view.get_error_message, \
f'Error message {profile_view.get_error_message} is present when it should not'
# 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_identicon_ring_visible, f'Identicon ring is not present when it should'
with step('Open emojihash and identicon ring profile screen and capture the details'):
details_view = profile_view.next()