Skip to content

Commit

Permalink
chore(e2e): new onboarding tests changes
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiyaig committed Jan 27, 2025
1 parent cafd3ad commit 25908db
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 231 deletions.
21 changes: 13 additions & 8 deletions test/e2e/gui/components/onboarding/share_usage_data_popup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
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
from gui.objects_map import names, onboarding_names


class ShareUsageDataPopup(QObject):
# this is old modal shown on relogin
class ShareUsageDataPopup(BasePopup):

def __init__(self):
super().__init__(names.share_usage_data_StatusButton)
self._not_now_button = Button(names.not_now_StatusButton )
self._share_usage_data_button = Button(names.share_usage_data_StatusButton)
super().__init__()
self.not_now_button = Button(names.not_now_StatusButton)
self.share_usage_data_button = Button(names.share_usage_data_StatusButton)

@allure.step('Click not now button')
def skip(self):
self._not_now_button.click()

# this is new modal shown for initial onboarding
class HelpUsImproveStatusView(QObject):
def __init__(self):
super().__init__(onboarding_names.helpUsImproveStatusPage)
self.share_usage_data_button = Button(onboarding_names.shareUsageDataButton)
self.not_now_button = Button(onboarding_names.notNowButton)
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
31 changes: 14 additions & 17 deletions test/e2e/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,24 +176,21 @@ def prepare(self) -> 'Window':

@allure.step('Sign Up user')
def sign_up(self, user_account: UserAccount):
BeforeStartedPopUp().get_started()
welcome_screen = WelcomeToStatusView().wait_until_appears()
profile_view = welcome_screen.get_keys().generate_new_keys()
profile_view.set_display_name(user_account.name)
create_password_view = profile_view.next()
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()
SplashScreen().wait_until_appears().wait_until_hidden()
YourEmojihashAndIdenticonRingView().verify_emojihash_view_present().next()
if configs.system.get_platform() == "Darwin":
AllowNotificationsView().start_using_status()
SplashScreen().wait_until_appears().wait_until_hidden()
profile_view = welcome_screen.open_create_your_profile_view()
create_password_view = profile_view.open_password_view()
splash_screen = create_password_view.create_password(user_account.password)
splash_screen.wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm()
assert SigningPhrasePopup().ok_got_it_button.is_visible
SigningPhrasePopup().confirm_phrase()
signing_phrase = SigningPhrasePopup().wait_until_appears()
signing_phrase.confirm_phrase()
# since we now struggle with 3 words names, I need to change display name first
left_panel = LeftPanel()
profile = left_panel.open_settings().left_panel.open_profile_settings()
profile.set_name(user_account.name)
profile.save_changes_button.click()
left_panel.open_wallet()
return self

@allure.step('Log in user')
Expand All @@ -203,10 +200,10 @@ def log_in(self, user_account: UserAccount):
SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.system.TEST_MODE and not configs._local.DEV_BUILD:
BetaConsentPopup().confirm()
if share_updates_popup.is_visible:
share_updates_popup.not_now_button.click()
if SigningPhrasePopup().is_visible:
SigningPhrasePopup().confirm_phrase()
if share_updates_popup.is_visible:
share_updates_popup.skip()
return self

@allure.step('Authorize user')
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
40 changes: 33 additions & 7 deletions test/e2e/gui/objects_map/onboarding_names.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
from gui.objects_map.names import statusDesktop_mainWindow, statusDesktop_mainWindow_overlay

# New onboarding locators

startupOnboardingLayout = {"container": statusDesktop_mainWindow, "objectName": "startupOnboardingLayout", "type": "OnboardingLayout", "visible": True}
startupWelcomePage = {"container": startupOnboardingLayout, "type": "WelcomePage", "unnamed": 1, "visible": True}
startupNewsPage = {"container": startupOnboardingLayout, "id": "newsPage", "type": "ColumnLayout", "unnamed": 1, "visible": True}
startupCreateProfileButton = {"container": startupOnboardingLayout, "objectName": "btnCreateProfile", "type": "StatusButton", "visible": True}
startupLoginButton = {"container": startupOnboardingLayout, "objectName": "btnLogin", "type": "StatusButton", "visible": True}
startupApprovalLinks = {"container": startupOnboardingLayout, "objectName": "approvalLinks", "type": "StatusBaseText", "visible": True}

onboardingLayout = {"container": statusDesktop_mainWindow, "objectName": "OnboardingLayout", "type": "ContentItem", "visible": True}
helpUsImproveStatusPage = {"container": onboardingLayout, "type": "HelpUsImproveStatusPage", "unnamed": 1, "visible": True}
shareUsageDataButton = {"container": helpUsImproveStatusPage, "objectName": "btnShare", "type": "StatusButton", "visible": True}
notNowButton = {"container": statusDesktop_mainWindow, "objectName": "btnDontShare", "type": "StatusButton", "visible": True}


