Skip to content

Commit

Permalink
dirty hack to make first test work
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiyaig committed Jan 23, 2025
1 parent 2f2eeea commit cdb6d02
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 106 deletions.
5 changes: 3 additions & 2 deletions test/e2e/gui/components/signing_phrase_popup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import allure

from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.objects_map import names


class SigningPhrasePopup(QObject):
class SigningPhrasePopup(BasePopup):

def __init__(self):
super().__init__(names.signPhrase_Ok_Button)
super().__init__()
self.ok_got_it_button = Button(names.signPhrase_Ok_Button)

@allure.step('Confirm signing phrase in popup')
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def sign_up(self, user_account: UserAccount):
confirm_password_view = create_password_view.create_password(user_account.password)
confirm_password_view.confirm_password(user_account.password)
if configs.system.get_platform() == "Darwin":
BiometricsView().wait_until_appears().prefer_password()
BiometricsView().wait_until_appears().maybe_later()
SplashScreen().wait_until_appears().wait_until_hidden()
YourEmojihashAndIdenticonRingView().verify_emojihash_view_present().next()
if configs.system.get_platform() == "Darwin":
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/gui/objects_map/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

# Common names
settingsSave_StatusButton = {"container": statusDesktop_mainWindow, "objectName": "settingsDirtyToastMessageSaveButton", "type": "StatusButton", "visible": True}
mainWindow_Save_changes_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow, "objectName": "settingsDirtyToastMessageSaveButton", "type": "StatusButton", "visible": True}
mainWindow_Save_changes_StatusButton = {"container": statusDesktop_mainWindow, "objectName": "settingsDirtyToastMessageSaveButton", "type": "StatusButton", "visible": True}
closeCrossPopupButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "headerActionsCloseButton", "type": "StatusFlatRoundButton", "visible": True}

# Main right panel
Expand Down Expand Up @@ -254,7 +254,7 @@
selected_tags_text = {"container": statusDesktop_mainWindow_overlay, "type": "StatusBaseText", "unnamed": 1, "visible": True}

# Signing phrase popup
signPhrase_Ok_Button = {"container": statusDesktop_mainWindow, "type": "StatusFlatButton", "objectName": "signPhraseModalOkButton", "visible": True}
signPhrase_Ok_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "signPhraseModalOkButton", "type": "StatusFlatButton", "visible": True}

# Sign transaction popup
cancel_transaction_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "cancelButton", "text": "Cancel", "type": "StatusButton", "visible": True}
Expand Down
18 changes: 11 additions & 7 deletions test/e2e/gui/objects_map/onboarding_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,13 @@
profileImageCropper = {"container": statusDesktop_mainWindow, "objectName": "imageCropWorkflow", "type": "ImageCropWorkflow", "visible": True}

# Create Password View
mainWindow_CreatePasswordView = {"container": statusDesktop_mainWindow, "type": "CreatePasswordView", "unnamed": 1, "visible": True}
mainWindow_passwordViewNewPassword = {"container": mainWindow_CreatePasswordView, "objectName": "passwordViewNewPassword", "type": "StatusPasswordInput", "visible": True}
mainWindow_passwordViewNewPasswordConfirm = {"container": mainWindow_CreatePasswordView, "objectName": "passwordViewNewPasswordConfirm", "type": "StatusPasswordInput", "visible": True}
mainWindow_CreatePasswordView = {"container": onboardingLayout, "type": "CreatePasswordPage", "unnamed": 1, "visible": True}
choosePasswordField = {"container": mainWindow_CreatePasswordView, "objectName": "passwordViewNewPassword", "type": "StatusPasswordInput", "visible": True}
repeatPasswordField = {"container": mainWindow_CreatePasswordView, "objectName": "passwordViewNewPasswordConfirm", "type": "StatusPasswordInput", "visible": True}
confirmPasswordButton = {"container": mainWindow_CreatePasswordView, "objectName": "btnConfirmPassword", "type": "StatusButton", "visible": True}



mainWindow_Create_password_StatusButton = {"checkable": False, "container": mainWindow_CreatePasswordView, "objectName": "onboardingCreatePasswordButton", "type": "StatusButton", "visible": True}
mainWindow_view_PasswordView = {"container": statusDesktop_mainWindow, "id": "view", "type": "PasswordView", "unnamed": 1, "visible": True}
mainWindow_RowLayout = {"container": statusDesktop_mainWindow, "type": "PassIncludesIndicator", "unnamed": 1, "visible": True}
Expand All @@ -136,7 +140,7 @@
loginView_addExistingUserItem_AccountMenuItemPanel = {"container": statusDesktop_mainWindow_overlay, "objectName": "LoginView_addExistingUserItem", "type": "AccountMenuItemPanel", "visible": True}
mainWindowUsePasswordInsteadStatusBaseText = {"container": statusDesktop_mainWindow, "text": "Use password instead", "type": "StatusBaseText", "unnamed": 1, "visible": True}

# Touch ID Auth View
mainWindow_TouchIDAuthView = {"container": statusDesktop_mainWindow, "type": "TouchIDAuthView", "unnamed": 1, "visible": True}
mainWindow_touchIdYesUseTouchIDButton = {"container": statusDesktop_mainWindow, "objectName": "touchIdYesUseTouchIDButton", "type": "StatusButton", "visible": True}
mainWindow_touchIdIPreferToUseMyPasswordText = {"container": statusDesktop_mainWindow, "objectName": "touchIdIPreferToUseMyPasswordText", "type": "StatusBaseText"}
# Enable biometrics view
enableBiometricsView = {"container": onboardingLayout, "type": "EnableBiometricsPage", "unnamed": 1, "visible": True}
enableBiometricsButton = {"container": enableBiometricsView, "objectName": "btnEnableBiometrics", "type": "StatusButton", "visible": True}
dontEnableBiometricsButton = {"container": enableBiometricsView, "objectName": "btnDontEnableBiometrics", "type": "StatusFlatButton", "visible": True}
55 changes: 31 additions & 24 deletions test/e2e/gui/screens/onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,11 @@ class CreatePasswordView(OnboardingView):

