test(Settings) leave community

Also add option to retrieve multiple objects with the same "Real Name"
and other required helpers

Closes: #6886
This commit is contained in:
Stefan 2022-08-11 14:24:49 +02:00 committed by Stefan Dunca
parent 1334fbb5f4
commit e33fdafc68
11 changed files with 70 additions and 16 deletions

View File

@ -99,6 +99,10 @@ def get_obj(objName: str):
def get_and_click_obj(obj_name: str):
click_obj(get_obj(obj_name))
def get_objects(objName: str):
objs = squish.findAllObjects(getattr(names, objName))
return objs
# It executes the left-click action into object with given object name:
def click_obj_by_name(objName: str):
obj = squish.waitForObject(getattr(names, objName))

View File

@ -13,17 +13,19 @@ from enum import Enum
from drivers.SquishDriver import *
from drivers.SquishDriverVerification import *
from .StatusMainScreen import MainScreenComponents
from .StatusMainScreen import StatusMainScreen
class SidebarComponents(Enum):
ADVANCED_OPTION: str = "advanced_StatusBaseText"
WALLET_ITEM: str = "wallet_AppMenu_StatusNavigationListItem"
SIGN_OUT_AND_QUIT: str = "sign_out_Quit_ExtraMenu_StatusNavigationListItem"
COMMUNITIES_ITEM: str = "communities_AppMenu_StatusNavigationListItem"
class AdvancedOptionScreen(Enum):
ACTIVATE_OR_DEACTIVATE_WALLET: str = "walletSettingsLineButton"
I_UNDERSTAND_POP_UP: str = "i_understand_StatusBaseText"
class WalletSettingsScreen(Enum):
GENERATED_ACCOUNTS: str = "settings_Wallet_MainView_GeneratedAccounts"
@ -42,6 +44,12 @@ class WalletSettingsScreen(Enum):
class ConfirmationDialog(Enum):
SIGN_OUT_CONFIRMATION: str = "signOutConfirmation_StatusButton"
class CommunitiesSettingsScreen(Enum):
LEAVE_COMMUNITY_BUTTONS: str = "settings_Communities_MainView_LeaveCommunityButtons"
LEAVE_COMMUNITY_POPUP_LEAVE_BUTTON: str = "settings_Communities_MainView_LeavePopup_LeaveCommunityButton"
class SettingsScreen:
__pid = 0
@ -131,3 +139,12 @@ class SettingsScreen:
iconSettings = get_obj(WalletSettingsScreen.ACCOUNT_VIEW_ICON_SETTINGS.value)
verify_values_equal(str(accountName.text), str(new_name), "Edited account name not updated")
verify_values_equal(str(iconSettings.icon.color.name), str(new_color.lower()), "Edited account color not updated")
def open_communities_section(self):
click_obj_by_name(SidebarComponents.COMMUNITIES_ITEM.value)
def leave_community(self):
StatusMainScreen.wait_for_banner_to_disappear()
# In our case we have only one visible community and only one button
click_obj_by_name(CommunitiesSettingsScreen.LEAVE_COMMUNITY_BUTTONS.value)
click_obj_by_name(CommunitiesSettingsScreen.LEAVE_COMMUNITY_POPUP_LEAVE_BUTTON.value)

View File

