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 18, 2022
1 parent b34f0a4 commit 8b0ae40
Show file tree
Hide file tree
Showing 30 changed files with 126 additions and 467 deletions.
3 changes: 2 additions & 1 deletion src/app/modules/startup/controller.nim
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ proc storePasswordToKeychain(self: Controller) =
self.keychainService.storeData(account.name, data)

proc storeIdentityImage*(self: Controller) =
echo "storeIdentityImage >>>>>>>>>>>> ",self.tmpProfileImageDetails.url
if self.tmpProfileImageDetails.url.len == 0:
return
let account = self.accountsService.getLoggedInAccount()
Expand Down Expand Up @@ -392,4 +393,4 @@ proc buildSeedPhrasesFromIndexes*(self: Controller, seedPhraseIndexes: seq[int])
self.setSeedPhrase(sp.join(" "))

proc generateRandomPUK*(self: Controller): string =
return self.keycardService.generateRandomPUK()
return self.keycardService.generateRandomPUK()
5 changes: 3 additions & 2 deletions src/app/modules/startup/module.nim
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,17 @@ method emitObtainingPasswordSuccess*[T](self: Module[T], password: string) =
self.view.emitObtainingPasswordSuccess(password)

method onNodeLogin*[T](self: Module[T], error: string) =
echo "onNodeLogin >>>>"
let currStateObj = self.view.currentStartupStateObj()
if currStateObj.isNil:
error "cannot determine current startup state"
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 +301,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/dog-png-30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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: 2 additions & 0 deletions test/ui-test/src/drivers/SquishDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import object
import names
import test
import os
import os.path as path

from objectmaphelper import Wildcard

Expand Down
2 changes: 1 addition & 1 deletion test/ui-test/src/drivers/SquishDriverVerification.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ def verify_failure(errorMsg: str):
test.fail(errorMsg)

def log(text: str):
test.log(text)
test.log(text)
39 changes: 38 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,13 @@ 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"

ADD_PROFILE_IMAGE_BUTTON: str = "mainWindow_Update_Profile_Image_Button"
PROFILE_IMAGE_CROPPER: str = "mainWindow_Image_Cropper"
PROFILE_IMAGE_CROPPER_MODAL: str = "mainWindow_Image_Cropper_Modal"
PROFILE_IMAGE_SELECTION_MODAL: str = "mainWindow_Image_SELECTION_MODAL"
PROFILE_IMAGE_CROP_WORKFLOW_ITEM: str = "mainWindow_Image_Crop_Workflow_Item"
PROFILE_IMAGE_CROPPER_ACCEPT_BUTTON: str = "mainWindow_Image_Cropper_Accept_Button"
USER_PROFILE_IMAGE: str = "mainWindow_WelcomeScreen_User_Profile_Image"

class SeedPhraseComponents(Enum):
IMPORT_A_SEED_TEXT: str = "import_a_seed_phrase_StatusBaseText"
Expand All @@ -47,6 +53,9 @@ class SeedPhraseComponents(Enum):
TWENTY_FOUR_BUTTON: str = "switchTabBar_24_words_Button"
SEEDS_WORDS_TEXTFIELD_template: str = "onboarding_SeedPhrase_Input_TextField_"
SUBMIT_BUTTON: str = "seedPhraseView_Submit_Button"

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

class StatusWelcomeScreen:

Expand Down Expand Up @@ -114,3 +123,31 @@ def _agree_terms_and_conditions(self):
def seed_phrase_visible(self):
is_loaded_visible_and_enabled(SeedPhraseComponents.INVALID_SEED_TEXT.value)