# CreateYourProfileView
onboardingFrame = {"container": onboardingLayout, "type": "OnboardingFrame", "unnamed": 1, "visible": True}
buttonFrame = {"container": onboardingLayout, "id": "buttonFrame", "type": "OnboardingButtonFrame", "unnamed": 1, "visible": True}
startFreshLetsGoButton = {"container": onboardingFrame, "objectName": "btnCreateWithPassword", "type": "StatusButton", "visible": True}
useRecoveryPhraseButton = {"container": buttonFrame, "objectName": "btnCreateWithSeedPhrase", "type": "ListItemButton", "visible": True}
useEmptyKeycardButton = {"container": statusDesktop_mainWindow, "objectName": "btnCreateWithEmptyKeycard", "type": "ListItemButton", "visible": True}

# Map for onboarding locators

mainWindow_onboardingBackButton_StatusRoundButton = {"container": statusDesktop_mainWindow, "objectName": "onboardingBackButton", "type": "StatusRoundButton", "visible": True}
Expand Down Expand Up @@ -85,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 @@ -114,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}
90 changes: 54 additions & 36 deletions test/e2e/gui/screens/onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from constants import ColorCodes
from driver.objects_access import walk_children
from gui.components.onboarding.keys_already_exist_popup import KeysAlreadyExistPopup
from gui.components.onboarding.share_usage_data_popup import ShareUsageDataPopup
from gui.components.onboarding.share_usage_data_popup import ShareUsageDataPopup, HelpUsImproveStatusView
from gui.components.os.open_file_dialogs import OpenFileDialog
from gui.components.picture_edit_popup import PictureEditPopup
from gui.components.splash_screen import SplashScreen
Expand Down Expand Up @@ -44,25 +44,36 @@ def start_using_status(self):
class WelcomeToStatusView(QObject):

def __init__(self):
super(WelcomeToStatusView, self).__init__(onboarding_names.mainWindow_WelcomeView)
self._i_am_new_to_status_button = Button(onboarding_names.mainWindow_I_am_new_to_Status_StatusBaseText)
self._i_already_use_status_button = Button(onboarding_names.mainWindow_I_already_use_Status_StatusFlatButton)
super().__init__(onboarding_names.startupOnboardingLayout)
self.create_profile_button = Button(onboarding_names.startupCreateProfileButton)
self.log_in_button = Button(onboarding_names.startupLoginButton)
self.approval_links = QObject(onboarding_names.startupApprovalLinks)

@allure.step('Open Keys view')
def get_keys(self) -> 'KeysView':
self._i_am_new_to_status_button.click()
time.sleep(1)
ShareUsageDataPopup().skip()
return KeysView().wait_until_appears()
@allure.step('Open Create your profile view')
def open_create_your_profile_view(self) -> 'CreateYourProfileView':
self.create_profile_button.click()
HelpUsImproveStatusView().not_now_button.click()
return CreateYourProfileView().wait_until_appears()

@allure.step('Open Sign by syncing form')
def sync_existing_user(self) -> 'SignBySyncingView':
self._i_already_use_status_button.click()
self.log_in_button.click()
time.sleep(1)
ShareUsageDataPopup().skip()
ShareUsageDataPopup().not_now_button.click()
return SignBySyncingView().wait_until_appears()


class CreateYourProfileView(WelcomeToStatusView):
def __init__(self):
super().__init__()
self.lets_go_button = Button(onboarding_names.startFreshLetsGoButton)
self.use_a_recovery_phrase_button = Button(onboarding_names.useRecoveryPhraseButton)
self.use_an_empty_keycard_button = Button(onboarding_names.useEmptyKeycardButton)

def open_password_view(self):
self.lets_go_button.click()
return CreatePasswordView()

class OnboardingView(QObject):

def __init__(self, object_name):
Expand Down Expand Up @@ -444,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 @@ -455,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 @@ -505,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 @@ -579,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
4 changes: 2 additions & 2 deletions test/e2e/helpers/OnboardingHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
with step('Open Generate new keys view'):
def open_generate_new_keys_view():
BeforeStartedPopUp().get_started()
keys_screen = WelcomeToStatusView().wait_until_appears().get_keys()
keys_screen = WelcomeToStatusView().wait_until_appears().open_create_your_profile_view()
return keys_screen


Expand All @@ -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 25908db

Please sign in to comment.