test(community): add a test that deletes a community category
Close #6750
This commit is contained in:
parent
ade9086b81
commit
48b7f1c277
|
@ -26,28 +26,31 @@ def verify_text_matching(objName: str, text: str):
|
|||
|
||||
def verify_text_matching_insensitive(obj, text: str):
|
||||
test.verify(is_text_matching_insensitive(obj, text), "text does not match")
|
||||
|
||||
def verify_equal(result: object, expected: object):
|
||||
test.verify(result == expected, "Checking if objects are equal")
|
||||
|
||||
def verify_equal(result: object, expected: object, msg: str = "objects are not equal"):
|
||||
test.verify(result == expected, msg)
|
||||
|
||||
def verify(result: bool, msg: str):
|
||||
test.verify(result, msg)
|
||||
|
||||
|
||||
def verify_false(result: bool, msg: str):
|
||||
test.verify(not result, msg)
|
||||
|
||||
def verify_values_equal(found: str, wanted: str, msg : str):
|
||||
test.verify(found == wanted, msg + " Found: " + found + " - Wanted: " + wanted)
|
||||
|
||||
|
||||
def verify_text_contains(text: str, substring: str):
|
||||
found = False
|
||||
if substring in text:
|
||||
found = True
|
||||
verify(found, "Given substring: " + substring + " and complete text: " + text)
|
||||
|
||||
|
||||
def verify_text_does_not_contain(text: str, substring: str):
|
||||
found = False
|
||||
if substring in text:
|
||||
found = True
|
||||
verify(not found, "Given substring: " + substring + " and complete text: " + text)
|
||||
|
||||
|
||||
def verify_text(text1: str, text2: str):
|
||||
test.compare(text1, text2, "Text 1: " + text1 + "\nText 2: " + text2)
|
||||
|
||||
|
@ -91,6 +94,6 @@ def verify_equals(val1, val2):
|
|||
|
||||
def verify_failure(errorMsg: str):
|
||||
test.fail(errorMsg)
|
||||
|
||||
|
||||
def log(text: str):
|
||||
test.log(text)
|
||||
|
|
|
@ -28,6 +28,9 @@ class CommunityScreenComponents(Enum):
|
|||
COMMUNITY_CREATE_CHANNEL_OR_CAT_BUTTON = "mainWindow_createChannelOrCategoryBtn_StatusBaseText"
|
||||
COMMUNITY_CREATE_CHANNEL_MENU_ITEM = "create_channel_StatusMenuItemDelegate"
|
||||
COMMUNITY_CREATE_CATEGORY_MENU_ITEM = "create_category_StatusMenuItemDelegate"
|
||||
COMMUNITY_EDIT_CATEGORY_MENU_ITEM = "edit_сategory_StatusMenuItemDelegate"
|
||||
COMMUNITY_DELETE_CATEGORY_MENU_ITEM = "delete_сategory_StatusMenuItemDelegate"
|
||||
COMMUNITY_CONFIRM_DELETE_CATEGORY_BUTTON = "confirmDeleteCategoryButton_StatusButton"
|
||||
CHAT_IDENTIFIER_CHANNEL_NAME = "msgDelegate_channelIdentifierNameText_StyledText"
|
||||
CHAT_IDENTIFIER_CHANNEL_ICON = "mainWindow_chatInfoBtnInHeader_StatusChatInfoButton"
|
||||
CHAT_MORE_OPTIONS_BUTTON = "chat_moreOptions_menuButton"
|
||||
|
@ -133,7 +136,7 @@ class StatusCommunityScreen:
|
|||
elif (method == CommunityCreateMethods.RIGHT_CLICK_MENU.value):
|
||||
right_click_obj_by_name(CommunityScreenComponents.COMMUNITY_COLUMN_VIEW.value)
|
||||
else:
|
||||
test.fail("Unknown method to create a category: ", method)
|
||||
verify_failure("Unknown method to create a category: ", method)
|
||||
|
||||
click_obj_by_name(CommunityScreenComponents.COMMUNITY_CREATE_CATEGORY_MENU_ITEM.value)
|
||||
|
||||
|
@ -143,14 +146,26 @@ class StatusCommunityScreen:
|
|||
if loaded:
|
||||
click_obj(listItem)
|
||||
else:
|
||||
test.fail("Can't find channel " + community_channel_name)
|
||||
verify_failure("Can't find channel " + community_channel_name)
|
||||
|
||||
click_obj_by_name(CreateOrEditCommunityCategoryPopup.COMMUNITY_CATEGORY_BUTTON.value)
|
||||
|
||||
def delete_community_category(self, community_category_name):
|
||||
[loaded, category] = self._find_category_in_chat(community_category_name)
|
||||
verify(loaded, "Can't find category " + community_category_name)
|
||||
|
||||
# For some reason it clicks on a first channel in category instead of category
|
||||
squish.mouseClick(category.parent, squish.Qt.RightButton)
|
||||
click_obj_by_name(CommunityScreenComponents.COMMUNITY_DELETE_CATEGORY_MENU_ITEM.value)
|
||||
click_obj_by_name(CommunityScreenComponents.COMMUNITY_CONFIRM_DELETE_CATEGORY_BUTTON.value)
|
||||
|
||||
def verify_category_name(self, community_category_name):
|
||||
[result, _] = self._find_category_in_chat(community_category_name)
|
||||
if not result:
|
||||
test.fail("Can't find category " + community_category_name)
|
||||
verify(result, "Can't find category " + community_category_name)
|
||||
|
||||
def verify_category_name_missing(self, community_category_name):
|
||||
[result, _] = self._find_category_in_chat(community_category_name)
|
||||
verify_false(result, "Category " + community_category_name + " still exist")
|
||||
|
||||
def edit_community(self, new_community_name: str, new_community_description: str, new_community_color: str):
|
||||
click_obj_by_name(CommunityScreenComponents.COMMUNITY_HEADER_BUTTON.value)
|
||||
|
|
|
@ -6,18 +6,21 @@ mainWindow_communityColumnView_CommunityColumnView = {"container": statusDesktop
|
|||
mainWindow_communityHeader_StatusChatInfoButton = {"container": statusDesktop_mainWindow, "objectName": "communityHeaderButton", "type": "StatusChatInfoButton", "visible": True}
|
||||
community_ChatInfo_Name_Text = {"container": mainWindow_communityHeader_StatusChatInfoButton, "objectName": "statusChatInfoButtonNameText", "type": "StatusBaseText", "visible": True}
|
||||
mainWindow_createChannelOrCategoryBtn_StatusBaseText = {"container": statusDesktop_mainWindow, "objectName": "createChannelOrCategoryBtn", "type": "StatusBaseText", "visible": True}
|
||||
create_channel_StatusMenuItemDelegate = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "createCommunityChannelBtn", "type": "StatusMenuItemDelegate", "visible": True}
|
||||
create_category_StatusMenuItemDelegate = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "createCommunityCategoryBtn", "type": "StatusMenuItemDelegate", "visible": True}
|
||||
create_channel_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "createCommunityChannelBtn", "type": "StatusMenuItemDelegate", "visible": True}
|
||||
create_category_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "createCommunityCategoryBtn", "type": "StatusMenuItemDelegate", "visible": True}
|
||||
edit_сategory_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "editCategoryMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
|
||||
delete_сategory_StatusMenuItemDelegate = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "deleteCategoryMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
|
||||
confirmDeleteCategoryButton_StatusButton = {"container": statusDesktop_mainWindow, "objectName": "confirmDeleteCategoryButton", "type": "StatusButton"}
|
||||
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}
|
||||
edit_Channel_StatusMenuItemDelegate = {"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}
|
||||
delete_Channel_StatusMenuItemDelegate = {"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"}
|
||||
mainWindow_chatInfoBtnInHeader_StatusChatInfoButton = {"container": statusDesktop_mainWindow, "objectName": "chatInfoBtnInHeader", "type": "StatusChatInfoButton", "visible": True}
|
||||
communityChatListCategories_Repeater = {"container": statusDesktop_mainWindow, "objectName": "communityChatListCategories", "type": "Repeater"}
|
||||
|
||||
# Community channel popup:``
|
||||
# Community channel popup:
|
||||
createOrEditCommunityChannelNameInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityChannelNameInput", "type": "TextEdit", "visible": True}
|
||||
createOrEditCommunityChannelDescriptionInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityChannelDescriptionInput", "type": "TextEdit", "visible": True}
|
||||
createOrEditCommunityChannelBtn_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityChannelBtn", "type": "StatusButton", "visible": True}
|
||||
|
|
|
@ -41,10 +41,18 @@ def step(context, community_channel_name):
|
|||
def step(context, community_category_name, community_channel_name, method):
|
||||
_statusCommunityScreen.create_community_category(community_category_name, community_channel_name, method)
|
||||
|
||||
@When("the admin deletes category named |any|")
|
||||
def step(context, community_category_name):
|
||||
_statusCommunityScreen.delete_community_category(community_category_name)
|
||||
|
||||
@Then("the category named |any| is created")
|
||||
def step(context, community_category_name):
|
||||
_statusCommunityScreen.verify_category_name(community_category_name)
|
||||
|
||||
@Then("the category named |any| is missing")
|
||||
def step(context, community_category_name):
|
||||
_statusCommunityScreen.verify_category_name_missing(community_category_name)
|
||||
|
||||
@When("the admin edits the current community to the name |any| and description |any| and color |any|")
|
||||
def step(context, new_community_name, new_community_description, new_community_color):
|
||||
_statusCommunityScreen.edit_community(new_community_name, new_community_description, new_community_color)
|
||||
|
|
|
@ -69,7 +69,7 @@ Feature: Status Desktop community
|
|||
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 <community_channel_name>, with description Some description with the method <method>
|
||||
When the admin creates a community category named <community_category_name>, with channel <community_channel_name> and with the method <method>
|
||||
And the admin creates a community category named <community_category_name>, with channel <community_channel_name> and with the method <method>
|
||||
Then the category named <community_category_name> is created
|
||||
|
||||
Examples:
|
||||
|
@ -77,6 +77,17 @@ Feature: Status Desktop community
|
|||
| test-channel-1 | test-category-1 | bottom_menu |
|
||||
| test-channel-2 | test-category-2 | right_click_menu |
|
||||
|
||||
|
||||
Scenario: Admin deletes a community category
|
||||
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
|
||||
And the admin creates a community category named test-category, with channel test-channel and with the method bottom_menu
|
||||
Then the category named test-category is created
|
||||
When the admin deletes category named test-category
|
||||
Then the category named test-category is missing
|
||||
|
||||
|
||||
Scenario Outline: Admin edits a community
|
||||
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
|
||||
|
@ -88,6 +99,7 @@ Feature: Status Desktop community
|
|||
| new_community_name | new_community_description | new_community_color |
|
||||
| myCommunityNamedChanged | Cool new description 123 | #ff0000 |
|
||||
|
||||
|
||||
Scenario: User leaves community
|
||||
When the user creates a community named testCommunity, with description My community description, intro Community Intro and outro Community Outro
|
||||
Then the user lands on the community named testCommunity
|
||||
|
@ -96,6 +108,7 @@ Feature: Status Desktop community
|
|||
And the user leaves the community
|
||||
Then the count of communities in navbar is 0
|
||||
|
||||
|
||||
Scenario Outline: User changes the emoji of a 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
|
||||
|
|
|
@ -259,6 +259,7 @@ Item {
|
|||
}
|
||||
|
||||
StatusMenuItem {
|
||||
objectName: "editCategoryMenuItem"
|
||||
enabled: communityData.amISectionAdmin
|
||||
text: qsTr("Edit Category")
|
||||
icon.name: "edit"
|
||||
|
@ -277,6 +278,7 @@ Item {
|
|||
}
|
||||
|
||||
StatusMenuItem {
|
||||
objectName: "deleteCategoryMenuItem"
|
||||
enabled: communityData.amISectionAdmin
|
||||
text: qsTr("Delete Category")
|
||||
icon.name: "delete"
|
||||
|
@ -551,6 +553,7 @@ Item {
|
|||
id: deleteCategoryConfirmationDialogComponent
|
||||
ConfirmationDialog {
|
||||
property string categoryId
|
||||
confirmButtonObjectName: "confirmDeleteCategoryButton"
|
||||
btnType: "warn"
|
||||
showCancelButton: true
|
||||
onClosed: {
|
||||
|
|
Loading…
Reference in New Issue