test(@desktop/community): [suite_communities / tst_communityFlows]

Validate in 'The admin edits a community' test description and color
This commit is contained in:
mprakhov 2023-01-04 01:31:20 +02:00 committed by Mykhailo Prakhov
parent 2999a7f932
commit 4a5c439160
4 changed files with 80 additions and 21 deletions

View File

@ -147,7 +147,17 @@ class StatusCommunityScreen:
def verify_community_name(self, communityName: str):
verify_text_matching(CommunityScreenComponents.COMMUNITY_HEADER_NAME_TEXT.value, communityName)
def verify_community_overview_name(self, communityName: str):
verify_text_matching(CommunitySettingsComponents.COMMUNITY_NAME_TEXT.value, communityName)
def verify_community_overview_description(self, communityDescription: str):
verify_text_matching(CommunitySettingsComponents.COMMUNITY_DESCRIPTION_TEXT.value, communityDescription)
def verify_community_overview_color(self, communityColor: str):
obj = get_obj(CommunitySettingsComponents.COMMUNITY_LETTER_IDENTICON.value)
expect_true(obj.color.name == communityColor, "Community color was not changed correctly")
def create_community_channel(self, communityChannelName: str, communityChannelDescription: str, method: str):
if (method == CommunityCreateMethods.BOTTOM_MENU.value):
click_obj_by_name(CommunityScreenComponents.COMMUNITY_CREATE_CHANNEL_OR_CAT_BUTTON.value)
@ -228,36 +238,42 @@ class StatusCommunityScreen:
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):
def open_edit_community_by_community_header(self):
click_obj_by_name(CommunityScreenComponents.COMMUNITY_HEADER_BUTTON.value)
time.sleep(0.5) # wait for UI to load
click_obj_by_name(CommunitySettingsComponents.EDIT_COMMUNITY_BUTTON.value)
def change_community_name(self, new_community_name: str):
# Select all text in the input before typing
wait_for_object_and_type(CommunitySettingsComponents.EDIT_COMMUNITY_NAME_INPUT.value, "<Ctrl+a>")
type(CommunitySettingsComponents.EDIT_COMMUNITY_NAME_INPUT.value, new_community_name)
def change_community_description(self, new_community_description: str):
wait_for_object_and_type(CommunitySettingsComponents.EDIT_COMMUNITY_DESCRIPTION_INPUT.value, "<Ctrl+a>")
type(CommunitySettingsComponents.EDIT_COMMUNITY_DESCRIPTION_INPUT.value, new_community_description)
def change_community_color(self, new_community_color: str):
scroll_obj_by_name(CommunitySettingsComponents.EDIT_COMMUNITY_SCROLL_VIEW.value)
scroll_obj_by_name(CommunitySettingsComponents.EDIT_COMMUNITY_SCROLL_VIEW.value)
time.sleep(1)
scroll_obj_by_name(CommunitySettingsComponents.EDIT_COMMUNITY_SCROLL_VIEW.value)
time.sleep(1)
click_obj_by_name(CommunitySettingsComponents.EDIT_COMMUNITY_COLOR_PICKER_BUTTON.value)
wait_for_object_and_type(CommunityColorPanelComponents.HEX_COLOR_INPUT.value, "<Ctrl+a>")
type(CommunityColorPanelComponents.HEX_COLOR_INPUT.value, new_community_color)
click_obj_by_name(CommunityColorPanelComponents.SAVE_COLOR_BUTTON.value)
def save_community_changes(self):
click_obj_by_name(CommunitySettingsComponents.SAVE_BUTTON.value)
time.sleep(0.5)
def edit_community(self, new_community_name: str, new_community_description: str, new_community_color: str):
self.open_edit_community_by_community_header()
# Validation
verify_text_matching(CommunitySettingsComponents.COMMUNITY_NAME_TEXT.value, new_community_name)
verify_text_matching(CommunitySettingsComponents.COMMUNITY_DESCRIPTION_TEXT.value, new_community_description)
obj = get_obj(CommunitySettingsComponents.COMMUNITY_LETTER_IDENTICON.value)
expect_true(obj.color.name == new_community_color, "Community color was not changed correctly")
self.change_community_name(new_community_name)
self.change_community_description(new_community_description)
self.change_community_color(new_community_color)
self.save_community_changes()
def go_back_to_community(self):
click_obj_by_name(CommunitySettingsComponents.BACK_TO_COMMUNITY_BUTTON.value)
@ -394,4 +410,4 @@ class StatusCommunityScreen:
verify_values_equal(str(header.nbMembers), str(amount), "Number of members is not correct")
def toggle_reply_message_at_index(self, message_index: int):
self._click_msg_action_button(message_index, CommunityScreenComponents.REPLY_TO_MESSAGE_BUTTON.value)
self._click_msg_action_button(message_index, CommunityScreenComponents.REPLY_TO_MESSAGE_BUTTON.value)

View File

