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

Fixes #6445
This commit is contained in:
Jonathan Rainville 2022-07-18 16:56:33 -04:00
parent 2847849de7
commit 1dfd1539f2
11 changed files with 151 additions and 3 deletions

View File

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

View File

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

View File

@ -17,11 +17,11 @@ from drivers.SquishDriverVerification import *
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"
@ -39,6 +39,8 @@ class StatusMainScreen:
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)

View File

@ -150,6 +150,18 @@ advanced_SettingsMenu_StatusNavigationListItem = {"container": mainWindow_Scroll
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}

View File

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

View File

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

View File

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

View File

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

View File

@ -39,6 +39,7 @@ Item {
StatusChatInfoButton {
id: communityHeader
objectName: communityHeaderButton
title: communityData.name
subTitle: communityData.members.count <= 1 ?
qsTr("1 Member") :

View File

@ -84,6 +84,7 @@ StatusScrollView {
StatusButton {
id: createBtn
objectName: "createCommunityButton"
text: qsTr("Create New Community")
onClicked: Global.openPopup(createCommunitiesPopupComponent)
}

View File

@ -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()
@ -51,6 +53,7 @@ StatusStackModal {
CommunityNameInput {
id: nameInput
input.edit.objectName: "createCommunityNameInput"
Layout.fillWidth: true
Component.onCompleted: nameInput.input.forceActiveFocus(
Qt.MouseFocusReason)
@ -58,6 +61,7 @@ StatusStackModal {
CommunityDescriptionInput {
id: descriptionTextInput
input.edit.objectName: "createCommunityDescriptionInput"
Layout.fillWidth: true
}
@ -128,6 +132,7 @@ StatusStackModal {
CommunityIntroMessageInput {
id: introMessageInput
input.edit.objectName: "createCommunityIntroMessageInput"
Layout.fillWidth: true
Layout.fillHeight: true
@ -137,6 +142,7 @@ StatusStackModal {
CommunityOutroMessageInput {
id: outroMessageInput
input.edit.objectName: "createCommunityOutroMessageInput"
Layout.fillWidth: true
}