Skip to content

Commit

Permalink
test(tst_userIdentity): Fix test scenarios broken due to new user pro…
Browse files Browse the repository at this point in the history
…file design

- Fixed test scenarios broken due to new user profile design.
- Added new verifications in social links: github, youtube, discord and telegram.
- Scenario statements reorganization.

Fixes #8281
  • Loading branch information
noeliaSD committed Dec 20, 2022
1 parent 821b7f2 commit ec8c64d
Show file tree
Hide file tree
Showing 16 changed files with 223 additions and 131 deletions.
8 changes: 4 additions & 4 deletions test/ui-test/src/drivers/SquishDriverVerification.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ def verify_screen(objName: str, timeout: int=_MAX_WAIT_OBJ_TIMEOUT):

def verify_object_enabled(objName: str, timeout: int=_MIN_WAIT_OBJ_TIMEOUT, condition: bool=True):
result = is_loaded_visible_and_enabled(objName, timeout)
test.verify(result[0] == condition, "object not enabled")
test.verify(result[0] == condition, "Checking if object enabled")

def verify_text_matching(objName: str, text: str):
test.verify(is_text_matching(objName, text), "text does not match")
test.verify(is_text_matching(objName, text), "Checking if text matches")

def verify_text_matching_insensitive(obj, text: str):
test.verify(is_text_matching_insensitive(obj, text), "text does not match")
test.verify(is_text_matching_insensitive(obj, text), "Checking if test matches insensitive")

def verify_equal(result: object, expected: object, msg: str = "objects are not equal"):
def verify_equal(result: object, expected: object, msg: str = "Checking if objects are equal"):
test.verify(result == expected, msg)

def verify(result: bool, msg: str):
Expand Down
81 changes: 68 additions & 13 deletions test/ui-test/src/screens/SettingsScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,16 @@ class WalletSettingsScreen(Enum):
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"
TWITTER_SOCIAL_LINK: str = "twitter_TextEdit"
PERSONAL_SITE_SOCIAL_LINK: str = "personalSite_TextEdit"
OPEN_SOCIAL_LINKS_DIALOG: str = "addMoreSocialLinks_StatusIconTextButton"
CLOSE_SOCIAL_LINKS_DIALOG: str = "modal_Close_Button"
CLOSE_SOCIAL_LINKS_DIALOG: str = "closeButton_StatusHeaderAction"
TWITTER_SOCIAL_LINK_IN_DIALOG: str = "twitter_popup_TextEdit"
PERSONAL_SITE_LINK_IN_DIALOG: str = "personalSite_popup_TextEdit"
GITHUB_SOCIAL_LINK_IN_DIALOG: str = "github_popup_TextEdit"
YOUTUBE_SOCIAL_LINK_IN_DIALOG: str = "youtube_popup_TextEdit"
DISCORD_SOCIAL_LINK_IN_DIALOG: str = "discord_popup_TextEdit"
TELEGRAM_SOCIAL_LINK_IN_DIALOG: str = "telegram_popup_TextEdit"
CUSTOM_LINK_IN_DIALOG: str = "customLink_popup_TextEdit"
CUSTOM_URL_IN_DIALOG: str = "customUrl_popup_TextEdit"
CHANGE_PASSWORD_BUTTON: str = "change_password_button"
Expand Down Expand Up @@ -279,32 +283,83 @@ def set_bio(self, bio: str):
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):
def set_social_links(self, table):

twitter = ""
personal_site = ""
github = ""
youtube = ""
discord = ""
telegram = ""
custom_link_text = ""
custom_link = ""

if table is not None:
verify_equals(8, len(table)) # Expecting 8 as social media link fields to verify
twitter = table[0][0]
personal_site = table[1][0]
github = table[2][0]
youtube = table[3][0]
discord = table[4][0]
telegram = table[5][0]
custom_link_text = table[6][0]
custom_link = table[7][0]

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")

