test(settings/profile): test bio and social links

Note: interaction between clients is not tested here to avoid dependency
on mailserver. When mailserver is mocked more comprehensive tests should
be provided, that is: verify if identity properties are propagated
and read correctly between two different clients.

closes: #6950
This commit is contained in:
Patryk Osmaczko 2022-08-12 17:51:33 +02:00 committed by osmaczko
parent 88ad09f7c2
commit aeb64e2029
16 changed files with 189 additions and 7 deletions

1
test/ui-test/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*__pycache__*

View File

@ -182,6 +182,16 @@ def wait_for_object_and_type(objName: str, text: str):
except LookupError:
return False
# It sets the specified text into the given object (first erase, then type)
def setText(objName: str, text: str):
try:
obj = squish.waitForObject(getattr(names, objName))
squish.type(obj, "<Ctrl+a>")
squish.type(obj, text)
return True
except LookupError:
return False
# Clicking link in label / textedit
def click_link(objName: str, link: str):
point = _find_link(getattr(names, objName), link)

View File

@ -15,11 +15,15 @@ from drivers.SquishDriverVerification import *
from .StatusMainScreen import MainScreenComponents
from .StatusMainScreen import StatusMainScreen
class SettingsScreenComponents(Enum):
SAVE_BUTTON: str = "settingsSave_StatusButton"
class SidebarComponents(Enum):
ADVANCED_OPTION: str = "advanced_StatusBaseText"
WALLET_ITEM: str = "wallet_AppMenu_StatusNavigationListItem"
SIGN_OUT_AND_QUIT: str = "sign_out_Quit_ExtraMenu_StatusNavigationListItem"
COMMUNITIES_ITEM: str = "communities_AppMenu_StatusNavigationListItem"
PROFILE_ITEM: str = "profile_MainMenu_StatusNavigationListItem"
class AdvancedOptionScreen(Enum):
@ -40,7 +44,18 @@ class WalletSettingsScreen(Enum):
ACCOUNT_VIEW_ACCOUNT_NAME: str = "settings_Wallet_AccountView_AccountName"
ACCOUNT_VIEW_ICON_SETTINGS: str = "settings_Wallet_AccountView_IconSettings"
class ProfileSettingsScreen(Enum):
DISPLAY_NAME: str = "displayName_TextEdit"
BIO: str = "bio_TextEdit"
TWITTER_SOCIAL_LINK: str = "twitter_StaticSocialLinkInput"
PERSONAL_SITE_SOCIAL_LINK: str = "personalSite_StaticSocialLinkInput"
OPEN_SOCIAL_LINKS_DIALOG: str = "addMoreSocialLinks_StatusIconTextButton"
CLOSE_SOCIAL_LINKS_DIALOG: str = "close_popup_StatusFlatRoundButton"
TWITTER_SOCIAL_LINK_IN_DIALOG: str = "twitter_popup_TextEdit"
PERSONAL_SITE_LINK_IN_DIALOG: str = "personalSite_popup_TextEdit"
CUSTOM_LINK_IN_DIALOG: str = "customLink_popup_TextEdit"
CUSTOM_URL_IN_DIALOG: str = "customUrl_popup_TextEdit"
class ConfirmationDialog(Enum):
SIGN_OUT_CONFIRMATION: str = "signOutConfirmation_StatusButton"
@ -148,3 +163,56 @@ class SettingsScreen:
# In our case we have only one visible community and only one button
click_obj_by_name(CommunitiesSettingsScreen.LEAVE_COMMUNITY_BUTTONS.value)
click_obj_by_name(CommunitiesSettingsScreen.LEAVE_COMMUNITY_POPUP_LEAVE_BUTTON.value)
def open_profile_settings(self):
verify_object_enabled(SidebarComponents.PROFILE_ITEM.value)
click_obj_by_name(SidebarComponents.PROFILE_ITEM.value)
def verify_display_name(self, display_name: str):
verify_text_matching(ProfileSettingsScreen.DISPLAY_NAME.value, display_name)
def set_display_name(self, display_name: str):
click_obj_by_name(ProfileSettingsScreen.DISPLAY_NAME.value)
name_changed = setText(ProfileSettingsScreen.DISPLAY_NAME.value, display_name)
verify(name_changed, "set display name")
click_obj_by_name(SettingsScreenComponents.SAVE_BUTTON.value)
self.verify_display_name(display_name)
def verify_bio(self, bio: str):
verify_text_matching(ProfileSettingsScreen.BIO.value, bio)
def set_bio(self, bio: str):
click_obj_by_name(ProfileSettingsScreen.BIO.value)
verify(setText(ProfileSettingsScreen.BIO.value, bio), "set bio")
click_obj_by_name(SettingsScreenComponents.SAVE_BUTTON.value)
self.verify_bio(bio)
def set_social_links(self, twitter, personal_site, custom_link_name, custom_link: str):
click_obj_by_name(ProfileSettingsScreen.OPEN_SOCIAL_LINKS_DIALOG.value)
click_obj_by_name(ProfileSettingsScreen.TWITTER_SOCIAL_LINK_IN_DIALOG.value)
verify(type(ProfileSettingsScreen.TWITTER_SOCIAL_LINK_IN_DIALOG.value, twitter), "set twitter")
click_obj_by_name(ProfileSettingsScreen.PERSONAL_SITE_LINK_IN_DIALOG.value)
verify(type(ProfileSettingsScreen.PERSONAL_SITE_LINK_IN_DIALOG.value, personal_site), "set personal site")
click_obj_by_name(ProfileSettingsScreen.CUSTOM_LINK_IN_DIALOG.value)
verify(type(ProfileSettingsScreen.CUSTOM_LINK_IN_DIALOG.value, custom_link_name), "set custom link name")
click_obj_by_name(ProfileSettingsScreen.CUSTOM_URL_IN_DIALOG.value)
verify(type(ProfileSettingsScreen.CUSTOM_URL_IN_DIALOG.value, custom_link), "set custom link url")
click_obj_by_name(ProfileSettingsScreen.CLOSE_SOCIAL_LINKS_DIALOG.value)
click_obj_by_name(SettingsScreenComponents.SAVE_BUTTON.value)
def verify_social_links(self, twitter, personal_site, custom_link_name, custom_link: str):
verify_text_matching(ProfileSettingsScreen.TWITTER_SOCIAL_LINK.value, twitter)
verify_text_matching(ProfileSettingsScreen.PERSONAL_SITE_SOCIAL_LINK.value, personal_site)
click_obj_by_name(ProfileSettingsScreen.OPEN_SOCIAL_LINKS_DIALOG.value)
verify_text_matching(ProfileSettingsScreen.TWITTER_SOCIAL_LINK_IN_DIALOG.value, twitter)
verify_text_matching(ProfileSettingsScreen.PERSONAL_SITE_LINK_IN_DIALOG.value, personal_site)
verify_text_matching(ProfileSettingsScreen.CUSTOM_LINK_IN_DIALOG.value, custom_link_name)
verify_text_matching(ProfileSettingsScreen.CUSTOM_URL_IN_DIALOG.value, custom_link)
click_obj_by_name(ProfileSettingsScreen.CLOSE_SOCIAL_LINKS_DIALOG.value)