def input_profileImage(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_profileImage_password_and_finalize_sign_up(self, profileImageUrl: str, username: str, password: str):
print("input_username_profileImage_password_and_finalize_sign_up >>> ", profileImageUrl)
self.input_profileImage(profileImageUrl)

self.input_username(username)

self.input_password(password)

self.input_confirmation_password(password)

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

def profile_image_updated(self, profileImageUrl: str):
print("profileImageUrl >>> ", profileImageUrl)
profileButton = wait_and_get_obj(MainScreen.PROFILE_NAV_BAR_BUTTON.value)

# img = object.grabScreenshot(profileButton, {"delay": 0})
# img.save("profileImage.png")

click_obj(profileButton)

abc = findImage("doggo.jpeg", {}, "all" )
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ 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/")

@OnScenarioEnd
def hook(context):
Expand Down
18 changes: 18 additions & 0 deletions test/ui-test/testSuites/suite_status/shared/scripts/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,21 @@
from sections.onboarding_names import *
from sections.settings_names import *
from sections.wallet_names import *
mainWindow_StatusWindow_QML_1623 = {"name": "mainWindow", "type": "StatusWindow_QML_1623", "visible": True}
mainWindow_tester123_StatusBaseText = {"container": mainWindow_StatusWindow_QML_1623, "text": "tester123", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_Overlay = {"container": mainWindow_StatusWindow_QML_1623, "type": "Overlay", "unnamed": 1, "visible": True}
o_AccountMenuItemPanel = {"checkable": False, "container": mainWindow_Overlay, "enabled": True, "type": "AccountMenuItemPanel", "unnamed": 1, "visible": True}
mainWindow_keysMainViewPrimaryActionButton_StatusButton = {"container": mainWindow_StatusWindow_QML_1623, "objectName": "keysMainViewPrimaryActionButton", "type": "StatusButton", "visible": True}
mainWindow_add_icon_StatusIcon = {"container": mainWindow_StatusWindow_QML_1623, "objectName": "add-icon", "source": "qrc:/StatusQ/src/assets/img/icons/add.svg", "type": "StatusIcon", "visible": True}
make_this_my_profile_picture_StatusBaseText = {"container": mainWindow_Overlay, "text": "Make this my profile picture", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_StyledTextField = {"container": mainWindow_StatusWindow_QML_1623, "echoMode": 2, "passwordCharacter": "•", "type": "StyledTextField", "unnamed": 1, "visible": True}
mainWindow_assasss_StatusBaseText = {"container": mainWindow_StatusWindow_QML_1623, "text": "assasss", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_Rectangle = {"container": mainWindow_StatusWindow_QML_1623, "type": "Rectangle", "unnamed": 1, "visible": True}
mainWindow_CanvasItem = {"container": mainWindow_StatusWindow_QML_1623, "type": "CanvasItem", "unnamed": 1, "visible": True}
mainWindow_Password_PlaceholderText = {"container": mainWindow_StatusWindow_QML_1623, "text": "Password", "type": "PlaceholderText", "unnamed": 1, "visible": True}
mainWindow_assasa_StatusBaseText = {"container": mainWindow_StatusWindow_QML_1623, "text": "assasa", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_Generate_new_keys_StatusBaseText = {"container": mainWindow_StatusWindow_QML_1623, "text": "Generate new keys", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_Khushboo_StatusBaseText = {"container": mainWindow_StatusWindow_QML_1623, "text": "Khushboo", "type": "StatusBaseText", "unnamed": 1, "visible": True}
o_CanvasItem = {"container": mainWindow_Overlay, "type": "CanvasItem", "unnamed": 1, "visible": True}
mainWindow_Create_password_StatusBaseText = {"container": mainWindow_StatusWindow_QML_1623, "text": "Create password", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_Finalise_Status_Password_Creation_StatusBaseText = {"container": mainWindow_StatusWindow_QML_1623, "text": "Finalise Status Password Creation", "type": "StatusBaseText", "unnamed": 1, "visible": True}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
chatView_log = {"container": statusDesktop_mainWindow, "objectName": "chatLogView", "type": "StatusListView", "visible": True}
chatMessageListView_msgDelegate_MessageView = {"container": chatView_log, "objectName": "chatMessageViewDelegate", "index": 1, "type": "MessageView", "visible": True}
moduleWarning_Banner = {"container": statusDesktop_mainWindow, "objectName": "moduleWarningBanner", "type": "Rectangle", "visible": True}
statusDesktop_mainWindow_AppMain_EmojiPopup_SearchTextInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "StatusEmojiPopup_searchBox", "type": "TextEdit", "visible": True}
statusDesktop_mainWindow_AppMain_EmojiPopup_SearchTextInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "StatusEmojiPopup_searchBox", "type": "TextEdit", "visible": True}
mainWindow_ProfileNavBarButton = {"container": statusDesktop_mainWindow, "objectName": "statusProfileNavBarTabButton", "type": "StatusNavBarTabButton", "visible": True}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
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_Update_Profile_Image_Button = {"container": statusDesktop_mainWindow, "type": "StatusRoundButton", "objectName": "welcomeScreenUpdatePicButton", "visible": True}
mainWindow_WelcomeScreen_User_Profile_Image = {"container": statusDesktop_mainWindow, "type": "StatusSmartIdenticon", "objectName": "welcomeScreenUserProfileImage"}


mainWindow_Image_Cropper = {"container": statusDesktop_mainWindow, "type": "StatusImageCropPanel", "objectName": "profileImageCropper", "visible": True}

mainWindow_Image_Cropper_Modal = {"container": statusDesktop_mainWindow, "type": "StatusModal", "objectName": "imageCropperModal"}
mainWindow_Image_SELECTION_MODAL = {"container": statusDesktop_mainWindow, "type": "FileDialog", "objectName": "selectProfileImageFileDialog"}
mainWindow_Image_Crop_Workflow_Item= {"container": statusDesktop_mainWindow, "type": "Item", "objectName": "imageCropWorkflow"}
mainWindow_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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,12 @@ def step(context, seed_phrase):
@Then("the invalid seed text is visible")
def step(context):
_welcomeScreen.seed_phrase_visible()

@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 profile navBar has the image |any|")
def step(context, profileImageUrl):
_welcomeScreen.profile_image_updated(context.userData["fixtures_root"]+"images/"+profileImageUrl)

Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,9 @@ Feature: Status Desktop Sign Up
Then the following ui-component seedPhraseView_Submit_Button is not enabled
And the invalid seed text is visible

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 profile navBar has the image doggo.jpeg

4 changes: 4 additions & 0 deletions ui/app/AppLayouts/Onboarding/stores/StartupStore.qml
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,8 @@ QtObject {
function getSeedPhrase() {
return root.startupModuleInst.getSeedPhrase()
}

function uploadImage(source, aX, aY, bX, bY) {
return profileSectionModule.profileModule.upload(source, aX, aY, bX, bY)
}
}
10 changes: 6 additions & 4 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 All @@ -106,6 +107,7 @@ Item {
}
StatusRoundButton {
id: updatePicButton
objectName: "welcomeScreenUpdatePicButton"
width: 40
height: 40
anchors.top: parent.top
Expand Down Expand Up @@ -233,10 +235,10 @@ Item {
acceptButtonText: qsTr("Make this my profile picture")
onImageCropped: {
const croppedImg = root.startupStore.generateImage(image,
cropRect.x.toFixed(),
cropRect.y.toFixed(),
(cropRect.x + cropRect.width).toFixed(),
(cropRect.y + cropRect.height).toFixed());
cropRect.x.toFixed(),
cropRect.y.toFixed(),
(cropRect.x + cropRect.width).toFixed(),
(cropRect.y + cropRect.height).toFixed());
userImage.image.source = croppedImg;
}
}
Expand Down
115 changes: 0 additions & 115 deletions ui/app/AppLayouts/Profile/popups/ChangeProfilePicModal.qml

This file was deleted.

1 change: 0 additions & 1 deletion ui/app/AppLayouts/Profile/popups/qmldir
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ChangeProfilePicModal 1.0 ChangeProfilePicModal.qml
BackupSeedModal 1.0 BackupSeedModal.qml
6 changes: 5 additions & 1 deletion ui/app/mainui/AppMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ Item {

navBarProfileButton: StatusNavBarTabButton {
id: profileButton
objectName: "statusProfileNavBarTabButton"
property bool opened: false

name: appMain.rootStore.userProfileInst.name
Expand Down Expand Up @@ -384,7 +385,10 @@ Item {
}
}

onClicked: userStatusContextMenu.opened ? userStatusContextMenu.close() : userStatusContextMenu.open()
onClicked: {
console.error(" >>>>>>>>>>>>> icon.source == ", Qt.resolvedUrl(icon.source))
userStatusContextMenu.opened ? userStatusContextMenu.close() : userStatusContextMenu.open()
}

UserStatusContextMenu {
id: userStatusContextMenu
Expand Down
Loading

0 comments on commit 8b0ae40

Please sign in to comment.