verify(setText(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")

verify(setText(ProfileSettingsScreen.PERSONAL_SITE_LINK_IN_DIALOG.value, personal_site), "set personal site")
click_obj_by_name(ProfileSettingsScreen.GITHUB_SOCIAL_LINK_IN_DIALOG.value)
verify(setText(ProfileSettingsScreen.GITHUB_SOCIAL_LINK_IN_DIALOG.value, github), "set github")
click_obj_by_name(ProfileSettingsScreen.YOUTUBE_SOCIAL_LINK_IN_DIALOG.value)
verify(setText(ProfileSettingsScreen.YOUTUBE_SOCIAL_LINK_IN_DIALOG.value, youtube), "set youtube")
click_obj_by_name(ProfileSettingsScreen.DISCORD_SOCIAL_LINK_IN_DIALOG.value)
verify(setText(ProfileSettingsScreen.DISCORD_SOCIAL_LINK_IN_DIALOG.value, discord), "set discord")
click_obj_by_name(ProfileSettingsScreen.TELEGRAM_SOCIAL_LINK_IN_DIALOG.value)
verify(setText(ProfileSettingsScreen.TELEGRAM_SOCIAL_LINK_IN_DIALOG.value, telegram), "set telegram")
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")

verify(setText(ProfileSettingsScreen.CUSTOM_LINK_IN_DIALOG.value, custom_link_text), "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")
verify(setText(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):
def verify_social_links(self, table):

twitter = ""
personal_site = ""
github = ""
youtube = ""
discord = ""
telegram = ""
custom_link_text = ""
custom_link = ""

if table is not None:
verify_equals(8, len(table)) # Expecting 8 as social media link fields to verify
twitter = table[0][0]
personal_site = table[1][0]
github = table[2][0]
youtube = table[3][0]
discord = table[4][0]
telegram = table[5][0]
custom_link_text = table[6][0]
custom_link = table[7][0]

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.GITHUB_SOCIAL_LINK_IN_DIALOG.value, github)
verify_text_matching(ProfileSettingsScreen.YOUTUBE_SOCIAL_LINK_IN_DIALOG.value, youtube)
verify_text_matching(ProfileSettingsScreen.DISCORD_SOCIAL_LINK_IN_DIALOG.value, discord)
verify_text_matching(ProfileSettingsScreen.TELEGRAM_SOCIAL_LINK_IN_DIALOG.value, telegram)
verify_text_matching(ProfileSettingsScreen.CUSTOM_LINK_IN_DIALOG.value, custom_link_text)
verify_text_matching(ProfileSettingsScreen.CUSTOM_URL_IN_DIALOG.value, custom_link)
click_obj_by_name(ProfileSettingsScreen.CLOSE_SOCIAL_LINKS_DIALOG.value)

Expand Down
17 changes: 5 additions & 12 deletions test/ui-test/src/screens/StatusMainScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@ class MainScreenComponents(Enum):

class ProfilePopup(Enum):
USER_IMAGE = "ProfileHeader_userImage"
DISPLAY_NAME = "ProfileHeader_displayName"
DISPLAY_NAME_EDIT_ICON = "ProfileHeader_displayNameEditIcon"

class DisplayNamePopup(Enum):
DISPLAY_NAME_INPUT = "DisplayNamePopup_displayNameInput"
DISPLAY_NAME_OK_BUTTON = "DisplayNamePopup_okButton"
DISPLAY_NAME = "ProfilePopup_displayName"
EDIT_PROFILE_BUTTON = "ProfilePopup_editButton"

class ChatNamePopUp(Enum):
CHAT_NAME_TEXT = "chat_name_PlaceholderText"
Expand Down Expand Up @@ -196,12 +192,6 @@ def open_own_profile_popup(self):

def verify_profile_popup_display_name(self, display_name: str):
verify_text_matching(ProfilePopup.DISPLAY_NAME.value, display_name)

def set_profile_popup_display_name(self, display_name: str):
click_obj_by_name(ProfilePopup.DISPLAY_NAME_EDIT_ICON.value)
name_changed = setText(DisplayNamePopup.DISPLAY_NAME_INPUT.value, display_name)
verify(name_changed, "set display name")
click_obj_by_name(DisplayNamePopup.DISPLAY_NAME_OK_BUTTON.value)

def click_escape(self):
press_escape(MainScreenComponents.MAIN_WINDOW.value)
Expand Down Expand Up @@ -236,3 +226,6 @@ def profile_settings_image_is_updated(self):
click_obj_by_name(MainScreenComponents.SETTINGS_BUTTON.value)
myProfileSettingsObject = wait_and_get_obj(MainScreenComponents.PROFILE_SETTINGS_VIEW.value)
image_present("profiletestimage", True, 95, 100, 183, True, myProfileSettingsObject)

def navigate_to_edit_profile(self):
click_obj_by_name(ProfilePopup.EDIT_PROFILE_BUTTON.value)
1 change: 1 addition & 0 deletions test/ui-test/testSuites/global_shared/scripts/bdd_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
@OnScenarioStart
def hook(context):
context_init(context, testSettings)
context.userData["scenario_name"] = context._data["title"]

@OnScenarioEnd
def hook(context):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def inner(*args, **kwargs):
context = args[0]
func(*args, **kwargs)

scenario = context.userData["scenario_name"].lower().replace(" ", "_")
scenario = context.userData["feature_name"].lower().replace(" ", "_")
step = context.userData["step_name"].lower().replace(" ", "_")
filename = f"{step}_{'_'.join(args[1:])}"
path = os.path.join(scenario, filename)
Expand Down
8 changes: 3 additions & 5 deletions test/ui-test/testSuites/global_shared/scripts/global_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# popups
modal_Close_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "modalCloseButtonRectangle", "type": "Rectangle", "visible": True}
delete_Channel_ConfirmationDialog_DeleteButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "deleteChatConfirmationDialogDeleteButton", "type": "StatusButton"}
closeButton_StatusHeaderAction = {"container": statusDesktop_mainWindow_overlay, "objectName": "headerActionsCloseButton", "type": "StatusFlatRoundButton", "visible": True}