View File

@ -44,7 +44,7 @@ class CommunitySettingsComponents(Enum):
EDIT_COMMUNITY_NAME_INPUT = "communitySettings_EditCommunity_Name_Input"
EDIT_COMMUNITY_DESCRIPTION_INPUT = "communitySettings_EditCommunity_Description_Input"
EDIT_COMMUNITY_COLOR_PICKER_BUTTON = "communitySettings_EditCommunity_ColorPicker_Button"
SAVE_BUTTON = "communitySettings_Save_Button"
SAVE_BUTTON = "settingsSave_StatusButton"
BACK_TO_COMMUNITY_BUTTON = "communitySettings_BackToCommunity_Button"
COMMUNITY_NAME_TEXT = "communitySettings_CommunityName_Text"
COMMUNITY_DESCRIPTION_TEXT = "communitySettings_CommunityDescription_Text"

View File

@ -9,3 +9,4 @@ from sections.login_names import *
from sections.onboarding_names import *
from sections.settings_names import *
from sections.wallet_names import *
displayNameInput_StatusInput_2 = {"container": mainWindow_ScrollView_2, "objectName": "displayNameInput", "type": "StatusInput", "visible": True}

View File

@ -41,7 +41,6 @@ communitySettings_EditCommunity_ScrollView = {"container": statusDesktop_mainWin
communitySettings_EditCommunity_Name_Input = {"container": communitySettings_EditCommunity_ScrollView, "objectName": "editCommunityNameInput", "type": "TextEdit"}
communitySettings_EditCommunity_Description_Input = {"container": communitySettings_EditCommunity_ScrollView, "objectName": "editCommunityDescriptionInput", "type": "TextEdit"}
communitySettings_EditCommunity_ColorPicker_Button = {"container": communitySettings_EditCommunity_ScrollView, "objectName": "editCommunityColorPicker", "type": "CommunityColorPicker"}
communitySettings_Save_Button = {"container": statusDesktop_mainWindow, "objectName": "settingsDirtyToastMessageSaveButton", "type": "StatusButton", "visible": True}
# Community color popup:
communitySettings_ColorPanel_HexColor_Input = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityColorPanelHexInput", "type": "TextEdit"}

View File

@ -5,4 +5,7 @@ mainWindow_navBarListView_ListView = {"container": statusDesktop_mainWindow, "ty
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}
# popups
close_popup_StatusFlatRoundButton = {"container": statusDesktop_mainWindow_overlay, "id": "closeButton", "type": "StatusFlatRoundButton", "unnamed": 1, "visible": True}

View File

@ -6,14 +6,33 @@ navBarListView_Settings_navbar_StatusNavBarTabButton = {"checkable": True, "cont
settings_navbar_settings_icon_StatusIcon = {"container": navBarListView_Settings_navbar_StatusNavBarTabButton, "objectName": "settings-icon", "type": "StatusIcon", "visible": True}
advanced_StatusBaseText = {"container": statusDesktop_mainWindow, "text": "Advanced", "type": "StatusBaseText", "unnamed": 1, "visible": True}
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}
wallet_AppMenu_StatusNavigationListItem = {"container": mainWindow_ScrollView, "objectName": "Wallet-AppMenu", "type": "StatusNavigationListItem", "visible": True}
communities_AppMenu_StatusNavigationListItem = {"container": mainWindow_ScrollView, "objectName": "Communities-AppMenu", "type": "StatusNavigationListItem", "visible": True}
profile_MainMenu_StatusNavigationListItem = {"container": mainWindow_ScrollView, "objectName": "Profile-MainMenu", "type": "StatusNavigationListItem", "visible": True}
settingsSave_StatusButton = {"container": statusDesktop_mainWindow, "objectName": "settingsDirtyToastMessageSaveButton", "type": "StatusButton", "visible": True}
# Profile Settings:
displayName_StatusInput = {"container": mainWindow_ScrollView_2, "objectName": "displayNameInput", "type": "StatusInput", "visible": True}
displayName_TextEdit = {"container": displayName_StatusInput, "type": "TextEdit", "unnamed": 1, "visible": True}
bio_StatusInput = {"container": mainWindow_ScrollView_2, "objectName": "bioInput", "type": "StatusInput", "visible": True}
bio_TextEdit = {"container": bio_StatusInput, "type": "TextEdit", "unnamed": 1, "visible": True}
twitter_StaticSocialLinkInput = {"container": mainWindow_ScrollView_2, "objectName": "__twitter-socialLinkInput", "type": "StaticSocialLinkInput", "visible": True}
personalSite_StaticSocialLinkInput = {"container": mainWindow_ScrollView_2, "objectName": "__personal_site-socialLinkInput", "type": "StaticSocialLinkInput", "visible": True}
addMoreSocialLinks_StatusIconTextButton = {"container": mainWindow_ScrollView_2, "objectName": "addMoreSocialLinksButton", "type": "StatusIconTextButton", "visible": True}
twitter_popup_StaticSocialLinkInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "__twitter-socialLinkInput", "type": "StaticSocialLinkInput", "visible": True}
twitter_popup_TextEdit = {"container": twitter_popup_StaticSocialLinkInput, "type": "TextEdit", "unnamed": 1, "visible": True}
personalSite_popup_StaticSocialLinkInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "__personal_site-socialLinkInput", "type": "StaticSocialLinkInput", "visible": True}
personalSite_popup_TextEdit = {"container": personalSite_popup_StaticSocialLinkInput, "type": "TextEdit", "unnamed": 1, "visible": True}
customLink_popup_StatusInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "hyperlinkInput", "type": "StatusInput", "visible": True}
customLink_popup_TextEdit = {"container": customLink_popup_StatusInput, "type": "TextEdit", "unnamed": 1, "visible": True}
customUrl_popup_StatusInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "urlInput", "type": "StatusInput", "visible": True}
customUrl_popup_TextEdit = {"container": customUrl_popup_StatusInput, "type": "TextEdit", "unnamed": 1, "visible": True}
# Wallet Settings:
settings_Wallet_MainView_GeneratedAccounts = {"container": statusDesktop_mainWindow, "objectName":'generatedAccounts', "type": 'ListView'}
settings_Wallet_AccountView_DeleteAccount = {"container": statusDesktop_mainWindow, "type": "StatusButton", "objectName": "deleteAccountButton"}
settings_Wallet_AccountView_DeleteAccount_Confirm = {"container": statusDesktop_mainWindow, "type": "StatusButton", "objectName": "confirmDeleteAccountButton"}
mainWindow_ScrollView_2 = {"container": statusDesktop_mainWindow, "occurrence": 2, "type": "StatusScrollView", "unnamed": 1, "visible": True}
settings_Wallet_MainView_Networks = {"container": statusDesktop_mainWindow, "objectName": "networksItem", "type": "StatusListItem"}
settings_Wallet_NetworksView_TestNet_Toggle = {"container": statusDesktop_mainWindow, "objectName": "testnetModeSwitch", "type": "StatusSwitch"}
settings_Wallet_AccountView_EditAccountButton = {"container": statusDesktop_mainWindow, "type": "StatusFlatRoundButton", "objectName": "walletAccountViewEditAccountButton"}
@ -35,4 +54,4 @@ i_understand_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "t
# Extra Settings:
sign_out_Quit_ExtraMenu_StatusNavigationListItem = {"container": mainWindow_ScrollView, "objectName": "Sign out & Quit-ExtraMenu", "type": "StatusNavigationListItem", "visible": True}
signOutConfirmation_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "signOutConfirmation", "type": "StatusButton", "visible": True}
signOutConfirmation_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "signOutConfirmation", "type": "StatusButton", "visible": True}

