Skip to content

Commit

Permalink
test(community): add a test that deletes a community category
Browse files Browse the repository at this point in the history
Close #6750
  • Loading branch information
MishkaRogachev committed Aug 16, 2022
1 parent 9e81183 commit 3fa29b3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
18 changes: 18 additions & 0 deletions test/ui-test/src/screens/StatusCommunityScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class CreateOrEditCommunityCategoryPopup(Enum):
COMMUNITY_CATEGORY_NAME_INPUT: str = "createOrEditCommunityCategoryNameInput_TextEdit"
COMMUNITY_CATEGORY_LIST: str = "createOrEditCommunityCategoryChannelList_ListView"
COMMUNITY_CATEGORY_BUTTON: str = "createOrEditCommunityCategoryBtn_StatusButton"

class CommunityCategoryMenu(Enum):
EDIT_CATEGORY_MENU_ITEM: str = "editCategory_StatusMenuItem"
DELETE_CATEGORY_MENU_ITEM: str = "deleteCategory_StatusMenuItem"

class StatusCommunityScreen:

Expand Down Expand Up @@ -146,12 +150,26 @@ def create_community_category(self, community_category_name, community_channel_n
test.fail("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)
if not loaded:
test.fail("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(CommunityCategoryMenu.DELETE_CATEGORY_MENU_ITEM.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)

def verify_category_name_missing(self, community_category_name):
[result, _] = self._find_category_in_chat(community_category_name)
if result:
test.fail("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)
click_obj_by_name(CommunitySettingsComponents.EDIT_COMMUNITY_BUTTON.value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
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}
Expand All @@ -28,6 +28,10 @@
createOrEditCommunityCategoryChannelList_ListView = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityCategoryChannelList", "type": "StatusListView", "visible": True}
createOrEditCommunityCategoryBtn_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityCategoryBtn", "type": "StatusButton", "visible": True}

# Community category menu:
editCategory_StatusMenuItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "editCategoryMenuItem", "type": "StatusMenuItem", "visible": True}
deleteCategory_StatusMenuItem = {"container": statusDesktop_mainWindow_overlay, "objectName": "deleteCategoryMenuItem", "type": "StatusMenuItem", "visible": True}

# Community settings
communitySettings_EditCommunity_Button = {"container": statusDesktop_mainWindow, "objectName": "communityOverviewSettingsEditCommunityButton", "type": "StatusButton"}
communitySettings_BackToCommunity_Button = {"container": statusDesktop_mainWindow, "objectName": "communitySettingsBackToCommunityButton", "type": "StatusBaseText", "visible": True}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,17 @@ 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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ 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
When 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
Expand Down
2 changes: 2 additions & 0 deletions ui/app/AppLayouts/Chat/views/CommunityColumnView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ Item {
}

StatusMenuItem {
objectName: "editCategoryMenuItem"
enabled: communityData.amISectionAdmin
text: qsTr("Edit Category")
icon.name: "edit"
Expand All @@ -277,6 +278,7 @@ Item {
}

StatusMenuItem {
objectName: "deleteCategoryMenuItem"
enabled: communityData.amISectionAdmin
text: qsTr("Delete Category")
icon.name: "delete"
Expand Down

0 comments on commit 3fa29b3

Please sign in to comment.