# Main Window - chat related:
mainWindow_statusChatNavBarListView_ListView = {"container": statusDesktop_mainWindow, "objectName": "statusChatNavBarListView", "type": "ListView", "visible": True}
Expand All @@ -48,8 +49,5 @@

# My Profile Popup
ProfileHeader_userImage = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileHeader_userImage", "type": "UserImage", "visible": True}
ProfileHeader_displayName = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileHeader_displayName", "type": "StyledText", "visible": True}
ProfileHeader_displayNameEditIcon = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileHeader_displayNameEditIcon", "type": "SVGImage", "visible": True}
DisplayNamePopup_displayNameInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "DisplayNamePopup_displayNameInput", "type": "TextEdit", "visible": True}
DisplayNamePopup_okButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "DisplayNamePopup_okButton", "type": "StatusButton", "visible": True}

ProfilePopup_displayName = {"container": statusDesktop_mainWindow_overlay, "objectName": "ProfileDialog_displayName", "type": "StatusBaseText", "visible": True}
ProfilePopup_editButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "editProfileButton", "type": "StatusButton", "visible": True}
20 changes: 15 additions & 5 deletions test/ui-test/testSuites/global_shared/scripts/settings_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,27 @@ class SettingsSubsection(Enum):


# Profile Settings:
displayName_StatusInput = {"container": mainWindow_ScrollView_2, "objectName": "displayNameInput", "type": "StatusInput", "visible": True}
displayName_StatusInput = {"container": statusDesktop_mainWindow, "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_StatusInput = {"container": statusDesktop_mainWindow, "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_StaticSocialLinkInput = {"container": statusDesktop_mainWindow, "objectName": "__twitter-socialLinkInput", "type": "StaticSocialLinkInput", "visible": True}
twitter_TextEdit = {"container": twitter_StaticSocialLinkInput, "type": "TextEdit", "unnamed": 1, "visible": True}
personalSite_StaticSocialLinkInput = {"container": statusDesktop_mainWindow, "objectName": "__personal_site-socialLinkInput", "type": "StaticSocialLinkInput", "visible": True}
personalSite_TextEdit = {"container": personalSite_StaticSocialLinkInput, "type": "TextEdit", "unnamed": 1, "visible": True}
addMoreSocialLinks_StatusIconTextButton = {"container": statusDesktop_mainWindow, "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}
github_popup_StaticSocialLinkInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "__github-socialLinkInput", "type": "StaticSocialLinkInput", "visible": True}
github_popup_TextEdit = {"container": github_popup_StaticSocialLinkInput, "type": "TextEdit", "unnamed": 1, "visible": True}
youtube_popup_StaticSocialLinkInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "__youtube-socialLinkInput", "type": "StaticSocialLinkInput", "visible": True}
youtube_popup_TextEdit = {"container": youtube_popup_StaticSocialLinkInput, "type": "TextEdit", "unnamed": 1, "visible": True}
discord_popup_StaticSocialLinkInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "__discord-socialLinkInput", "type": "StaticSocialLinkInput", "visible": True}
discord_popup_TextEdit = {"container": discord_popup_StaticSocialLinkInput, "type": "TextEdit", "unnamed": 1, "visible": True}
telegram_popup_StaticSocialLinkInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "__telegram-socialLinkInput", "type": "StaticSocialLinkInput", "visible": True}
telegram_popup_TextEdit = {"container": telegram_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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
_status_data_folder = "status_data_folder_path"
_fixtures_root = "fixtures_root"
_search_images = "search_images"
_scenario_name = "scenario_name"
_feature_name = "feature_name"

def context_init(context, testSettings, screenshot_on_fail = True):
# With this property it is enabled that every test failure will cause Squish to take a screenshot of the desktop when the failure occurred
Expand All @@ -39,7 +39,7 @@ def context_init(context, testSettings, screenshot_on_fail = True):
context.userData[_fixtures_root] = os.path.join(os.path.dirname(__file__), _status_fixtures_folder_path)
context.userData[_search_images] = os.path.join(os.path.dirname(__file__), _status_shared_images_path)

context.userData[_scenario_name] = context._data["title"]
context.userData[_feature_name] = context._data["title"]

base_path = os.path.join(os.path.dirname(__file__))
split_path = base_path.split("/")
Expand Down
Loading

0 comments on commit ec8c64d

Please sign in to comment.