@ -46,7 +46,7 @@ createOrEditCommunityCategoryChannelList_ListItem_Placeholder = {"container": cr
createOrEditCommunityCategoryBtn_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "createOrEditCommunityCategoryBtn", "type": "StatusButton", "visible": True}
# Community settings
communitySettings_EditCommunity_Button = {"container": statusDesktop_mainWindow, "objectName": "communityOverviewSettingsEditCommunityButton", "type": "StatusButton"}
communitySettings_EditCommunity_Button = {"container": statusDesktop_mainWindow, "objectName": "communityOverviewSettingsEditCommunityButton", "type": "StatusButton", "visible": True}
communitySettings_BackToCommunity_Button = {"container": statusDesktop_mainWindow, "objectName": "communitySettingsBackToCommunityButton", "type": "StatusBaseText", "visible": True}
communitySettings_CommunityName_Text = {"container": statusDesktop_mainWindow, "objectName": "communityOverviewSettingsCommunityName", "type": "StatusBaseText", "visible": True}
communitySettings_CommunityDescription_Text = {"container": statusDesktop_mainWindow, "objectName": "communityOverviewSettingsCommunityDescription", "type": "StatusBaseText", "visible": True}
@ -57,7 +57,7 @@ communitySettings_Community_LetterIdenticon = {"container": communitySettings_Co
communitySettings_EditCommunity_ScrollView = {"container": statusDesktop_mainWindow, "objectName": "communityEditPanelScrollView", "type": "StatusScrollView", "visible": True}
communitySettings_EditCommunity_Name_Input = {"container": communitySettings_EditCommunity_ScrollView, "objectName": "editCommunityNameInput", "type": "TextEdit"}
communitySettings_EditCommunity_Description_Input = {"container": communitySettings_EditCommunity_ScrollView, "objectName": "editCommunityDescriptionInput", "type": "TextEdit"}
communitySettings_EditCommunity_ColorPicker_Button = {"container": communitySettings_EditCommunity_ScrollView, "objectName": "editCommunityColorPicker", "type": "CommunityColorPicker"}
communitySettings_EditCommunity_ColorPicker_Button = {"container": communitySettings_EditCommunity_ScrollView, "objectName": "editCommunityColorPicker", "type": "CommunityColorPicker", "visible": True}
# Community color popup:
communitySettings_ColorPanel_HexColor_Input = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityColorPanelHexInput", "type": "TextEdit"}

View File

@ -108,6 +108,24 @@ def step(context, community_category_name):
def step(context, new_community_name, new_community_description, new_community_color):
_statusCommunityScreen.edit_community(new_community_name, new_community_description, new_community_color)
@When("the admin changes the community name to \"|any|\"")
def step(context, new_community_name):
_statusCommunityScreen.open_edit_community_by_community_header()
_statusCommunityScreen.change_community_name(new_community_name)
_statusCommunityScreen.save_community_changes()
@When("the admin changes the community description to \"|any|\"")
def step(context, new_community_description):
_statusCommunityScreen.open_edit_community_by_community_header()
_statusCommunityScreen.change_community_description(new_community_description)
_statusCommunityScreen.save_community_changes()
@When("the admin changes the community color to \"|any|\"")
def step(context, new_community_color):
_statusCommunityScreen.open_edit_community_by_community_header()
_statusCommunityScreen.change_community_color(new_community_color)
_statusCommunityScreen.save_community_changes()
@When("the admin goes back to the community")
def step(context):
_statusCommunityScreen.go_back_to_community()
@ -179,7 +197,19 @@ def step(context):
@Then("the number of members is |any|")
def step(context, amount):
_statusCommunityScreen.verify_number_of_members(amount)
@Then("the community overview name is \"|any|\"")
def step(context, name: str):
_statusCommunityScreen.verify_community_overview_name(name)
@Then("the community overview description is \"|any|\"")
def step(context, communityDescription: str):
_statusCommunityScreen.verify_community_overview_description(communityDescription)
@Then("the community overview color is \"|any|\"")
def step(context, color: str):
_statusCommunityScreen.verify_community_overview_color(color)
###########################################################################
### COMMON methods used in different steps given/when/then region:
###########################################################################

View File

@ -84,12 +84,25 @@ Feature: Status Desktop community
When the admin deletes category named "test-category"
Then the category named "test-category" is missing
@mayfail
# TODO: Weak. Sometimes passes sometimes fails (standalone or as part of the sequence). To analyze.
# Also TODO: Missing validation of description changed and color changed. Now validation only checks the new community name.
Scenario Outline: The admin edits a community
Scenario Outline: The admin edits a community name, description and color separately
When the admin changes the community name to "<new_community_name>"
Then the community overview name is "<new_community_name>"
When the admin goes back to the community
And the admin changes the community description to "<new_community_description>"
Then the community overview description is "<new_community_description>"
When the admin goes back to the community
And the admin changes the community color to "<new_community_color>"
Then the community overview color is "<new_community_color>"
Examples:
| new_community_name | new_community_description | new_community_color |
| myCommunityNamedChanged | Cool new description 123 | #ff0000 |
Scenario Outline: The admin edits a community name, description and color
When the admin renames the community to "<new_community_name>" and description to "<new_community_description>" and color to "<new_community_color>"
And the admin goes back to the community
Then the community overview name is "<new_community_name>"
And the community overview description is "<new_community_description>"
And the community overview color is "<new_community_color>"
When the admin goes back to the community
Then the user lands on the community named "<new_community_name>"
Examples:
| new_community_name | new_community_description | new_community_color |