test(community): refactor and improve categary relates test cases
This commit is contained in:
parent
9bbbe15d6c
commit
f45275bb1a
|
@ -94,9 +94,6 @@ class StatusCommunityScreen:
|
|||
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:
|
||||
|
@ -104,12 +101,28 @@ class StatusCommunityScreen:
|
|||
else:
|
||||
verify_failure("Can't find channel " + channel_name)
|
||||
|
||||
def open_edit_channel_popup(self):
|
||||
def _get_checked_channel_names_in_category_popup(self):
|
||||
listView = get_obj(CreateOrEditCommunityCategoryPopup.COMMUNITY_CATEGORY_LIST.value)
|
||||
result = []
|
||||
|
||||
for index in range(listView.count):
|
||||
listItem = listView.itemAtIndex(index)
|
||||
if (listItem.checked):
|
||||
result.append(listItem.objectName.toLower())
|
||||
return result
|
||||
|
||||
def _open_edit_channel_popup(self):
|
||||
StatusMainScreen.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)
|
||||
|
||||
def _open_category_edit_popup(self, category):
|
||||
# For some reason it clicks on a first channel in category instead of category
|
||||
click_obj(category.parent)
|
||||
right_click_obj(category.parent)
|
||||
click_obj_by_name(CommunityScreenComponents.COMMUNITY_EDIT_CATEGORY_MENU_ITEM.value)
|
||||
|
||||
def verify_community_name(self, communityName: str):
|
||||
verify_text_matching(CommunityScreenComponents.COMMUNITY_HEADER_NAME_TEXT.value, communityName)
|
||||
|
||||
|
@ -133,7 +146,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):
|
||||
self.open_edit_channel_popup()
|
||||
self._open_edit_channel_popup()
|
||||
|
||||
# Select all text in the input before typing
|
||||
wait_for_object_and_type(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_NAME_INPUT.value, "<Ctrl+a>")
|
||||
|
@ -157,11 +170,9 @@ class StatusCommunityScreen:
|
|||
|
||||
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)
|
||||
verify(loaded, "Finding 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)
|
||||
self._open_category_edit_popup(category)
|
||||
|
||||
# Select all text in the input before typing
|
||||
wait_for_object_and_type(CreateOrEditCommunityCategoryPopup.COMMUNITY_CATEGORY_NAME_INPUT.value, "<Ctrl+a>")
|
||||
|
@ -171,21 +182,34 @@ class StatusCommunityScreen:
|
|||
|
||||
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)
|
||||
verify(loaded, "Finding 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(category.parent)
|
||||
right_click_obj(category.parent)
|
||||
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)
|
||||
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 verify_category_contains_channels(self, community_category_name, community_channel_names):
|
||||
[loaded, category] = self._find_category_in_chat(community_category_name)
|
||||
verify(loaded, "Finding category: " + community_category_name)
|
||||
|
||||
self._open_category_edit_popup(category)
|
||||
|
||||
checked_channel_names = self._get_checked_channel_names_in_category_popup()
|
||||
split = community_channel_names.split(", ")
|
||||
for channel_name in split:
|
||||
if channel_name in checked_channel_names:
|
||||
split.remove(channel_name)
|
||||
else:
|
||||
verify_failure("Channel " + channel_name + " should be checked in category " + community_category_name)
|
||||
comma = ", "
|
||||
verify(len(split) == 0, "Channel(s) " + comma.join(split) + " should not be checked in category " + community_category_name)
|
||||
|
||||
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)
|
||||
|
@ -232,7 +256,7 @@ class StatusCommunityScreen:
|
|||
verify_equals(chatListObj.statusChatListItems.count, int(count_to_check))
|
||||
|
||||
def search_and_change_community_channel_emoji(self, emoji_description: str):
|
||||
self.open_edit_channel_popup()
|
||||
self._open_edit_channel_popup()
|
||||
|
||||
click_obj_by_name(CreateOrEditCommunityChannelPopup.EMOJI_BUTTON.value)
|
||||
|
||||
|
|
|
@ -49,14 +49,14 @@ def step(context, community_category_name, new_community_category_name, communit
|
|||
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)
|
||||
|
||||
@Then("the category named |any| has channels |any|")
|
||||
def step(context, community_category_name, community_channel_names):
|
||||
_statusCommunityScreen.verify_category_contains_channels(community_category_name, community_channel_names)
|
||||
|
||||
@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)
|
||||
|
|
|
@ -70,7 +70,7 @@ Feature: Status Desktop community
|
|||
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 channels <community_channel_name> and with the method <method>
|
||||
Then the category named <community_category_name> is created
|
||||
Then the category named <community_category_name> has channels <community_channel_name>
|
||||
|
||||
Examples:
|
||||
| community_channel_name | community_category_name | method |
|
||||
|
@ -83,17 +83,18 @@ Feature: Status Desktop community
|
|||
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 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
|
||||
Then the category named test-category has channels test-channel
|
||||
When the admin edits category named test-category to the name new-test-category and channels test-channel, general
|
||||
Then the category named new-test-category has channels general
|
||||
And the category named test-category is missing
|
||||
|
||||
|
||||
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 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 channels test-channel and with the method bottom_menu
|
||||
Then the category named test-category has channels test-channel
|
||||
When the admin deletes category named test-category
|
||||
Then the category named test-category is missing
|
||||
|
||||
|
|
|
@ -119,6 +119,7 @@ StatusModal {
|
|||
interactive: false
|
||||
|
||||
delegate: StatusListItem {
|
||||
readonly property bool checked: channelItemCheckbox.checked
|
||||
objectName: model.name
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
visible: model.type != Constants.chatType.unknown
|
||||
|
|
Loading…
Reference in New Issue