Skip to content

Commit

Permalink
test(community): add test for the right click menu to create channel
Browse files Browse the repository at this point in the history
Fixes #6609
  • Loading branch information
jrainville committed Jul 27, 2022
1 parent e20929b commit 3f10da8
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 21 deletions.
5 changes: 5 additions & 0 deletions test/ui-test/src/drivers/SquishDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def get_obj(objName: str):
def click_obj_by_name(objName: str):
obj = squish.waitForObject(getattr(names, objName))
squish.mouseClick(obj, squish.Qt.LeftButton)

# It executes the right-click action into object with given object name:
def right_click_obj_by_name(objName: str):
obj = squish.waitForObject(getattr(names, objName))
squish.mouseClick(obj, squish.Qt.RightButton)


def scroll_obj_by_name(objName: str):
Expand Down
19 changes: 14 additions & 5 deletions test/ui-test/src/screens/StatusCommunityScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
from drivers.SquishDriver import *
from drivers.SquishDriverVerification import *

class CommunityCreateMethods(Enum):
BOTTOM_MENU = "bottom_menu"
RIGHT_CLICK_MENU = "right_click_menu"

class CommunityScreenComponents(Enum):
COMMUNITY_HEADER_BUTTON = "mainWindow_communityHeader_StatusChatInfoButton"
COMMUNITY_HEADER_NAME_TEXT= "community_ChatInfo_Name_Text"
Expand All @@ -23,6 +27,7 @@ class CommunityScreenComponents(Enum):
CHAT_IDENTIFIER_CHANNEL_NAME = "msgDelegate_channelIdentifierNameText_StyledText"
CHAT_MORE_OPTIONS_BUTTON = "chat_moreOptions_menuButton"
EDIT_CHANNEL_MENU_ITEM = "edit_Channel_StatusMenuItemDelegate"
COMMUNITY_COLUMN_VIEW = "mainWindow_communityColumnView_CommunityColumnView"

class CreateOrEditCommunityChannelPopup(Enum):
COMMUNITY_CHANNEL_NAME_INPUT: str = "createOrEditCommunityChannelNameInput_TextEdit"
Expand All @@ -37,8 +42,14 @@ def __init__(self):
def verify_community_name(self, communityName: str):
verify_text_matching(CommunityScreenComponents.COMMUNITY_HEADER_NAME_TEXT.value, communityName)

def create_community_channel(self, communityChannelName: str, communityChannelDescription: str):
click_obj_by_name(CommunityScreenComponents.COMMUNITY_CREATE_CHANNEL_OR_CAT_BUTTON.value)
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)
elif (method == CommunityCreateMethods.RIGHT_CLICK_MENU.value):
right_click_obj_by_name(CommunityScreenComponents.COMMUNITY_COLUMN_VIEW.value)
else:
print("Unknown method to create a channel: ", method)

click_obj_by_name(CommunityScreenComponents.COMMUNITY_CREATE_CHANNEL__MENU_ITEM.value)

wait_for_object_and_type(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_NAME_INPUT.value, communityChannelName)
Expand All @@ -48,7 +59,7 @@ def create_community_channel(self, communityChannelName: str, communityChannelDe
def verify_channel_name(self, communityChannelName: str):
verify_text_matching(CommunityScreenComponents.CHAT_IDENTIFIER_CHANNEL_NAME.value, communityChannelName)

def editCommunityChannel(self, communityChannelName: str, newCommunityChannelName: str):
def edit_community_channel(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)

Expand All @@ -57,5 +68,3 @@ def editCommunityChannel(self, communityChannelName: str, newCommunityChannelNam
type(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_NAME_INPUT.value, newCommunityChannelName)
click_obj_by_name(CreateOrEditCommunityChannelPopup.COMMUNITY_CHANNEL_BUTTON.value)
time.sleep(0.5)


Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,4 @@
settings_Wallet_MainView_GeneratedAccounts = {"container": statusDesktop_mainWindow, "objectName":'generatedAccounts', "type": 'ListView'}
settings_Wallet_AccountView_DeleteAccount = {"container": statusDesktop_mainWindow, "type": "StatusButton", "objectName": "deleteAccountButton"}
settings_Wallet_AccountView_DeleteAccount_Confirm = {"container": statusDesktop_mainWindow, "type": "StatusButton", "objectName": "confirmDeleteAccountButton"}
mainWindow_communityColumnView_CommunityColumnView = {"container": statusDesktop_mainWindow, "objectName": "communityColumnView", "type": "CommunityColumnView"}
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ def step(context, community_name):
StatusCommunityScreen()
_statusCommunityScreen.verify_community_name(community_name)

@When("the admin creates a community channel named |any|, with description |any|")
def step(context, community_channel_name, community_channel_description):
_statusCommunityScreen.create_community_channel(community_channel_name, community_channel_description)
@When("the admin creates a community channel named |any|, with description |any| with the method |any|")
def step(context, community_channel_name, community_channel_description, method):
_statusCommunityScreen.create_community_channel(community_channel_name, community_channel_description, method)

@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)
_statusCommunityScreen.edit_community_channel(community_channel_name, new_community_channel_name)

@Then("the user lands on the community channel named |any|")
def step(context, community_channel_name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,30 @@ Feature: Status Desktop community
Then the user lands on the community named <community_name>

Examples:
| community_name | community_description | community_intro | community_outro |
| testCommunity1 | Community tested 1 | My intro for the community | My community outro |
| community_name | community_description | community_intro | community_outro |
| testCommunity1 | Community tested 1 | My intro for the community | My community outro |


Scenario Outline: Admin creates 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 <community_channel_name>, with description <community_channel_description>
When the admin creates a community channel named <community_channel_name>, with description <community_channel_description> with the method <method>
Then the user lands on the community channel named <community_channel_name>

Examples:
| community_channel_name | community_channel_description |
| test-channel | Community channel description tested 1 |
| community_channel_name | community_channel_description | method |
| test-channel | Community channel description tested 1 | bottom_menu |
| test-channel2 | Community channel description tested 2 | right_click_menu |

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
When the admin creates a community channel named test-channel, with description My description with the method bottom_menu
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 |
| test-channel | Community channel description tested 1 | new-test-channel |

10 changes: 5 additions & 5 deletions ui/app/AppLayouts/Chat/views/CommunityColumnView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import "../panels/communities"

Item {
id: root
objectName: "communityColumnView"
width: 304
height: parent.height

Expand Down Expand Up @@ -114,11 +115,11 @@ Item {
}

StatusPopupMenu {
property bool showInviteButton: false

id: adminPopupMenu
enabled: communityData.amISectionAdmin

property bool showInviteButton: false

onClosed: adminPopupMenu.showInviteButton = false

StatusMenuItem {
Expand Down Expand Up @@ -510,9 +511,8 @@ Item {
onClicked: {
adminPopupMenu.showInviteButton = false
adminPopupMenu.popup()
adminPopupMenu.y = Qt.binding(function () {
return root.height - adminPopupMenu.height - createChannelOrCategoryBtn.height - 20
})
adminPopupMenu.y = Qt.binding(() => root.height - adminPopupMenu.height
- createChannelOrCategoryBtn.height - 20)
}
}
}
Expand Down

0 comments on commit 3f10da8

Please sign in to comment.