View File

@ -69,3 +69,39 @@ def step(context: any):
@When("the user leaves the community")
def step(context: any):
_settingsScreen.leave_community()
@When("the user opens the profile settings")
def step(context: any):
_settingsScreen.open_profile_settings()
@When("the user sets display name to \"|any|\"")
def step(context, display_name):
_settingsScreen.set_display_name(display_name)
@Then("the user's display name should be \"|any|\"")
def step(context, display_name):
_settingsScreen.verify_display_name(display_name)
@When("the user sets bio to \"|any|\"")
def step(context, bio):
_settingsScreen.set_bio(bio)
@Then("the user's bio should be empty")
def step(context):
_settingsScreen.verify_bio("")
@Then("the user's bio should be \"|any|\"")
def step(context, bio):
_settingsScreen.verify_bio(bio)
@When("the user sets display links to twitter: \"|any|\", personal site: \"|any|\", \"|any|\": \"|any|\"")
def step(context, twitter, personal_site, custom_link_name, custom_link):
_settingsScreen.set_social_links(twitter, personal_site, custom_link_name, custom_link)
@Then("the user's social links should be empty")
def step(context):
_settingsScreen.verify_social_links("", "", "", "")
@Then("the user's social links should be: \"|any|\", personal site: \"|any|\", \"|any|\": \"|any|\"")
def step(context, twitter, personal_site, custom_link_name, custom_link):
_settingsScreen.verify_social_links(twitter, personal_site, custom_link_name, custom_link)

