test(community): add test that creates a community channel

Fixes #6533
This commit is contained in:
Jonathan Rainville 2022-07-21 12:16:25 -04:00
parent 120f6517c9
commit 8e96e6879c
13 changed files with 78 additions and 15 deletions

View File

@ -10,7 +10,6 @@ class MainCommunityPortalScreen(Enum):
class CreateCommunityPopup(Enum):
SCROLL_BAR: str = "mainWallet_Add_Account_Popup_Main"
COMMUNITY_NAME_INPUT: str = "createCommunityNameInput_TextEdit"
COMMUNITY_DESCRIPTION_INPUT: str = "createCommunityDescriptionInput_TextEdit"
NEXT_SCREEN_BUTTON: str = "createCommunityNextBtn_StatusButton"
@ -24,7 +23,7 @@ class StatusCommunityPortalScreen:
verify_screen(MainCommunityPortalScreen.CREATE_COMMUNITY_BUTTON.value)
def createCommunity(self, communityName: str, communityDescription: str, introMessage: str, outroMessage: str):
def create_community(self, communityName: str, communityDescription: str, introMessage: str, outroMessage: str):
click_obj_by_name(MainCommunityPortalScreen.CREATE_COMMUNITY_BUTTON.value)
type(CreateCommunityPopup.COMMUNITY_NAME_INPUT.value, communityName)

View File

@ -13,14 +13,36 @@ from enum import Enum
from drivers.SquishDriver import *
from drivers.SquishDriverVerification import *
class CommunityScreenComponents(Enum):
COMMUNITY_HEADER_BUTTON = "mainWindow_communityHeader_StatusChatInfoButton"
COMMUNITY_HEADER_NAME_TEXT= "community_ChatInfo_Name_Text"
COMMUNITY_CREATE_CHANNEL_OR_CAT_BUTTON = "mainWindow_createChannelOrCategoryBtn_StatusBaseText"
COMMUNITY_CREATE_CHANNEL__MENU_ITEM = "create_channel_StatusMenuItemDelegate"
COMMUNITY_CREATE_CATEGORY__MENU_ITEM = "create_category_StatusMenuItemDelegate"
CHAT_IDENTIFIER_CHANNEL_NAME = "msgDelegate_channelIdentifierNameText_StyledText"
class CreateCommunityChannelPopup(Enum):
COMMUNITY_CHANNEL_NAME_INPUT: str = "createCommunityChannelNameInput_TextEdit"
COMMUNITY_CHANNEL_DESCRIPTION_INPUT: str = "createCommunityChannelDescriptionInput_TextEdit"
COMMUNITY_CHANNEL_BUTTON: str = "createCommunityChannelBtn_StatusButton"
class StatusCommunityScreen:
def __init__(self, communityName):
verify_screen(CommunityScreenComponents.COMMUNITY_HEADER_BUTTON.value)
def __init__(self):
verify_screen(CommunityScreenComponents.COMMUNITY_HEADER_BUTTON.value)
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)
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)
def verify_channel_name(self, communityChannelName: str):
verify_text_matching(CommunityScreenComponents.CHAT_IDENTIFIER_CHANNEL_NAME.value, communityChannelName)

View File

@ -160,8 +160,18 @@ createCommunityIntroMessageInput_TextEdit = {"container": statusDesktop_mainWind
createCommunityOutroMessageInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityOutroMessageInput", "type": "TextEdit", "visible": True}
createCommunityNextBtn_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityNextBtn", "type": "StatusButton", "visible": True}
createCommunityFinalBtn_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityFinalBtn", "type": "StatusButton", "visible": True}
mainWindow_communityHeader_StatusChatInfoButton = {"container": statusDesktop_mainWindow, "id": "communityHeader", "type": "StatusChatInfoButton", "unnamed": 1, "visible": True}
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}
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}
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}

View File

@ -3,6 +3,7 @@ from screens.StatusMainScreen import StatusMainScreen
from screens.StatusCommunityPortalScreen import StatusCommunityPortalScreen
from screens.StatusCommunityScreen import StatusCommunityScreen
_statusCommunityScreen = StatusCommunityScreen()
_statusCommunitityPortal = StatusCommunityPortalScreen()
_statusMainScreen = StatusMainScreen()
@ -17,9 +18,17 @@ def step(context):
@When("the user creates a community named |any|, with description |any|, intro |any| and outro |any|")
def step(context, community_name, community_description, community_intro, community_outro):
_statusCommunitityPortal.createCommunity(community_name, community_description, community_intro, community_outro)
_statusCommunitityPortal.create_community(community_name, community_description, community_intro, community_outro)
@Then("the user lands on the community named |any|")
def step(context, community_name):
StatusCommunityScreen(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)
@Then("the user lands on the community channel named |any|")
def step(context, community_channel_name):
_statusCommunityScreen.verify_channel_name(community_channel_name)

