test(community): add test that edits the community channel name
Fixes #6534
This commit is contained in:
parent
8e96e6879c
commit
16aa4a57f8
|
@ -112,3 +112,13 @@ def type(objName: str, text: str):
|
|||
return True
|
||||
except LookupError:
|
||||
return False
|
||||
|
||||
# Wait for the object to appears and
|
||||
# It types the specified text into the given object (as if the user had used the keyboard):
|
||||
def wait_for_object_and_type(objName: str, text: str):
|
||||
try:
|
||||
obj = squish.waitForObject(getattr(names, objName))
|
||||
squish.type(obj, text)
|
||||
return True
|
||||
except LookupError:
|
||||
return False
|
||||
|
|
|
@ -30,6 +30,6 @@ class StatusCommunityPortalScreen:
|
|||
type(CreateCommunityPopup.COMMUNITY_DESCRIPTION_INPUT.value, communityDescription)
|
||||
click_obj_by_name(CreateCommunityPopup.NEXT_SCREEN_BUTTON.value)
|
||||
|
||||
type(CreateCommunityPopup.COMMUNITY_INTRO_MESSAGE_INPUT.value, introMessage)
|
||||
wait_for_object_and_type(CreateCommunityPopup.COMMUNITY_INTRO_MESSAGE_INPUT.value, introMessage)
|
||||
type(CreateCommunityPopup.COMMUNITY_OUTRO_MESSAGE_INPUT.value, outroMessage)
|
||||
click_obj_by_name(CreateCommunityPopup.DO_CREATE_COMMUNITY_BUTTON.value)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
|
||||
from enum import Enum
|
||||
import time
|
||||
from drivers.SquishDriver import *
|
||||
from drivers.SquishDriverVerification import *
|
||||
|
||||
|
@ -20,11 +21,13 @@ class CommunityScreenComponents(Enum):
|
|||
COMMUNITY_CREATE_CHANNEL__MENU_ITEM = "create_channel_StatusMenuItemDelegate"
|
||||
COMMUNITY_CREATE_CATEGORY__MENU_ITEM = "create_category_StatusMenuItemDelegate"
|
||||
CHAT_IDENTIFIER_CHANNEL_NAME = "msgDelegate_channelIdentifierNameText_StyledText"
|
||||
CHAT_MORE_OPTIONS_BUTTON = "chat_moreOptions_menuButton"
|
||||
EDIT_CHANNEL_MENU_ITEM = "edit_Channel_StatusMenuItemDelegate"
|
||||
|
||||
class CreateCommunityChannelPopup(Enum):
|
||||
COMMUNITY_CHANNEL_NAME_INPUT: str = "createCommunityChannelNameInput_TextEdit"
|
||||
COMMUNITY_CHANNEL_DESCRIPTION_INPUT: str = "createCommunityChannelDescriptionInput_TextEdit"
|
||||
COMMUNITY_CHANNEL_BUTTON: str = "createCommunityChannelBtn_StatusButton"
|
||||
class CreateOrEditCommunityChannelPopup(Enum):
|
||||
COMMUNITY_CHANNEL_NAME_INPUT: str = "createOrEditCommunityChannelNameInput_TextEdit"
|
||||
COMMUNITY_CHANNEL_DESCRIPTION_INPUT: str = "createOrEditCommunityChannelDescriptionInput_TextEdit"
|
||||
COMMUNITY_CHANNEL_BUTTON: str = "createOrEditCommunityChannelBtn_StatusButton"
|
||||
|
||||
class StatusCommunityScreen:
|
||||
|
||||
|
@ -38,11 +41,21 @@ class StatusCommunityScreen:
|
|||
click_obj_by_name(CommunityScreenComponents.COMMUNITY_CREATE_CHANNEL_OR_CAT_BUTTON.value)
|
||||
click_obj_by_name(CommunityScreenComponents.COMMUNITY_CREATE_CHANNEL__MENU_ITEM.value)
|
||||
|
||||
type(CreateCommunityChannelPopup.COMMUNITY_CHANNEL_NAME_INPUT.value, communityChannelName)
|
||||
type(CreateCommunityChannelPopup.COMMUNITY_CHANNEL_DESCRIPTION_INPUT.value, communityChannelDescription)
|
||||
click_obj_by_name(CreateCommunityChannelPopup.COMMUNITY_CHANNEL_BUTTON.value)
|
||||
wait_for_object_and_type(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_NAME_INPUT.value, communityChannelName)
|
||||
type(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_DESCRIPTION_INPUT.value, communityChannelDescription)
|
||||
click_obj_by_name(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_BUTTON.value)
|
||||
|
||||
def verify_channel_name(self, communityChannelName: str):
|
||||
verify_text_matching(CommunityScreenComponents.CHAT_IDENTIFIER_CHANNEL_NAME.value, communityChannelName)
|
||||
|
||||
def editCommunityChannel(self, communityChannelName: str, newCommunityChannelName: str):
|
||||
click_obj_by_name(CommunityScreenComponents.CHAT_MORE_OPTIONS_BUTTON.value)
|
||||
click_obj_by_name(CommunityScreenComponents.EDIT_CHANNEL_MENU_ITEM.value)
|
||||
|
||||
# Select all text in the input before typing
|
||||
wait_for_object_and_type(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_NAME_INPUT.value, "<Ctrl+a>")
|
||||
type(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_NAME_INPUT.value, newCommunityChannelName)
|
||||
click_obj_by_name(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_BUTTON.value)
|
||||
time.sleep(0.5)
|
||||
|
||||
|
|
@ -163,15 +163,17 @@ createCommunityFinalBtn_StatusButton = {"container": statusDesktop_mainWindow_ov
|
|||
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}
|
||||
createCommunityChannelNameInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityChannelNameInput", "type": "TextEdit", "visible": True}
|
||||
createCommunityChannelDescriptionInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityChannelDescriptionInput", "type": "TextEdit", "visible": True}
|
||||
createCommunityChannelBtn_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityChannelBtn", "type": "StatusButton", "visible": True}
|
||||
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}
|
||||
channel_Header_chat_title_StatusBaseText = {"container": statusDesktop_mainWindow, "objectName": "chatInfoNameText", "type": "StatusBaseText", "visible": True}
|
||||
mainWindow_communityHeader_StatusChatInfoButton = {"container": statusDesktop_mainWindow, "objectName": "communityHeaderButton", "type": "StatusChatInfoButton", "visible": True}
|
||||
community_ChatInfo_Name_Text = {"container": mainWindow_communityHeader_StatusChatInfoButton, "objectName": "statusChatInfoButtonNameText", "type": "StatusBaseText", "visible": True}
|
||||
mainWindow_chatMessageListView_ListView = {"container": statusDesktop_mainWindow, "objectName": "chatMessageListView", "type": "ListView", "visible": True}
|
||||
chatMessageListView_msgDelegate_MessageView = {"container": mainWindow_chatMessageListView_ListView, "objectName": "chatMessageViewDelegate", "index": 1, "type": "MessageView", "visible": True}
|
||||
msgDelegate_channelIdentifierNameText_StyledText = {"container": chatMessageListView_msgDelegate_MessageView, "objectName": "channelIdentifierNameText", "type": "StyledText", "visible": True}
|
||||
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}
|
||||
|
||||
navBarListView_Wallet_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_navBarListView_ListView, "objectName": "Wallet-navbar", "type": "StatusNavBarTabButton", "visible": True}
|
||||
wallet_navbar_wallet_icon_StatusIcon = {"container": navBarListView_Wallet_navbar_StatusNavBarTabButton, "objectName": "wallet-icon", "type": "StatusIcon", "visible": True}
|
||||
|
|
|
@ -29,6 +29,10 @@ def step(context, community_name):
|
|||
def step(context, community_channel_name, community_channel_description):
|
||||
_statusCommunityScreen.create_community_channel(community_channel_name, community_channel_description)
|
||||
|
||||
@When("the admin edits a community channel named |any| to the name |any|")
|
||||
def step(context, community_channel_name, new_community_channel_name):
|
||||
_statusCommunityScreen.editCommunityChannel(community_channel_name, new_community_channel_name)
|
||||
|
||||
@Then("the user lands on the community channel named |any|")
|
||||
def step(context, community_channel_name):
|
||||
_statusCommunityScreen.verify_channel_name(community_channel_name)
|
|
@ -41,3 +41,14 @@ Feature: Status Desktop community
|
|||
| community_channel_name | community_channel_description |
|
||||
| test-channel | Community channel description tested 1 |
|
||||
|
||||
Scenario Outline: Admin edits a community 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
|
||||
When the admin creates a community channel named test-channel, with description My description
|
||||
Then the user lands on the community channel named test-channel
|
||||
When the admin edits a community channel named <community_channel_name> to the name <new_community_channel_name>
|
||||
Then the user lands on the community channel named <new_community_channel_name>
|
||||
|
||||
Examples:
|
||||
| community_channel_name | community_channel_description | new_community_channel_name |
|
||||
| test-channel | Community channel description tested 1 | new-test-channel |
|
||||
|
|
|
@ -102,7 +102,7 @@ StatusModal {
|
|||
|
||||
StatusInput {
|
||||
id: nameInput
|
||||
input.edit.objectName: "createCommunityChannelNameInput"
|
||||
input.edit.objectName: "createOrEditCommunityChannelNameInput"
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 16
|
||||
|
@ -209,7 +209,7 @@ StatusModal {
|
|||
|
||||
StatusInput {
|
||||
id: descriptionTextArea
|
||||
input.edit.objectName: "createCommunityChannelDescriptionInput"
|
||||
input.edit.objectName: "createOrEditCommunityChannelDescriptionInput"
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 16
|
||||
|
@ -286,7 +286,7 @@ StatusModal {
|
|||
|
||||
rightButtons: [
|
||||
StatusButton {
|
||||
objectName: "createCommunityChannelBtn"
|
||||
objectName: "createOrEditCommunityChannelBtn"
|
||||
enabled: isFormValid()
|
||||
text: isEdit ?
|
||||
qsTr("Save") :
|
||||
|
|
|
@ -167,6 +167,7 @@ StatusPopupMenu {
|
|||
}
|
||||
|
||||
StatusMenuItem {
|
||||
objectName: "editChannelMenuItem"
|
||||
text: qsTr("Edit Channel")
|
||||
icon.name: "edit"
|
||||
enabled: root.isCommunityChat && root.amIChatAdmin
|
||||
|
|
Loading…
Reference in New Issue