Skip to content

Commit

Permalink
fix(@desktop/sugnup): Profile omage chosen during signup sould be sav…
Browse files Browse the repository at this point in the history
…ed for the user and squish test for the same

fixes #6861
  • Loading branch information
Khushboo-dev-cpp committed Aug 23, 2022
1 parent f2615e3 commit 7874534
Show file tree
Hide file tree
Showing 28 changed files with 180 additions and 465 deletions.
4 changes: 2 additions & 2 deletions src/app/modules/startup/module.nim
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,10 @@ method onNodeLogin*[T](self: Module[T], error: string) =
quit() # quit the app

if error.len == 0:
self.controller.cleanTmpData()
self.delegate.userLoggedIn()
if currStateObj.flowType() != FlowType.AppLogin:
self.controller.storeIdentityImage()
self.controller.cleanTmpData()
else:
self.view.setAppState(AppState.StartupState)
if currStateObj.flowType() == FlowType.AppLogin:
Expand Down Expand Up @@ -300,4 +300,4 @@ method onSharedKeycarModuleFlowTerminated*[T](self: Module[T], lastStepInTheCurr
self.keycardSharedModule = nil
if lastStepInTheCurrentFlow:
self.controller.cleanTmpData()
self.view.setCurrentStartupState(newWelcomeState(FlowType.General, nil))
self.view.setCurrentStartupState(newWelcomeState(FlowType.General, nil))
Binary file added test/ui-test/fixtures/images/doggo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion test/ui-test/src/screens/StatusMainScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MainScreenComponents(Enum):
PUBLIC_CHAT_ICON = "mainWindow_public_chat_icon_StatusIcon"
COMMUNITY_PORTAL_BUTTON = "navBarListView_Communities_Portal_navbar_StatusNavBarTabButton"
JOIN_PUBLIC_CHAT = "join_public_chat_StatusMenuItemDelegate"
SETTINGS_BUTTON = "settings_navbar_settings_icon_StatusIcon"
SETTINGS_BUTTON = "navBarListView_Settings_navbar_StatusNavBarTabButton"
WALLET_BUTTON = "wallet_navbar_wallet_icon_StatusIcon"
START_CHAT_BTN = "mainWindow_startChat"
CHAT_LIST = "chatList_Repeater"
Expand Down
81 changes: 80 additions & 1 deletion test/ui-test/src/screens/StatusWelcomeScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class SignUpComponents(Enum):
CONFIRM_PSW_AGAIN_INPUT: str = "onboarding_confirmPswAgain_Input"
FINALIZE_PSW_BUTTON: str = "onboarding_finalise_password_button"
PASSWORD_PREFERENCE: str = "mainWindow_I_prefer_to_use_my_password_StatusBaseText"

PROFILE_IMAGE_CROP_WORKFLOW_ITEM: str = "mainWindow_WelcomeScreen_Image_Crop_Workflow_Item"
PROFILE_IMAGE_CROPPER_ACCEPT_BUTTON: str = "mainWindow_WelcomeScreen_Image_Cropper_Accept_Button"
WELCOME_SCREEN_USER_PROFILE_IMAGE: str = "mainWindow_WelcomeScreen_User_Profile_Image"

class SeedPhraseComponents(Enum):
IMPORT_A_SEED_TEXT: str = "import_a_seed_phrase_StatusBaseText"
Expand All @@ -58,6 +60,24 @@ class PasswordStrengthPossibilities(Enum):
NUMBERS_SYMBOLS_LOWER_UPPER_GOOD = "numbers_symbols_lower_upper_good"
NUMBERS_SYMBOLS_LOWER_UPPER_GREAT = "numbers_symbols_lower_upper_great"

class MainScreen(Enum):
PROFILE_NAV_BAR_BUTTON: str = "mainWindow_ProfileNavBarButton"
SETTINGS_BUTTON = "settings_navbar_settings_icon_StatusIcon"

class UserContextStatusMenu(Enum):
USER_CONTEXT_MENU_VIEW_MY_PROFILE_BUTTON: str = "userContextMenu_ViewMyProfile_Action"

class MyProfileModal(Enum):
MY_PROFILE_MODAL_USER_IMAGE: str = "myProfileModal_UserImage"

class ProfileSettimgs(Enum):
PROFILE_SETTINGS_USER_IMAGE: str = "myProfileModal_UserImage"

class LoginView(Enum):
LOGIN_VIEW_USER_IMAGE: str = "loginView_userImage"
PASSWORD_INPUT = "loginView_passwordInput"
SUBMIT_BTN = "loginView_submitBtn"

class StatusWelcomeScreen:

def __init__(self):
Expand Down Expand Up @@ -99,6 +119,7 @@ def input_username_and_password_and_finalize_sign_up(self, username: str, passwo
def input_username(self, username: str):
type(SignUpComponents.USERNAME_INPUT.value, username)
click_obj_by_name(SignUpComponents.DETAILS_NEXT_BUTTON.value)

# There is another page with the same Next button
click_obj_by_name(SignUpComponents.DETAILS_NEXT_BUTTON.value)

Expand Down Expand Up @@ -152,4 +173,62 @@ def validate_password_strength(self, strength: str):
verify_screenshot("VP-PWStrength-numbers_symbols_lower_upper_great")

# TODO: Get screenshots in Linux

def input_profile_image(self, profileImageUrl: str):
workflow = get_obj(SignUpComponents.PROFILE_IMAGE_CROP_WORKFLOW_ITEM.value)
workflow.cropImage(profileImageUrl)
click_obj_by_name(SignUpComponents.PROFILE_IMAGE_CROPPER_ACCEPT_BUTTON.value)

def input_username_and_grab_profile_image_sreenshot(self, username: str):
type(SignUpComponents.USERNAME_INPUT.value, username)
click_obj_by_name(SignUpComponents.DETAILS_NEXT_BUTTON.value)

# take a screenshot of the profile image to compare it later with the main screen
profileIcon = wait_and_get_obj(SignUpComponents.WELCOME_SCREEN_USER_PROFILE_IMAGE.value)
img = object.grabScreenshot(profileIcon, {"delay": 200})
img.save("../shared/searchImages/profiletestimage.png")

# There is another page with the same Next button
click_obj_by_name(SignUpComponents.DETAILS_NEXT_BUTTON.value)

def input_username_profileImage_password_and_finalize_sign_up(self, profileImageUrl: str, username: str, password: str):
self.input_profile_image(profileImageUrl)

self.input_username_and_grab_profile_image_sreenshot(username)

self.input_password(password)

self.input_confirmation_password(password)

if sys.platform == "darwin":
click_obj_by_name(SignUpComponents.PASSWORD_PREFERENCE.value)

def profile_modal_image_is_updated(self):
click_obj_by_name(MainScreen.PROFILE_NAV_BAR_BUTTON.value)
click_obj_by_name(UserContextStatusMenu.USER_CONTEXT_MENU_VIEW_MY_PROFILE_BUTTON.value)
test.imagePresent("profiletestimage", {"tolerant": True, "threshold": 97, "minScale": 95, "maxScale": 100, "multiscale": True })

def profile_settings_image_is_updated(self):
# first time clicking on settings button closes the my profile modal
click_obj_by_name(MainScreen.SETTINGS_BUTTON.value)
click_obj_by_name(MainScreen.SETTINGS_BUTTON.value)
test.imagePresent("profiletestimage", { "tolerant": True, "threshold": 97, "minScale": 100, "maxScale": 183, "multiscale": True })

def grab_screenshot(self):
# take a screenshot of the profile image to compare it later with the main screen
loginUserName = wait_and_get_obj(LoginView.LOGIN_VIEW_USER_IMAGE.value)
img = object.grabScreenshot(loginUserName, {"delay": 200})
img.save("../shared/searchImages/loginUserName.png")

def profile_image_is_updated(self):
profileNavBarButton = wait_and_get_obj(MainScreen.PROFILE_NAV_BAR_BUTTON.value)
test.imagePresent("loginUserName", { "tolerant": True, "threshold": 98, "minScale": 85, "maxScale": 100, "multiscale": True })

click_obj(profileNavBarButton)
test.imagePresent("loginUserName", { "tolerant": True, "threshold": 99, "minScale": 95, "maxScale": 100, "multiscale": True })

def enter_password(self, password):
click_obj_by_name(LoginView.PASSWORD_INPUT.value)
type(LoginView.PASSWORD_INPUT.value, password)
click_obj_by_name(LoginView.SUBMIT_BTN.value)

15 changes: 14 additions & 1 deletion test/ui-test/src/utils/FileManager.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from remotesystem import RemoteSystem

import os
import os.path as path
import shutil
import distutils.dir_util

import test

def erase_directory(dir: str):
directory = path.abspath(path.join(__file__, dir))
Expand All @@ -27,3 +29,14 @@ def copy_directory(src: str, dst: str):
distutils.dir_util.copy_tree(src, dst)
except OSError:
os.remove(dst)

def delete_created_searchImage(fileName: str):
try:
remoteOS = RemoteSystem()
test.verify(remoteOS.deleteFile(fileName))
test.verify(not remoteOS.exists(fileName))
except Exception as e:
test.fail("RemoteSystem error", str(e))



2 changes: 2 additions & 0 deletions test/ui-test/testSuites/global_shared/scripts/bdd_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def hook(context):
context.userData = {}
context.userData["aut_name"] = _status_desktop_app_name
context.userData["status_data_folder_path"] = _status_data_folder_path
context.userData["fixtures_root"] = os.path.join(os.path.dirname(__file__), "../../../fixtures/")
context.userData["search_images"] = os.path.join(os.path.dirname(__file__), "../shared/searchImages/")

@OnScenarioEnd
def hook(context):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
mainWindow_ScrollView = {"container": statusDesktop_mainWindow, "type": "StatusScrollView", "unnamed": 1, "visible": True}
mainWindow_ScrollView_2 = {"container": statusDesktop_mainWindow, "occurrence": 2, "type": "StatusScrollView", "unnamed": 1, "visible": True}
mainWindow_ProfileNavBarButton = {"container": statusDesktop_mainWindow, "objectName": "statusProfileNavBarTabButton", "type": "StatusNavBarTabButton", "visible": True}
settings_navbar_settings_icon_StatusIcon = {"container": mainWindow_navBarListView_ListView, "objectName": "settings-icon", "type": "StatusIcon", "visible": True}

# User Status Profile Menu
userContextMenu_ViewMyProfile_Action = {"container": statusDesktop_mainWindow_overlay, "objectName": "userStatusViewMyProfileAction", "type": "StatusMenuItemDelegate", "visible": True}

# popups
close_popup_StatusFlatRoundButton = {"container": statusDesktop_mainWindow_overlay, "id": "closeButton", "type": "StatusFlatRoundButton", "unnamed": 1, "visible": True}
Expand All @@ -18,4 +22,4 @@
chatList_Repeater = {"container": statusDesktop_mainWindow, "objectName": "chatListItems", "type": "Repeater"}
mainWindow_startChat = {"checkable": True, "container": statusDesktop_mainWindow, "objectName": "startChatButton", "type": "StatusIconTabButton"}
join_public_chat_StatusMenuItemDelegate = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "text": "Join public chat", "type": "StatusMenuItemDelegate", "unnamed": 1, "visible": True}
mainWindow_statusIcon_StatusIcon_2 = {"container": statusDesktop_mainWindow, "id": "statusIcon", "source": "qrc:/StatusQ/src/assets/img/icons/public-chat.svg", "type": "StatusIcon", "unnamed": 1, "visible": True}
mainWindow_statusIcon_StatusIcon_2 = {"container": statusDesktop_mainWindow, "id": "statusIcon", "source": "qrc:/StatusQ/src/assets/img/icons/public-chat.svg", "type": "StatusIcon", "unnamed": 1, "visible": True}
10 changes: 10 additions & 0 deletions test/ui-test/testSuites/global_shared/scripts/login_names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from scripts.global_names import *

# Main:
loginView_passwordInput = {"container": statusDesktop_mainWindow, "objectName": "loginPasswordInput", "type": "StyledTextField"}
loginView_changeAccountBtn = {"container": statusDesktop_mainWindow, "objectName": "loginChangeAccountButton", "type": "StatusFlatRoundButton"}
loginView_submitBtn = {"container": statusDesktop_mainWindow, "type": "StatusRoundButton", "visible": True}
loginView_main = {"container": statusDesktop_mainWindow, "type": "LoginView", "visible": True}
loginView_errMsgLabel = {"container": statusDesktop_mainWindow, "objectName": "loginPassworkInputValidationErrorText", "type": "StatusBaseText", "visible": True}
accountsView_accountListPanel = {"container": statusDesktop_mainWindow, "type": "ListView", "visible": True} # This probably is missing an objectName
loginView_userImage = {"container": statusDesktop_mainWindow, "objectName": "loginViewUserImage", "type": "UserImage", "visible": True}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
onboarding_DetailsView_NextButton = {"container": statusDesktop_mainWindow, "objectName": "onboardingDetailsViewNextButton", "type": "StatusButton"}
mainWindow_I_prefer_to_use_my_password_StatusBaseText = {"container": statusDesktop_mainWindow, "objectName": "touchIdIPreferToUseMyPasswordText", "type": "StatusBaseText"}
mainWindow_Ok_got_it_StatusBaseText = {"container": statusDesktop_mainWindow, "type": "StatusButton", "objectName": "allowNotificationsOnboardingOkButton", "visible": True}
mainWindow_WelcomeScreen_User_Profile_Image = {"container": statusDesktop_mainWindow, "type": "StatusSmartIdenticon", "objectName": "welcomeScreenUserProfileImage"}
mainWindow_WelcomeScreen_Image_Crop_Workflow_Item= {"container": statusDesktop_mainWindow, "type": "Item", "objectName": "imageCropWorkflow"}
mainWindow_WelcomeScreen_Image_Cropper_Accept_Button= {"container": statusDesktop_mainWindow, "type": "StatusButton", "objectName": "imageCropperAcceptButton"}

# Seed phrase form:
import_a_seed_phrase_StatusBaseText = {"container": statusDesktop_mainWindow, "text": "Import a seed phrase", "type": "StatusBaseText", "unnamed": 1, "visible": True}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from objectmaphelper import *

from scripts.onboarding_names import *
from scripts.login_names import *
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,33 @@ def step(context, seed_phrase):
def step(context):
_welcomeScreen.seed_phrase_visible()

@When("the user logs in with password |any|")
def step(context, password: str):
_welcomeScreen.enter_password(password)

@Then("the user is online")
def step(context):
_mainScreen.user_is_online()

@When("the user signs up with profileImage |any| and username |any| and password |any|")
def step(context, profileImageUrl, username, password):
_welcomeScreen.input_username_profileImage_password_and_finalize_sign_up("file:///"+context.userData["fixtures_root"]+"images/"+profileImageUrl, username, password)

@Then("the my profile modal has the updated profile image")
def step(context):
_welcomeScreen.profile_modal_image_is_updated()

@Then("profile settings has the updated profile image")
def step(context):
_welcomeScreen.profile_settings_image_is_updated()

@When("a screenshot of the profileImage is taken")
def step(context):
_welcomeScreen.grab_screenshot()

@Then("the profile navBar has the updated profile image")
def step(context):
_welcomeScreen.profile_image_is_updated()
delete_created_searchImage(context.userData["search_images"] +"profiletestimage.png")
delete_created_searchImage(context.userData["search_images"]+"loginUserName.png")

Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,15 @@ Feature: Status Desktop Sign Up
Scenario: After Signing up the Profile state should be online
Given A first time user lands on the status desktop and generates new key
When user signs up with username tester123 and password TesTEr16843/!@00
Then the user is online
Then the user is online

Scenario: User signs up with a profile image

Given A first time user lands on the status desktop and generates new key
When the user signs up with profileImage doggo.jpeg and username tester123 and password TesTEr16843/!@00
Then the my profile modal has the updated profile image
And profile settings has the updated profile image
When the user restarts the app
And a screenshot of the profileImage is taken
And the user logs in with password TesTEr16843/!@00
Then the profile navBar has the updated profile image
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
from sections.chat_names import *
from sections.community_names import *
from sections.community_portal_names import *
from sections.login_names import *
from scripts.login_names import *
from sections.settings_names import *
from sections.wallet_names import *
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
loginView_main = {"container": statusDesktop_mainWindow, "type": "LoginView", "visible": True}
loginView_errMsgLabel = {"container": statusDesktop_mainWindow, "objectName": "loginPassworkInputValidationErrorText", "type": "StatusBaseText", "visible": True}
accountsView_accountListPanel = {"container": statusDesktop_mainWindow, "type": "ListView", "visible": True} # This probably is missing an objectName
loginView_userImage = {"container": statusDesktop_mainWindow, "objectName": "loginViewUserImage", "type": "UserImage", "visible": True}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class SettingsSubsection(Enum):

# Main:
navBarListView_Settings_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_navBarListView_ListView, "objectName": "Settings-navbar", "type": "StatusNavBarTabButton", "visible": True}
settings_navbar_settings_icon_StatusIcon = {"container": navBarListView_Settings_navbar_StatusNavBarTabButton, "objectName": "settings-icon", "type": "StatusIcon", "visible": True}
settingsSave_StatusButton = {"container": statusDesktop_mainWindow, "objectName": "settingsDirtyToastMessageSaveButton", "type": "StatusButton", "visible": True}
settings_Sidebar_ENS_Item = {"container": mainWindow_ScrollView, "objectName": "ENS usernames-MainMenu", "type": "StatusNavigationListItem"}

