From 8e96e6879cb8eae33531071b0a39f187f41e2711 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 21 Jul 2022 12:16:25 -0400 Subject: [PATCH] test(community): add test that creates a community channel Fixes #6533 --- .../screens/StatusCommunityPortalScreen.py | 3 +- .../src/screens/StatusCommunityScreen.py | 28 +++++++++++++++++-- .../suite_status/shared/scripts/names.py | 12 +++++++- .../shared/steps/communitySteps.py | 15 ++++++++-- .../testSuites/suite_status/suite.conf | 2 +- .../test.feature | 16 +++++++++-- .../test.py | 0 .../popups/community/CreateChannelPopup.qml | 3 ++ .../AppLayouts/Chat/views/ChatColumnView.qml | 4 +-- .../AppLayouts/Chat/views/ChatContentView.qml | 2 ++ .../Chat/views/ChatMessagesView.qml | 2 ++ .../Chat/views/CommunityColumnView.qml | 5 +++- .../views/chat/ChannelIdentifierView.qml | 1 + 13 files changed, 78 insertions(+), 15 deletions(-) rename test/ui-test/testSuites/suite_status/{tst_createCommunity => tst_communityFlows}/test.feature (62%) rename test/ui-test/testSuites/suite_status/{tst_createCommunity => tst_communityFlows}/test.py (100%) diff --git a/test/ui-test/src/screens/StatusCommunityPortalScreen.py b/test/ui-test/src/screens/StatusCommunityPortalScreen.py index 0d78a992d8..1b7c583444 100644 --- a/test/ui-test/src/screens/StatusCommunityPortalScreen.py +++ b/test/ui-test/src/screens/StatusCommunityPortalScreen.py @@ -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) diff --git a/test/ui-test/src/screens/StatusCommunityScreen.py b/test/ui-test/src/screens/StatusCommunityScreen.py index 6b01033d1d..764b0704da 100644 --- a/test/ui-test/src/screens/StatusCommunityScreen.py +++ b/test/ui-test/src/screens/StatusCommunityScreen.py @@ -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) + + \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_status/shared/scripts/names.py b/test/ui-test/testSuites/suite_status/shared/scripts/names.py index 920ba6f18a..e9e3bef90c 100644 --- a/test/ui-test/testSuites/suite_status/shared/scripts/names.py +++ b/test/ui-test/testSuites/suite_status/shared/scripts/names.py @@ -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} diff --git a/test/ui-test/testSuites/suite_status/shared/steps/communitySteps.py b/test/ui-test/testSuites/suite_status/shared/steps/communitySteps.py index eaca215088..cc11b01ac2 100644 --- a/test/ui-test/testSuites/suite_status/shared/steps/communitySteps.py +++ b/test/ui-test/testSuites/suite_status/shared/steps/communitySteps.py @@ -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) \ No newline at end of file + 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) \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_status/suite.conf b/test/ui-test/testSuites/suite_status/suite.conf index d634ecf37c..cb47072eac 100644 --- a/test/ui-test/testSuites/suite_status/suite.conf +++ b/test/ui-test/testSuites/suite_status/suite.conf @@ -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 diff --git a/test/ui-test/testSuites/suite_status/tst_createCommunity/test.feature b/test/ui-test/testSuites/suite_status/tst_communityFlows/test.feature similarity index 62% rename from test/ui-test/testSuites/suite_status/tst_createCommunity/test.feature rename to test/ui-test/testSuites/suite_status/tst_communityFlows/test.feature index 05b54ae8cc..a9791089ff 100644 --- a/test/ui-test/testSuites/suite_status/tst_createCommunity/test.feature +++ b/test/ui-test/testSuites/suite_status/tst_communityFlows/test.feature @@ -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 | \ No newline at end of file + | 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 , with description + Then the user lands on the community channel named + + Examples: + | community_channel_name | community_channel_description | + | test-channel | Community channel description tested 1 | + diff --git a/test/ui-test/testSuites/suite_status/tst_createCommunity/test.py b/test/ui-test/testSuites/suite_status/tst_communityFlows/test.py similarity index 100% rename from test/ui-test/testSuites/suite_status/tst_createCommunity/test.py rename to test/ui-test/testSuites/suite_status/tst_communityFlows/test.py diff --git a/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml b/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml index 189a5242f9..e83c05c297 100644 --- a/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml +++ b/ui/app/AppLayouts/Chat/popups/community/CreateChannelPopup.qml @@ -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") : diff --git a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml index da6ec7f2f7..7dcedf132c 100644 --- a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml @@ -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 diff --git a/ui/app/AppLayouts/Chat/views/ChatContentView.qml b/ui/app/AppLayouts/Chat/views/ChatContentView.qml index ed8ef3a1a3..83af946189 100644 --- a/ui/app/AppLayouts/Chat/views/ChatContentView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatContentView.qml @@ -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: { diff --git a/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml b/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml index 95258bf571..f52b4f916c 100644 --- a/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatMessagesView.qml @@ -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 diff --git a/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml b/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml index 4c79091b92..6b50e913b0 100644 --- a/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/CommunityColumnView.qml @@ -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) diff --git a/ui/imports/shared/views/chat/ChannelIdentifierView.qml b/ui/imports/shared/views/chat/ChannelIdentifierView.qml index 4c4c59a79d..d9ae34b7d3 100644 --- a/ui/imports/shared/views/chat/ChannelIdentifierView.qml +++ b/ui/imports/shared/views/chat/ChannelIdentifierView.qml @@ -42,6 +42,7 @@ Column { StyledText { id: channelName + objectName: "channelIdentifierNameText" wrapMode: Text.Wrap text: root.chatName font.weight: Font.Bold