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 17, 2022
1 parent 9e81183 commit a8eefd8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
19 changes: 19 additions & 0 deletions test/ui-test/src/screens/StatusCommunityScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -146,12 +149,28 @@ 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(CommunityScreenComponents.COMMUNITY_DELETE_CATEGORY_MENU_ITEM.value)
click_obj_by_name(CommunityScreenComponents.COMMUNITY_CONFIRM_DELETE_CATEGORY_BUTTON.value)
time.sleep(0.5)

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 @@ -8,6 +8,9 @@
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}
edit_сategory_StatusMenuItemDelegate = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "editCategoryMenuItem", "type": "StatusMenuItemDelegate", "visible": True}
delete_сategory_StatusMenuItemDelegate = {"checkable": False, "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}
msgDelegate_channelIdentifierNameText_StyledText = {"container": chatMessageListView_msgDelegate_MessageView, "objectName": "channelIdentifierNameText", "type": "StyledText", "visible": True}
Expand All @@ -17,7 +20,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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 All @@ -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
Expand All @@ -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
Expand Down
3 changes: 3 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 Expand Up @@ -551,6 +553,7 @@ Item {
id: deleteCategoryConfirmationDialogComponent
ConfirmationDialog {
property string categoryId
confirmButtonObjectName: "confirmDeleteCategoryButton"
btnType: "warn"
showCancelButton: true
onClosed: {
Expand Down

0 comments on commit a8eefd8

Please sign in to comment.