View File

@ -5,6 +5,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAPSTYLE=script
TEST_CASES=tst_statusLoginPassword tst_basicChatFlow tst_wallet tst_communityFlows tst_groupChat tst_transaction tst_settingsMenu
TEST_CASES=tst_statusLoginPassword tst_basicChatFlow tst_wallet tst_communityFlows tst_groupChat tst_transaction tst_settingsMenu tst_userIdentity
VERSION=3
WRAPPERS=Qt

View File

@ -0,0 +1,24 @@
Feature: User Identity
As a user I want to set my identity, that is: display name, bio and social links.
Scenario: User sets display name, bio and social links
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 lands on the signed in app
When the user opens app settings screen
And the user opens the profile settings
Then the user's display name should be "tester123"
And the user's bio should be empty
And the user's social links should be empty
When the user sets display name to "tester123_changed"
And the user sets bio to "Hello, I am super tester!"
And the user sets display links to twitter: "twitter_handle", personal site: "status.im", "customLink": "customUrl"
And the user restarts the app
And the user tester123_changed logs in with password TesTEr16843/!@00
Then the user lands on the signed in app
When the user opens app settings screen
And the user opens the profile settings
Then the user's display name should be "tester123_changed"
And the user's bio should be "Hello, I am super tester!"
And the user's social links should be: "twitter_handle", personal site: "status.im", "customLink": "customUrl"