Expand Down Expand Up @@ -101,6 +100,9 @@ class SettingsSubsection(Enum):
languageView_language_ListView = {"container": languageView_language_StatusListPicker, "type": "ListView", "unnamed": 1}
languageView_language_StatusInput = {"container": languageView_language_ListView, "type": "StatusInput", "unnamed": 1}

# My Profile Modal
myProfileModal_UserImage = {"container": statusDesktop_mainWindow_overlay, "objectName": "myProfileModalUserImage", "type": "UserImage", "visible": True}

# Backup seed phrase:
backup_seed_phrase_popup_Acknowledgements_havePen_checkbox = {"container": statusDesktop_mainWindow_overlay, "objectName": "Acknowledgements_havePen", "type": "StatusCheckBox", "checkable": True, "visible": True}
backup_seed_phrase_popup_Acknowledgements_writeDown_checkbox = {"container": statusDesktop_mainWindow_overlay, "objectName": "Acknowledgements_writeDown", "type": "StatusCheckBox", "checkable": True, "visible": True}
Expand Down
1 change: 1 addition & 0 deletions ui/app/AppLayouts/Onboarding/views/InsertDetailsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ Item {
StatusSmartIdenticon {
anchors.left: parent.left
id: userImage
objectName: "welcomeScreenUserProfileImage"
image {
width: 86
height: 86
Expand Down
1 change: 1 addition & 0 deletions ui/app/AppLayouts/Onboarding/views/LoginView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ Item {

UserImage {
id: userImage
objectName: "loginViewUserImage"
image: root.startupStore.selectedLoginAccount.thumbnailImage
name: root.startupStore.selectedLoginAccount.username
colorId: root.startupStore.selectedLoginAccount.colorId
Expand Down
Loading

0 comments on commit 7874534

Please sign in to comment.