def __init__(self):
super(CreatePasswordView, self).__init__(onboarding_names.mainWindow_CreatePasswordView)
self._new_password_text_field = TextEdit(onboarding_names.mainWindow_passwordViewNewPassword)
self._confirm_password_text_field = TextEdit(onboarding_names.mainWindow_passwordViewNewPasswordConfirm)
self.choose_password_field = TextEdit(onboarding_names.choosePasswordField)
self.repeat_password_field = TextEdit(onboarding_names.repeatPasswordField)
self.confirm_password_button = Button(onboarding_names.confirmPasswordButton)

# TODO: revisit and remove if obsolete
self._create_button = Button(onboarding_names.mainWindow_Create_password_StatusButton)
self._password_view_object = QObject(onboarding_names.mainWindow_view_PasswordView)
self._strength_indicator = QObject(
Expand All @@ -466,6 +469,25 @@ def __init__(self):
self._show_icon = QObject(onboarding_names.mainWindow_show_icon_StatusIcon)
self._hide_icon = QObject(onboarding_names.mainWindow_hide_icon_StatusIcon)

@allure.step('Set password and open Confirmation password view')
def create_password(self, value: str) -> 'SplashScreen':
self.set_password_in_first_field(value)
self.set_password_in_confirmation_field(value)
self.confirm_password_button.click()
if configs.system.get_platform() == "Darwin":
assert BiometricsView().wait_until_appears().yes_use_biometrics_button.is_visible, f"Use biometrics button is not found"
BiometricsView().wait_until_appears().maybe_later()
return SplashScreen()

@allure.step('Fill in choose password field')
def set_password_in_first_field(self, value: str):
self.choose_password_field.text = value

@allure.step('Set password in confirmation field')
def set_password_in_confirmation_field(self, value: str):
self.repeat_password_field.text = value


@allure.step('Get password content from first field')
def get_password_from_first_field(self) -> str:
return str(self._new_password_text_field.object.displayText)
Expand Down Expand Up @@ -516,20 +538,9 @@ def click_hide_icon(self, index):
hide_icons = driver.findAllObjects(self._hide_icon.real_name)
driver.mouseClick(hide_icons[index])

@allure.step('Set password in first field')
def set_password_in_first_field(self, value: str):
self._new_password_text_field.text = value

@allure.step('Set password in confirmation field')
def set_password_in_confirmation_field(self, value: str):
self._confirm_password_text_field.text = value

@allure.step('Set password and open Confirmation password view')
def create_password(self, value: str) -> 'ConfirmPasswordView':
self.set_password_in_first_field(value)
self.set_password_in_confirmation_field(value)
self.click_create_password()
return ConfirmPasswordView().wait_until_appears()


def click_create_password(self):
self._create_button.click()
Expand Down Expand Up @@ -590,19 +601,15 @@ def get_password_from_confirmation_again_field(self) -> str:
class BiometricsView(OnboardingView):

def __init__(self):
super(BiometricsView, self).__init__(onboarding_names.mainWindow_TouchIDAuthView)
self._yes_use_touch_id_button = Button(onboarding_names.mainWindow_touchIdYesUseTouchIDButton)
self._prefer_password_button = Button(onboarding_names.mainWindow_touchIdIPreferToUseMyPasswordText)
super(BiometricsView, self).__init__(onboarding_names.enableBiometricsView)
self.yes_use_biometrics_button = Button(onboarding_names.enableBiometricsButton)
self.maybe_later_button = Button(onboarding_names.dontEnableBiometricsButton)

@allure.step('Select prefer password')
def prefer_password(self):
self._prefer_password_button.click()
@allure.step('Select maybe later option')
def maybe_later(self):
self.maybe_later_button.click()
self.wait_until_hidden()

@allure.step('Verify TouchID button')
def is_touch_id_button_visible(self):
return self._yes_use_touch_id_button.is_visible


class LoginView(QObject):

Expand Down
2 changes: 1 addition & 1 deletion test/e2e/gui/screens/settings_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self):
super().__init__(settings_names.mainWindow_MyProfileView)
self._scroll_view = Scroll(settings_names.settingsContentBase_ScrollView)
self._display_name_text_field = TextEdit(settings_names.displayName_TextEdit)
self._save_button = Button(names.mainWindow_Save_changes_StatusButton)
self.save_changes_button = Button(names.mainWindow_Save_changes_StatusButton)
self._bio_text_field = TextEdit(settings_names.bio_TextEdit)
self._add_more_links_label = TextLabel(settings_names.addMoreSocialLinks)
self._links_list = QObject(names.linksView)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/helpers/OnboardingHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def finalize_onboarding_and_login(profile_view, user_account):
confirm_password_view = create_password_view.create_password(user_account.password)
confirm_password_view.confirm_password(user_account.password)
if configs.system.get_platform() == "Darwin":
BiometricsView().wait_until_appears().prefer_password()
BiometricsView().wait_until_appears().maybe_later()
SplashScreen().wait_until_appears().wait_until_hidden()
next_view = YourEmojihashAndIdenticonRingView().verify_emojihash_view_present().next()
if configs.system.get_platform() == "Darwin":
Expand Down
Loading

0 comments on commit cdb6d02

Please sign in to comment.