Skip to content

Commit

Permalink
test(community): add e2e test that creates a community
Browse files Browse the repository at this point in the history
Fixes #6445
  • Loading branch information
jrainville committed Jul 22, 2022
1 parent 2847849 commit 1dfd153
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 3 deletions.
36 changes: 36 additions & 0 deletions test/ui-test/src/screens/StatusCommunityPortalScreen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from enum import Enum
import time
import sys
from drivers.SquishDriver import *
from drivers.SquishDriverVerification import *


class MainCommunityPortalScreen(Enum):
CREATE_COMMUNITY_BUTTON: str = "communitiesPortalLayoutContainer_createCommunityButton_StatusButton"


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"
COMMUNITY_INTRO_MESSAGE_INPUT: str = "createCommunityIntroMessageInput_TextEdit"
COMMUNITY_OUTRO_MESSAGE_INPUT: str = "createCommunityOutroMessageInput_TextEdit"
DO_CREATE_COMMUNITY_BUTTON: str = "createCommunityFinalBtn_StatusButton"

class StatusCommunityPortalScreen:

def __init__(self):
verify_screen(MainCommunityPortalScreen.CREATE_COMMUNITY_BUTTON.value)


def createCommunity(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)
type(CreateCommunityPopup.COMMUNITY_DESCRIPTION_INPUT.value, communityDescription)
click_obj_by_name(CreateCommunityPopup.NEXT_SCREEN_BUTTON.value)

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)
26 changes: 26 additions & 0 deletions test/ui-test/src/screens/StatusCommunityScreen.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ******************************************************************************
# Status.im
# *****************************************************************************/
# /**
# * \file StatusCommunityScreen.py
# *
# * \date July 2022
# * \brief Community Screen.
# *****************************************************************************/


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"


class StatusCommunityScreen:

def __init__(self, communityName):
verify_screen(CommunityScreenComponents.COMMUNITY_HEADER_BUTTON.value)
verify_text_matching(CommunityScreenComponents.COMMUNITY_HEADER_NAME_TEXT.value, communityName)
4 changes: 3 additions & 1 deletion test/ui-test/src/screens/StatusMainScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
class MainScreenComponents(Enum):
STATUS_ICON = "mainWindow_statusIcon_StatusIcon_2"
PUBLIC_CHAT_ICON = "mainWindow_public_chat_icon_StatusIcon"
COMMUNITY_PORTAL_ICON = "communities_Portal_navbar_communities_icon_StatusIcon"
JOIN_PUBLIC_CHAT = "join_public_chat_StatusMenuItemDelegate"
SETTINGS_BUTTON = "settings_navbar_settings_icon_StatusIcon"
WALLET_BUTTON = "wallet_navbar_wallet_icon_StatusIcon"


class ChatNamePopUp(Enum):
CHAT_NAME_TEXT = "chat_name_PlaceholderText"
INPUT_ROOM_TOPIC_TEXT = "inputValue_StyledTextField"
Expand All @@ -39,6 +39,8 @@ def joinChatRoom(self, room: str):
type(ChatNamePopUp.INPUT_ROOM_TOPIC_TEXT.value, room)
click_obj_by_name(ChatNamePopUp.START_CHAT.value)

def open_community_portal(self):
click_obj_by_name(MainScreenComponents.COMMUNITY_PORTAL_ICON.value)

