test(community): delete community channel
Also adds verify_equal helper function Fixes #6751
This commit is contained in:
parent
09d5d2a99a
commit
5fb4c7f110
|
@ -50,7 +50,7 @@ def verify_text_does_not_contain(text: str, substring: str):
|
|||
|
||||
def verify_text(text1: str, text2: str):
|
||||
test.compare(text1, text2, "Text 1: " + text1 + "\nText 2: " + text2)
|
||||
|
||||
|
||||
def process_terminated(pid):
|
||||
try:
|
||||
remotesys = RemoteSystem()
|
||||
|
@ -83,5 +83,8 @@ def verify_the_app_is_closed(pid: int):
|
|||
closed = True
|
||||
except:
|
||||
closed = False
|
||||
|
||||
|
||||
verify(closed, "app closed")
|
||||
|
||||
def verify_equals(val1, val2):
|
||||
test.compare(val1, val2, "1st value [" + str(val1) + ("] equal to " if val1 == val2 else "] NOT equal to ") + "2nd value [" + str(val2) + "]")
|
||||
|
|
|
@ -13,6 +13,7 @@ from enum import Enum
|
|||
import time
|
||||
from drivers.SquishDriver import *
|
||||
from drivers.SquishDriverVerification import *
|
||||
from drivers.SDKeyboardCommands import *
|
||||
|
||||
class MainUi(Enum):
|
||||
MODULE_WARNING_BANNER = "moduleWarning_Banner"
|
||||
|
@ -20,7 +21,7 @@ class MainUi(Enum):
|
|||
class CommunityCreateMethods(Enum):
|
||||
BOTTOM_MENU = "bottom_menu"
|
||||
RIGHT_CLICK_MENU = "right_click_menu"
|
||||
|
||||
|
||||
class CommunityScreenComponents(Enum):
|
||||
COMMUNITY_HEADER_BUTTON = "mainWindow_communityHeader_StatusChatInfoButton"
|
||||
COMMUNITY_HEADER_NAME_TEXT= "community_ChatInfo_Name_Text"
|
||||
|
@ -31,6 +32,10 @@ class CommunityScreenComponents(Enum):
|
|||
CHAT_MORE_OPTIONS_BUTTON = "chat_moreOptions_menuButton"
|
||||
EDIT_CHANNEL_MENU_ITEM = "edit_Channel_StatusMenuItemDelegate"
|
||||
COMMUNITY_COLUMN_VIEW = "mainWindow_communityColumnView_CommunityColumnView"
|
||||
DELETE_CHANNEL_MENU_ITEM = "delete_Channel_StatusMenuItemDelegate"
|
||||
DELETE_CHANNEL_CONFIRMATION_DIALOG_DELETE_BUTTON = "delete_Channel_ConfirmationDialog_DeleteButton"
|
||||
NOT_CATEGORIZED_CHAT_LIST = "mainWindow_communityColumnView_statusChatList"
|
||||
|
||||
|
||||
class CommunitySettingsComponents(Enum):
|
||||
EDIT_COMMUNITY_SCROLL_VIEW = "communitySettings_EditCommunity_ScrollView"
|
||||
|
@ -43,11 +48,11 @@ class CommunitySettingsComponents(Enum):
|
|||
COMMUNITY_NAME_TEXT = "communitySettings_CommunityName_Text"
|
||||
COMMUNITY_DESCRIPTION_TEXT = "communitySettings_CommunityDescription_Text"
|
||||
COMMUNITY_LETTER_IDENTICON = "communitySettings_Community_LetterIdenticon"
|
||||
|
||||
|
||||
class CommunityColorPanelComponents(Enum):
|
||||
HEX_COLOR_INPUT = "communitySettings_ColorPanel_HexColor_Input"
|
||||
SAVE_COLOR_BUTTON = "communitySettings_SaveColor_Button"
|
||||
|
||||
|
||||
class CreateOrEditCommunityChannelPopup(Enum):
|
||||
COMMUNITY_CHANNEL_NAME_INPUT: str = "createOrEditCommunityChannelNameInput_TextEdit"
|
||||
COMMUNITY_CHANNEL_DESCRIPTION_INPUT: str = "createOrEditCommunityChannelDescriptionInput_TextEdit"
|
||||
|
@ -57,10 +62,10 @@ class StatusCommunityScreen:
|
|||
|
||||
def __init__(self):
|
||||
verify_screen(CommunityScreenComponents.COMMUNITY_HEADER_BUTTON.value)
|
||||
|
||||
|
||||
def verify_community_name(self, communityName: str):
|
||||
verify_text_matching(CommunityScreenComponents.COMMUNITY_HEADER_NAME_TEXT.value, communityName)
|
||||
|
||||
|
||||
def create_community_channel(self, communityChannelName: str, communityChannelDescription: str, method: str):
|
||||
if (method == CommunityCreateMethods.BOTTOM_MENU.value):
|
||||
click_obj_by_name(CommunityScreenComponents.COMMUNITY_CREATE_CHANNEL_OR_CAT_BUTTON.value)
|
||||
|
@ -68,21 +73,19 @@ class StatusCommunityScreen:
|
|||
right_click_obj_by_name(CommunityScreenComponents.COMMUNITY_COLUMN_VIEW.value)
|
||||
else:
|
||||
print("Unknown method to create a channel: ", method)
|
||||
|
||||
|
||||
click_obj_by_name(CommunityScreenComponents.COMMUNITY_CREATE_CHANNEL__MENU_ITEM.value)
|
||||
|
||||
|
||||
wait_for_object_and_type(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_NAME_INPUT.value, communityChannelName)
|
||||
type(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_DESCRIPTION_INPUT.value, communityChannelDescription)
|
||||
click_obj_by_name(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_BUTTON.value)
|
||||
|
||||
# TODO check if this function is needed, it seems to do the same as verify_chat_title in StatusChatScreen
|
||||
|
||||
# TODO check if this function is needed, it seems to do the same as verify_chat_title in StatusChatScreen
|
||||
def verify_channel_name(self, community_channel_name: str):
|
||||
verify_text_matching(CommunityScreenComponents.CHAT_IDENTIFIER_CHANNEL_NAME.value, community_channel_name)
|
||||
|
||||
|
||||
def edit_community_channel(self, new_community_channel_name: str):
|
||||
[bannerLoaded, _] = is_loaded_visible_and_enabled(MainUi.MODULE_WARNING_BANNER.value)
|
||||
if (bannerLoaded):
|
||||
time.sleep(5) # Wait for the banner to disappear otherwise the click might land badly
|
||||
wait_for_banner_to_disappear()
|
||||
|
||||
click_obj_by_name(CommunityScreenComponents.CHAT_MORE_OPTIONS_BUTTON.value)
|
||||
click_obj_by_name(CommunityScreenComponents.EDIT_CHANNEL_MENU_ITEM.value)
|
||||
|
@ -100,23 +103,23 @@ class StatusCommunityScreen:
|
|||
# Select all text in the input before typing
|
||||
wait_for_object_and_type(CommunitySettingsComponents.EDIT_COMMUNITY_NAME_INPUT.value, "<Ctrl+a>")
|
||||
type(CommunitySettingsComponents.EDIT_COMMUNITY_NAME_INPUT.value, new_community_name)
|
||||
|
||||
|
||||
wait_for_object_and_type(CommunitySettingsComponents.EDIT_COMMUNITY_DESCRIPTION_INPUT.value, "<Ctrl+a>")
|
||||
type(CommunitySettingsComponents.EDIT_COMMUNITY_DESCRIPTION_INPUT.value, new_community_description)
|
||||
|
||||
|
||||
scroll_obj_by_name(CommunitySettingsComponents.EDIT_COMMUNITY_SCROLL_VIEW.value)
|
||||
time.sleep(1)
|
||||
scroll_obj_by_name(CommunitySettingsComponents.EDIT_COMMUNITY_SCROLL_VIEW.value)
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
click_obj_by_name(CommunitySettingsComponents.EDIT_COMMUNITY_COLOR_PICKER_BUTTON.value)
|
||||
wait_for_object_and_type(CommunityColorPanelComponents.HEX_COLOR_INPUT.value, "<Ctrl+a>")
|
||||
type(CommunityColorPanelComponents.HEX_COLOR_INPUT.value, new_community_color)
|
||||
click_obj_by_name(CommunityColorPanelComponents.SAVE_COLOR_BUTTON.value)
|
||||
|
||||
|
||||
click_obj_by_name(CommunitySettingsComponents.SAVE_BUTTON.value)
|
||||
time.sleep(0.5)
|
||||
|
||||
|
||||
# Validation
|
||||
verify_text_matching(CommunitySettingsComponents.COMMUNITY_NAME_TEXT.value, new_community_name)
|
||||
verify_text_matching(CommunitySettingsComponents.COMMUNITY_DESCRIPTION_TEXT.value, new_community_description)
|
||||
|
@ -125,3 +128,21 @@ class StatusCommunityScreen:
|
|||
|
||||
def go_back_to_community(self):
|
||||
click_obj_by_name(CommunitySettingsComponents.BACK_TO_COMMUNITY_BUTTON.value)
|
||||
|
||||
def delete_current_community_channel(self):
|
||||
wait_for_banner_to_disappear()
|
||||
|
||||
click_obj_by_name(CommunityScreenComponents.CHAT_MORE_OPTIONS_BUTTON.value)
|
||||
click_obj_by_name(CommunityScreenComponents.DELETE_CHANNEL_MENU_ITEM.value)
|
||||
click_obj_by_name(CommunityScreenComponents.DELETE_CHANNEL_CONFIRMATION_DIALOG_DELETE_BUTTON.value)
|
||||
|
||||
def check_channel_count(self, count_to_check: int):
|
||||
chatListObj = get_obj(CommunityScreenComponents.NOT_CATEGORIZED_CHAT_LIST.value)
|
||||
# Squish doesn't follow the type hints when parsing gherkin values
|
||||
verify_equals(chatListObj.statusChatListItems.count, int(count_to_check))
|
||||
|
||||
# Wait for the banner to disappear otherwise the click might land badly
|
||||
def wait_for_banner_to_disappear():
|
||||
[bannerLoaded, _] = is_loaded_visible_and_enabled(MainUi.MODULE_WARNING_BANNER.value)
|
||||
if (bannerLoaded):
|
||||
time.sleep(5)
|
|
@ -11,6 +11,9 @@ create_category_StatusMenuItemDelegate = {"checkable": False, "container": statu
|
|||
chat_moreOptions_menuButton = {"container": statusDesktop_mainWindow, "objectName": "chatToolbarMoreOptionsButton", "type": "StatusFlatRoundButton", "visible": True}
|
||||
edit_Channel_StatusMenuItemDelegate = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "editChannelMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
|
||||
msgDelegate_channelIdentifierNameText_StyledText = {"container": chatMessageListView_msgDelegate_MessageView, "objectName": "channelIdentifierNameText", "type": "StyledText", "visible": True}
|
||||
delete_Channel_StatusMenuItemDelegate = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "deleteOrLeaveMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
|
||||
mainWindow_communityColumnView_statusChatList = {"container": mainWindow_communityColumnView_CommunityColumnView, "objectName": "statusChatListAndCategoriesChatList", "type": "StatusChatList"}
|
||||
delete_Channel_ConfirmationDialog_DeleteButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "deleteChatConfirmationDialogDeleteButton", "type": "StatusButton"}
|
||||
|
||||
# Community channel popup:
|
||||
createOrEditCommunityChannelNameInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityChannelNameInput", "type": "TextEdit", "visible": True}
|
||||
|
|
|
@ -13,7 +13,7 @@ def step(context: any):
|
|||
_statusMainScreen.open_community_portal()
|
||||
|
||||
@Then("the user lands on the community portal section")
|
||||
def step(context):
|
||||
def step(context):
|
||||
StatusCommunityPortalScreen()
|
||||
|
||||
@When("the user creates a community named |any|, with description |any|, intro |any| and outro |any|")
|
||||
|
@ -24,17 +24,17 @@ def step(context, community_name, community_description, community_intro, commun
|
|||
def step(context, community_name):
|
||||
StatusCommunityScreen()
|
||||
_statusCommunityScreen.verify_community_name(community_name)
|
||||
|
||||
|
||||
@When("the admin creates a community channel named |any|, with description |any| with the method |any|")
|
||||
def step(context, community_channel_name, community_channel_description, method):
|
||||
_statusCommunityScreen.create_community_channel(community_channel_name, community_channel_description, method)
|
||||
|
||||
|
||||
@When("the admin edits the current community channel to the name |any|")
|
||||
def step(context, new_community_channel_name):
|
||||
_statusCommunityScreen.edit_community_channel(new_community_channel_name)
|
||||
|
||||
|
||||
@Then("the user lands on the community channel named |any|")
|
||||
def step(context, community_channel_name):
|
||||
def step(context, community_channel_name):
|
||||
_statusCommunityScreen.verify_channel_name(community_channel_name)
|
||||
|
||||
@When("the admin edits the current community to the name |any| and description |any| and color |any|")
|
||||
|
@ -44,4 +44,11 @@ def step(context, new_community_name, new_community_description, new_community_c
|
|||
@When("the admin goes back to the community")
|
||||
def step(context):
|
||||
_statusCommunityScreen.go_back_to_community()
|
||||
|
||||
|
||||
@When("the admin deletes current channel")
|
||||
def step(context):
|
||||
_statusCommunityScreen.delete_current_community_channel()
|
||||
|
||||
@Then("the channel count is |any|")
|
||||
def step(context, community_channel_count: int):
|
||||
_statusCommunityScreen.check_channel_count(community_channel_count)
|
||||
|
|
|
@ -65,3 +65,11 @@ Feature: Status Desktop community
|
|||
| new_community_name | new_community_description | new_community_color |
|
||||
| myCommunityNamedChanged | Cool new description 123 | #ff0000 |
|
||||
|
||||
Scenario: Admin deletes a community channel
|
||||
When the user creates a community named myCommunity, with description My community description, intro Community Intro and outro Community Outro
|
||||
Then the user lands on the community named myCommunity
|
||||
When the admin creates a community channel named test-channel, with description My description with the method bottom_menu
|
||||
Then the user lands on the community channel named test-channel
|
||||
And the channel count is 2
|
||||
When the admin deletes current channel
|
||||
Then the channel count is 1
|
|
@ -1 +1 @@
|
|||
Subproject commit 76cc5fda2254d9739da61df9bdb9ac5b23fa9513
|
||||
Subproject commit f15b0d4de4dd3c262d38f1eb0602c82079885194
|
|
@ -213,7 +213,7 @@ StatusPopupMenu {
|
|||
text: qsTr("Download")
|
||||
enabled: localAccountSensitiveSettings.downloadChannelMessagesEnabled
|
||||
icon.name: "download"
|
||||
onTriggered: downdloadDialog.open()
|
||||
onTriggered: downloadDialog.open()
|
||||
}
|
||||
|
||||
StatusMenuSeparator {
|
||||
|
@ -221,6 +221,7 @@ StatusPopupMenu {
|
|||
}
|
||||
|
||||
StatusMenuItem {
|
||||
objectName: "deleteOrLeaveMenuItem"
|
||||
id: deleteOrLeaveMenuItem
|
||||
text: {
|
||||
if (root.isCommunityChat) {
|
||||
|
@ -250,7 +251,7 @@ StatusPopupMenu {
|
|||
}
|
||||
|
||||
FileDialog {
|
||||
id: downdloadDialog
|
||||
id: downloadDialog
|
||||
acceptLabel: qsTr("Save")
|
||||
fileMode: FileDialog.SaveFile
|
||||
title: qsTr("Download messages")
|
||||
|
@ -258,13 +259,14 @@ StatusPopupMenu {
|
|||
defaultSuffix: "json"
|
||||
|
||||
onAccepted: {
|
||||
root.downloadMessages(downdloadDialog.currentFile)
|
||||
root.downloadMessages(downloadDialog.currentFile)
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: deleteChatConfirmationDialogComponent
|
||||
ConfirmationDialog {
|
||||
confirmButtonObjectName: "deleteChatConfirmationDialogDeleteButton"
|
||||
btnType: "warn"
|
||||
header.title: root.isCommunityChat ? qsTr("Delete #%1").arg(root.chatName) :
|
||||
root.chatType === Constants.chatType.oneToOne ?
|
||||
|
|
Loading…
Reference in New Issue