test(community): delete community channel
Also adds verify_equal helper function Fixes #6751
This commit is contained in:
parent
09d5d2a99a
commit
5fb4c7f110
|
@ -85,3 +85,6 @@ def verify_the_app_is_closed(pid: int):
|
|||
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"
|
||||
|
@ -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"
|
||||
|
@ -80,9 +85,7 @@ class StatusCommunityScreen:
|
|||
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)
|
||||
|
@ -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}
|
||||
|
|
|
@ -45,3 +45,10 @@ def step(context, new_community_name, new_community_description, new_community_c
|
|||
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