def open_settings(self):
click_obj_by_name(MainScreenComponents.SETTINGS_BUTTON.value)
Expand Down
14 changes: 13 additions & 1 deletion test/ui-test/testSuites/suite_status/shared/scripts/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@
walletSettingsLineButton = {"container": statusDesktop_mainWindow, "objectName": "WalletSettingsLineButton", "type": "StatusSettingsLineButton", "visible": True}
navBarListView_Settings_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_navBarListView_ListView, "objectName": "Settings-navbar", "type": "StatusNavBarTabButton", "visible": True}
settings_navbar_settings_icon_StatusIcon = {"container": navBarListView_Settings_navbar_StatusNavBarTabButton, "objectName": "settings-icon", "type": "StatusIcon", "visible": True}
navBarListView_Communities_Portal_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_navBarListView_ListView, "objectName": "Communities Portal-navbar", "type": "StatusNavBarTabButton", "visible": True}
communities_Portal_navbar_communities_icon_StatusIcon = {"container": navBarListView_Communities_Portal_navbar_StatusNavBarTabButton, "objectName": "communities-icon", "type": "StatusIcon", "visible": True}
mainWindow_communitiesPortalLayoutContainer_CommunitiesPortalLayout = {"container": statusDesktop_mainWindow, "id": "communitiesPortalLayoutContainer", "type": "CommunitiesPortalLayout", "unnamed": 1, "visible": True}
communitiesPortalLayoutContainer_createCommunityButton_StatusButton = {"container": mainWindow_communitiesPortalLayoutContainer_CommunitiesPortalLayout, "objectName": "createCommunityButton", "type": "StatusButton", "visible": True}
createCommunityNameInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityNameInput", "type": "TextEdit", "visible": True}
createCommunityDescriptionInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityDescriptionInput", "type": "TextEdit", "visible": True}
createCommunityIntroMessageInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityIntroMessageInput", "type": "TextEdit", "visible": True}
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}
community_ChatInfo_Name_Text = {"container": mainWindow_communityHeader_StatusChatInfoButton, "objectName": "statusChatInfoButtonNameText", "type": "StatusBaseText", "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}
Expand Down Expand Up @@ -185,4 +197,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"}
settings_Wallet_AccountView_DeleteAccount_Confirm = {"container": statusDesktop_mainWindow, "type": "StatusButton", "objectName": "confirmDeleteAccountButton"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

from screens.StatusMainScreen import StatusMainScreen
from screens.StatusCommunityPortalScreen import StatusCommunityPortalScreen
from screens.StatusCommunityScreen import StatusCommunityScreen

_statusCommunitityPortal = StatusCommunityPortalScreen()
_statusMainScreen = StatusMainScreen()


@Then("the user opens the community portal section")
def step(context: any):
_statusMainScreen.open_community_portal()

@Then("the user lands on the community portal section")
def step(context):
StatusCommunityPortalScreen()

@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)


@Then("the user lands on the community named |any|")
def step(context, community_name):
StatusCommunityScreen(community_name)
2 changes: 1 addition & 1 deletion test/ui-test/testSuites/suite_status/suite.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=0
LANGUAGE=Python
OBJECTMAPSTYLE=script
TEST_CASES=tst_statusLoginPassword tst_basicChatFlow tst_wallet
TEST_CASES=tst_statusLoginPassword tst_basicChatFlow tst_wallet tst_createCommunity
VERSION=3
WRAPPERS=Qt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#******************************************************************************
# Status.im
#*****************************************************************************/
#/**
# * \file test.feature
# *
# * \test Status Desktop - Community
# * \date July 2022
# **
# *****************************************************************************/

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

Background:
Given A first time user lands on the status desktop and generates new key
When user signs up with username tester123 and password TesTEr16843/!@00
Then the user lands on the signed in app
Then the user opens the community portal section
Then the user lands on the community portal section

Scenario Outline: User creates a community
When the user creates a community named <community_name>, with description <community_description>, intro <community_intro> and outro <community_outro>
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 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source(findFile('scripts', 'python/bdd.py'))

setupHooks('../shared/scripts/bdd_hooks.py')
collectStepDefinitions('./steps', '../shared/steps', '../shared/communitySteps')

def main():
testSettings.throwOnFailure = True
runFeatureFile('test.feature')
1 change: 1 addition & 0 deletions ui/app/AppLayouts/Chat/views/CommunityColumnView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Item {

StatusChatInfoButton {
id: communityHeader
objectName: communityHeaderButton
title: communityData.name
subTitle: communityData.members.count <= 1 ?
qsTr("1 Member") :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ StatusScrollView {

StatusButton {
id: createBtn
objectName: "createCommunityButton"
text: qsTr("Create New Community")
onClicked: Global.openPopup(createCommunitiesPopupComponent)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ StatusStackModal {
width: 640

nextButton: StatusButton {
objectName: "createCommunityNextBtn"
text: qsTr("Next")
enabled: nameInput.valid && descriptionTextInput.valid
onClicked: currentIndex++
}

finishButton: StatusButton {
objectName: "createCommunityFinalBtn"
text: qsTr("Create Community")
enabled: introMessageInput.valid && outroMessageInput.valid
onClicked: d.createCommunity()
Expand All @@ -51,13 +53,15 @@ StatusStackModal {

CommunityNameInput {
id: nameInput
input.edit.objectName: "createCommunityNameInput"
Layout.fillWidth: true
Component.onCompleted: nameInput.input.forceActiveFocus(
Qt.MouseFocusReason)
}

CommunityDescriptionInput {
id: descriptionTextInput
input.edit.objectName: "createCommunityDescriptionInput"
Layout.fillWidth: true
}

Expand Down Expand Up @@ -128,6 +132,7 @@ StatusStackModal {

CommunityIntroMessageInput {
id: introMessageInput
input.edit.objectName: "createCommunityIntroMessageInput"

Layout.fillWidth: true
Layout.fillHeight: true
Expand All @@ -137,6 +142,7 @@ StatusStackModal {

CommunityOutroMessageInput {
id: outroMessageInput
input.edit.objectName: "createCommunityOutroMessageInput"

Layout.fillWidth: true
}
Expand Down

0 comments on commit 1dfd153

Please sign in to comment.