test(community): add a test that edits a community category

Close #6888
This commit is contained in:
MishkaRogachev 2022-08-18 16:36:38 +04:00 committed by Mikhail Rogachev
parent 42a1cf995c
commit 9bbbe15d6c
3 changed files with 48 additions and 15 deletions

View File

@ -93,6 +93,17 @@ class StatusCommunityScreen:
return True, item
return False, None
def _toggle_channels_in_category_popop(self, community_channel_names: str):
# Wait for the channel list
time.sleep(0.5)
for channel_name in community_channel_names.split(", "):
[loaded, channel] = self._find_channel_in_category_popup(channel_name)
if loaded:
click_obj(channel)
else:
verify_failure("Can't find channel " + channel_name)
def open_edit_channel_popup(self):
StatusMainScreen.wait_for_banner_to_disappear()
@ -130,7 +141,7 @@ class StatusCommunityScreen:
click_obj_by_name(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_SAVE_OR_CREATE_BUTTON.value)
time.sleep(0.5)
def create_community_category(self, community_category_name, community_channel_name, method):
def create_community_category(self, community_category_name, community_channel_names, method):
if (method == CommunityCreateMethods.BOTTOM_MENU.value):
click_obj_by_name(CommunityScreenComponents.COMMUNITY_CREATE_CHANNEL_OR_CAT_BUTTON.value)
elif (method == CommunityCreateMethods.RIGHT_CLICK_MENU.value):
@ -141,15 +152,23 @@ class StatusCommunityScreen:
click_obj_by_name(CommunityScreenComponents.COMMUNITY_CREATE_CATEGORY_MENU_ITEM.value)
wait_for_object_and_type(CreateOrEditCommunityCategoryPopup.COMMUNITY_CATEGORY_NAME_INPUT.value, community_category_name)
[loaded, listItem] = self._find_channel_in_category_popup(community_channel_name)
if loaded:
click_obj(listItem)
else:
verify_failure("Can't find channel " + community_channel_name)
self._toggle_channels_in_category_popop(community_channel_names)
click_obj_by_name(CreateOrEditCommunityCategoryPopup.COMMUNITY_CATEGORY_BUTTON.value)
def edit_community_category(self, community_category_name, new_community_category_name, community_channel_names):
[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_EDIT_CATEGORY_MENU_ITEM.value)
# Select all text in the input before typing
wait_for_object_and_type(CreateOrEditCommunityCategoryPopup.COMMUNITY_CATEGORY_NAME_INPUT.value, "<Ctrl+a>")
type(CreateOrEditCommunityCategoryPopup.COMMUNITY_CATEGORY_NAME_INPUT.value, new_community_category_name)
self._toggle_channels_in_category_popop(community_channel_names)
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)

View File

@ -37,9 +37,13 @@ def step(context, new_community_channel_name):
def step(context, community_channel_name):
_statusCommunityScreen.verify_channel_name(community_channel_name)
@When("the admin creates a community category named |any|, with channel |any| and with the method |any|")
def step(context, community_category_name, community_channel_name, method):
_statusCommunityScreen.create_community_category(community_category_name, community_channel_name, method)
@When("the admin creates a community category named |any|, with channels |any| and with the method |any|")
def step(context, community_category_name, community_channel_names, method):
_statusCommunityScreen.create_community_category(community_category_name, community_channel_names, method)
@When("the admin edits category named |any| to the name |any| and channels |any|")
def step(context, community_category_name, new_community_category_name, community_channel_names):
_statusCommunityScreen.edit_community_category(community_category_name, new_community_category_name, community_channel_names)
@When("the admin deletes category named |any|")
def step(context, community_category_name):

View File

@ -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>
And 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 channels <community_channel_name> and with the method <method>
Then the category named <community_category_name> is created
Examples:
@ -78,11 +78,21 @@ Feature: Status Desktop community
| test-channel-2 | test-category-2 | right_click_menu |
Scenario: Admin deletes a community category
Scenario: Admin edits 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
And the admin creates a community category named test-category, with channels test-channel and with the method bottom_menu
Then the category named test-category is created
When the admin edits category named test-category to the name new-test-category and channels general, test-channel
Then the category named test-category is missing
And the category named new-test-category is created
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 category named test-category, with channels general 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