View File

@ -4,6 +4,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAPSTYLE=script
TEST_CASES=tst_statusLoginPassword tst_basicChatFlow tst_wallet tst_createCommunity
TEST_CASES=tst_statusLoginPassword tst_basicChatFlow tst_wallet tst_communityFlows
VERSION=3
WRAPPERS=Qt

View File

@ -13,7 +13,7 @@ Feature: Status Desktop community
As a user I want to create a community and chat
The following scenarios cover basic flows of creating a community
The following scenarios cover basic flows of a community
Background:
Given A first time user lands on the status desktop and generates new key
@ -28,4 +28,16 @@ Feature: Status Desktop community
Examples:
| community_name | community_description | community_intro | community_outro |
| testCommunity1 | Community tested 1 | My intro for the community | My 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>
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 |

View File

@ -102,6 +102,7 @@ StatusModal {
StatusInput {
id: nameInput
input.edit.objectName: "createCommunityChannelNameInput"
anchors.left: parent.left
anchors.leftMargin: 16
@ -208,6 +209,7 @@ StatusModal {
StatusInput {
id: descriptionTextArea
input.edit.objectName: "createCommunityChannelDescriptionInput"
anchors.left: parent.left
anchors.leftMargin: 16
@ -284,6 +286,7 @@ StatusModal {
rightButtons: [
StatusButton {
objectName: "createCommunityChannelBtn"
enabled: isFormValid()
text: isEdit ?
qsTr("Save") :

View File

@ -217,7 +217,7 @@ Item {
}
sourceComponent: ChatContentView {
visible: !root.rootStore.openCreateChat
visible: !root.rootStore.openCreateChat && isActiveChannel
width: parent.width
height: parent.height
clip: true
@ -274,7 +274,7 @@ Item {
}
sourceComponent: ChatContentView {
visible: !root.rootStore.openCreateChat
visible: !root.rootStore.openCreateChat && isActiveChannel
width: parent.width
height: parent.height
clip: true

View File

@ -25,6 +25,7 @@ import "../stores"
ColumnLayout {
id: root
objectName: "chatContentViewColumn"
spacing: 0
// Important:
@ -73,6 +74,7 @@ ColumnLayout {
id: statusChatInfoButton
StatusChatInfoButton {
objectName: "chatInfoBtnInHeader"
width: Math.min(implicitWidth, parent.width)
title: chatContentModule? chatContentModule.chatDetails.name : ""
subTitle: {

View File

@ -97,6 +97,7 @@ Item {
StatusListView {
id: chatLogView
objectName: "chatMessageListView"
anchors.top: loadingMessagesIndicator.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
@ -243,6 +244,7 @@ Item {
delegate: MessageView {
id: msgDelegate
objectName: "chatMessageViewDelegate"
store: root.store
messageStore: root.messageStore

View File

@ -39,7 +39,7 @@ Item {
StatusChatInfoButton {
id: communityHeader
objectName: communityHeaderButton
objectName: "communityHeaderButton"
title: communityData.name
subTitle: communityData.members.count <= 1 ?
qsTr("1 Member") :
@ -484,6 +484,7 @@ Item {
active: communityData.amISectionAdmin
sourceComponent: Component {
StatusBaseText {
objectName: "createChannelOrCategoryBtn"
color: Theme.palette.baseColor1
height: visible ? implicitHeight : 0
text: qsTr("Create channel or category")
@ -508,12 +509,14 @@ Item {
id: createChatOrCatMenu
closePolicy: Popup.CloseOnPressOutsideParent
StatusMenuItem {
objectName: "createCommunityChannelBtn"
text: qsTr("Create channel")
icon.name: "channel"
onTriggered: Global.openPopup(createChannelPopup)
}
StatusMenuItem {
objectName: "createCommunityCategoryBtn"
text: qsTr("Create category")
icon.name: "channel-category"
onTriggered: Global.openPopup(createCategoryPopup)

View File

@ -42,6 +42,7 @@ Column {
StyledText {
id: channelName
objectName: "channelIdentifierNameText"
wrapMode: Text.Wrap
text: root.chatName
font.weight: Font.Bold