@ -14,9 +14,7 @@ import time
from drivers.SquishDriver import *
from drivers.SquishDriverVerification import *
from drivers.SDKeyboardCommands import *
class MainUi(Enum):
MODULE_WARNING_BANNER = "moduleWarning_Banner"
from .StatusMainScreen import StatusMainScreen
class CommunityCreateMethods(Enum):
BOTTOM_MENU = "bottom_menu"
@ -85,7 +83,7 @@ class StatusCommunityScreen:
verify_text_matching(CommunityScreenComponents.CHAT_IDENTIFIER_CHANNEL_NAME.value, community_channel_name)
def edit_community_channel(self, new_community_channel_name: str):
wait_for_banner_to_disappear()
StatusMainScreen.wait_for_banner_to_disappear()
click_obj_by_name(CommunityScreenComponents.CHAT_MORE_OPTIONS_BUTTON.value)
click_obj_by_name(CommunityScreenComponents.EDIT_CHANNEL_MENU_ITEM.value)
@ -130,7 +128,7 @@ class StatusCommunityScreen:
click_obj_by_name(CommunitySettingsComponents.BACK_TO_COMMUNITY_BUTTON.value)
def delete_current_community_channel(self):
wait_for_banner_to_disappear()
StatusMainScreen.wait_for_banner_to_disappear()
click_obj_by_name(CommunityScreenComponents.CHAT_MORE_OPTIONS_BUTTON.value)
click_obj_by_name(CommunityScreenComponents.DELETE_CHANNEL_MENU_ITEM.value)
@ -140,9 +138,3 @@ class StatusCommunityScreen:
chatListObj = get_obj(CommunityScreenComponents.NOT_CATEGORIZED_CHAT_LIST.value)
# Squish doesn't follow the type hints when parsing gherkin values
verify_equals(chatListObj.statusChatListItems.count, int(count_to_check))
# Wait for the banner to disappear otherwise the click might land badly
def wait_for_banner_to_disappear():
[bannerLoaded, _] = is_loaded_visible_and_enabled(MainUi.MODULE_WARNING_BANNER.value)
if (bannerLoaded):
time.sleep(5)

View File

@ -12,7 +12,7 @@
from enum import Enum
from drivers.SquishDriver import *
from drivers.SquishDriverVerification import *
import time
class MainScreenComponents(Enum):
STATUS_ICON = "mainWindow_statusIcon_StatusIcon_2"
@ -24,6 +24,8 @@ class MainScreenComponents(Enum):
START_CHAT_BTN = "mainWindow_startChat"
CHAT_LIST = "chatList_Repeater"
MARK_AS_READ_BUTTON = "mark_as_Read_StatusMenuItemDelegate"
COMMUNITY_NAVBAR_BUTTONS = "navBarListView_All_Community_Buttons"
MODULE_WARNING_BANNER = "moduleWarning_Banner"
class ChatNamePopUp(Enum):
CHAT_NAME_TEXT = "chat_name_PlaceholderText"
@ -36,6 +38,12 @@ class StatusMainScreen:
def __init__(self):
verify_screen(MainScreenComponents.PUBLIC_CHAT_ICON.value)
# Wait for the banner to disappear otherwise the click might land badly
def wait_for_banner_to_disappear():
[bannerLoaded, _] = is_loaded_visible_and_enabled(MainScreenComponents.MODULE_WARNING_BANNER.value)
if (bannerLoaded):
time.sleep(5)
def join_chat_room(self, room: str):
click_obj_by_name(MainScreenComponents.PUBLIC_CHAT_ICON.value)
#click_obj_by_name(MainScreenComponents.JOIN_PUBLIC_CHAT.value)
@ -77,3 +85,7 @@ class StatusMainScreen:
def open_wallet(self):
click_obj_by_name(MainScreenComponents.WALLET_BUTTON.value)
def verify_communities_count(self, expected_count: int):
objects = get_objects(MainScreenComponents.COMMUNITY_NAVBAR_BUTTONS.value)
verify_equals(len(objects), int(expected_count))

View File

@ -6,6 +6,7 @@ navBarListView_Communities_Portal_navbar_StatusNavBarTabButton = {"checkable": T
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, "objectName": "communitiesPortalLayout", "type": "CommunitiesPortalLayout"}
communitiesPortalLayoutContainer_createCommunityButton_StatusButton = {"container": mainWindow_communitiesPortalLayoutContainer_CommunitiesPortalLayout, "objectName": "createCommunityButton", "type": "StatusButton", "visible": True}
navBarListView_All_Community_Buttons = {"checkable": True, "container": mainWindow_navBarListView_ListView, "objectName": "CommunityNavBarButton", "type": "StatusNavBarTabButton"}
# Create community popup:
createCommunityNameInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityNameInput", "type": "TextEdit", "visible": True}

View File