View File

@ -0,0 +1,8 @@
source(findFile('scripts', 'python/bdd.py'))
setupHooks('../shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps')
def main():
testSettings.throwOnFailure = True
runFeatureFile('test.feature')

View File

@ -31,6 +31,7 @@ Item {
StatusInput {
id: hyperlinkInput
objectName: "hyperlinkInput"
Layout.fillWidth: true
label: qsTr("Hyperlink Text")
@ -40,6 +41,7 @@ Item {
StatusInput {
id: urlInput
objectName: "urlInput"
Layout.fillWidth: true
label: qsTr("URL")

View File

@ -25,6 +25,7 @@ Column {
Repeater {
id: mainMenuItems
delegate: StatusNavigationListItem {
objectName: model.text + "-MainMenu"
itemId: model.subsection
title: model.text
icon.name: model.icon

View File

@ -31,6 +31,7 @@ Item {
StatusInput {
id: displayNameInput
objectName: "displayNameInput"
Layout.fillWidth: true
@ -43,6 +44,7 @@ Item {
StatusInput {
id: bioInput
objectName: "bioInput"
Layout.fillWidth: true
Layout.topMargin: 5 // by design
@ -59,6 +61,8 @@ Item {
Repeater {
model: root.socialLinksModel
delegate: StaticSocialLinkInput {
objectName: model.text + "-socialLinkInput"
Layout.fillWidth: true
linkType: model.linkType
text: model.url
@ -68,6 +72,7 @@ Item {
}
StatusIconTextButton {
objectName: "addMoreSocialLinksButton"
Layout.topMargin: -8 // by design
text: qsTr("Add more social links")
onClicked: root.addSocialLinksClicked()

View File

@ -15,6 +15,7 @@ import SortFilterProxyModel 0.2
StatusDialog {
id: root
objectName: "socialLinksModal"
property ProfileStore profileStore
@ -76,6 +77,8 @@ StatusDialog {
Repeater {
id: staticLinksRepeater
delegate: StaticSocialLinkInput {
objectName: model.text + "-socialLinkInput"
Layout.fillWidth: true
linkType: model.linkType
text: model.url
@ -100,6 +103,8 @@ StatusDialog {
Repeater {
id: customLinksRepeater
delegate: CustomSocialLinkInput {
objectName: "customSocialLinkInput"
Layout.fillWidth: true
hyperlink: model.text