chore: better init for online identifier

This commit is contained in:
Anastasiya Semenkevich 2023-12-21 20:44:15 +03:00 committed by Anastasiya
parent 3deeeda620
commit b59590aa1f
5 changed files with 30 additions and 23 deletions

View File

@ -14,13 +14,13 @@ from gui.elements.text_label import TextLabel
class OnlineIdentifier(QObject):
def __init__(self):
super(OnlineIdentifier, self).__init__('o_StatusListView')
super(OnlineIdentifier, self).__init__('onlineIdentifierProfileHeader')
self._always_active_button = Button('userContextmenu_AlwaysActiveButton')
self._inactive_button = Button('userContextmenu_InActiveButton')
self._automatic_button = Button('userContextmenu_AutomaticButton')
self._view_my_profile_button = Button('userContextMenu_ViewMyProfileAction')
self._user_name_text_label = TextLabel('userLabel_StyledText')
self._profile_image = QObject('o_StatusIdenticonRing')
self._identicon_ring = QObject('o_StatusIdenticonRing')
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
@ -28,13 +28,13 @@ class OnlineIdentifier(QObject):
return self
@property
@allure.step('Get profile image')
def profile_image(self):
return self._profile_image.image
@allure.step('Check identicon ring visibility')
def is_identicon_ring_visible(self):
return self._identicon_ring.is_visible
@property
@allure.step('Get user name')
def user_name(self) -> str:
def get_user_name(self) -> str:
return self._user_name_text_label.text
@allure.step('Set user state online')
@ -64,10 +64,3 @@ class OnlineIdentifier(QObject):
else:
raise ex
@allure.step('Verify: User image contains text')
def is_user_image_contains(self, text: str):
# To remove all artifacts, the image cropped.
crop = driver.UiTypes.ScreenRectangle(
5, 5, self._profile_image.image.width - 10, self._profile_image.image.height - 10
)
return self._profile_image.image.has_text(text, constants.tesseract.text_on_profile_image, crop=crop)

View File

@ -46,7 +46,7 @@ contactRequest_Send_Button = {"container": statusDesktop_mainWindow_overlay, "ob
close_the_app_now_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "type": "StatusButton", "unnamed": 1, "visible": True}
# User Status Profile Menu
o_StatusListView = {"container": statusDesktop_mainWindow_overlay, "type": "StatusListView", "unnamed": 1, "visible": True}
onlineIdentifierProfileHeader = {"container": statusDesktop_mainWindow_overlay, "objectName": "onlineIdentifierProfileHeader", "type": "ProfileHeader", "visible": True}
userContextmenu_AlwaysActiveButton= {"container": o_StatusListView, "objectName": "userStatusMenuAlwaysOnlineAction", "type": "StatusMenuItem", "visible": True}
userContextmenu_InActiveButton= {"container": o_StatusListView, "objectName": "userStatusMenuInactiveAction", "type": "StatusMenuItem", "visible": True}
userContextmenu_AutomaticButton= {"container": o_StatusListView, "objectName": "userStatusMenuAutomaticAction", "type": "StatusMenuItem", "visible": True}

View File

@ -277,7 +277,7 @@ class YourProfileView(OnboardingView):
return self._profile_image.image
@property
@allure.step('Check identicon ring visiblity')
@allure.step('Check identicon ring visibility')
def is_identicon_ring_visible(self):
return self._identicon_ring.is_visible

View File

@ -77,25 +77,39 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
assert details_view.is_identicon_ring_visible, f'Identicon ring is not present when it should'
details_view.back().next()
with step('Proceed with password set up and login'):
with step('Open password set up view, fill in the form and click back'):
create_password_view = details_view.next()
create_password_view.back().next()
assert not create_password_view.is_create_password_button_enabled, \
f'Create password button is enabled when it should not'
confirm_password_view = create_password_view.create_password(password)
confirm_password_view.back().click_create_password()
confirm_password_view.back()
assert create_password_view.get_password_from_first_field is not None, \
f'Password field lost its value when clicking back button'
assert create_password_view.get_password_from_confirmation_field is not None, \
f'Password confirmation field lost its value when clicking back button'
with step('Click create password and open password confirmation screen'):
confirm_password_view = create_password_view.click_create_password()
assert not confirm_password_view.is_confirm_password_button_enabled, \
f'Finalise Status password creation button is enabled when it should not'
with step('Confirm password and login'):
confirm_password_view.confirm_password(password)
if configs.system.IS_MAC:
assert BiometricsView().is_touch_id_button_visible(), f"TouchID button is not found"
BiometricsView().wait_until_appears().prefer_password()
SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE:
BetaConsentPopup().confirm()
#if not configs.system.TEST_MODE:
# BetaConsentPopup().confirm()
with step('Open online identifier and check the data'):
online_identifier = main_window.left_panel.open_online_identifier()
assert online_identifier.user_name == user_name, \
f'Display name in online identifier is wrong, current: {online_identifier.user_name}, expected: {user_name}'
assert online_identifier.get_user_name == user_name, \
f'Display name in online identifier is wrong, current: {online_identifier.get_user_name}, expected: {user_name}'
assert online_identifier.is_identicon_ring_visible, \
f'Identicon ring is not present when it should'
assert online_identifier.object.pubkey is not None, \
f'Public key is not present'
with step('Open user profile from online identifier and check the data'):
profile_popup = online_identifier.open_profile_popup_from_online_identifier()

View File

@ -89,7 +89,7 @@ def test_sync_device_during_onboarding(multiple_instance, user_data):
with step('Verify user details are the same with user in first instance'):
user_canvas = main_window.left_panel.open_online_identifier()
user_canvas_name = user_canvas.user_name
user_canvas_name = user_canvas.get_user_name
assert user_canvas_name == user.name
# TODO: temp removing tesseract usage because it is not stable
# assert driver.waitFor(