@ -7,6 +7,7 @@ settings_navbar_settings_icon_StatusIcon = {"container": navBarListView_Settings
advanced_StatusBaseText = {"container": statusDesktop_mainWindow, "text": "Advanced", "type": "StatusBaseText", "unnamed": 1, "visible": True}
mainWindow_ScrollView = {"container": statusDesktop_mainWindow, "type": "StatusScrollView", "unnamed": 1, "visible": True}
wallet_AppMenu_StatusNavigationListItem = {"container": mainWindow_ScrollView, "objectName": "Wallet-AppMenu", "type": "StatusNavigationListItem", "visible": True}
communities_AppMenu_StatusNavigationListItem = {"container": mainWindow_ScrollView, "objectName": "Communities-AppMenu", "type": "StatusNavigationListItem", "visible": True}
# Wallet Settings:
settings_Wallet_MainView_GeneratedAccounts = {"container": statusDesktop_mainWindow, "objectName":'generatedAccounts', "type": 'ListView'}
@ -24,6 +25,10 @@ settings_Wallet_AccountView_IconSettings = {"container": statusDesktop_mainWindo
generatedAccounts_ListView = {"container": statusDesktop_mainWindow, "objectName": "generatedAccounts", "type": "ListView"}
# Communities Settings:
settings_Communities_MainView_LeaveCommunityButtons = {"container": statusDesktop_mainWindow, "objectName":"CommunitiesListPanel_leaveCommunityPopupButton", "type": "StatusBaseButton", "visible": True}
settings_Communities_MainView_LeavePopup_LeaveCommunityButton = {"container": statusDesktop_mainWindow, "objectName":"CommunitiesListPanel_leaveCommunityButtonInPopup", "type": "StatusBaseButton", "visible": True}
# Advanced Settings:
walletSettingsLineButton = {"container": statusDesktop_mainWindow, "objectName": "WalletSettingsLineButton", "type": "StatusSettingsLineButton", "visible": True}
i_understand_StatusBaseText = {"container": statusDesktop_mainWindow_overlay, "text": "I understand", "type": "StatusBaseText", "unnamed": 1, "visible": True}

View File

@ -52,3 +52,7 @@ def step(context):
@Then("the channel count is |any|")
def step(context, community_channel_count: int):
_statusCommunityScreen.check_channel_count(community_channel_count)
@Then("the count of communities in navbar is |any|")
def step(context: any, expected_count: int):
_statusMainScreen.verify_communities_count(expected_count)

View File

@ -52,7 +52,7 @@ def step(context: any, account_name):
@Then("the new account with name |any| and color |any| is updated")
def step(context, new_name: str, new_color: str):
_settingsScreen.verify_editedAccount(new_name, new_color)
@When("the user clicks on Sign out and Quit")
def step(context: any):
ctx = currentApplicationContext()
@ -60,4 +60,12 @@ def step(context: any):
@Then("the app is closed")
def step(context: any):
_settingsScreen.verify_the_app_is_closed()
_settingsScreen.verify_the_app_is_closed()
@When("the user opens the communities settings")
def step(context: any):
_settingsScreen.open_communities_section()
@When("the user leaves the community")
def step(context: any):
_settingsScreen.leave_community()

View File

@ -72,4 +72,12 @@ Feature: Status Desktop community
Then the user lands on the community channel named test-channel
And the channel count is 2
When the admin deletes current channel
Then the channel count is 1
Then the channel count is 1
Scenario: User leaves community
When the user creates a community named testCommunity, with description My community description, intro Community Intro and outro Community Outro
Then the user lands on the community named testCommunity
When the user opens app settings screen
And the user opens the communities settings
And the user leaves the community
Then the count of communities in navbar is 0

View File

@ -44,6 +44,7 @@ StatusListView {
components: [
StatusFlatButton {
objectName: "CommunitiesListPanel_leaveCommunityPopupButton"
size: StatusBaseButton.Size.Small
type: StatusBaseButton.Type.Danger
border.color: "transparent"
@ -104,6 +105,7 @@ StatusListView {
onClicked: leavePopup.close()
},
StatusButton {
objectName: "CommunitiesListPanel_leaveCommunityButtonInPopup"
type: StatusBaseButton.Type.Danger
text: qsTr("Leave community")
onClicked: {

View File

@ -286,6 +286,7 @@ Item {
}
communityNavBarButton: StatusNavBarTabButton {
objectName: "CommunityNavBarButton"
anchors.horizontalCenter: parent.horizontalCenter
name: model.icon.length > 0? "" : model.name
icon.name: model.icon