Test(Community) Create, edit community (#12021)

#90
This commit is contained in:
Vladimir Druzhinin 2023-08-29 16:43:00 +02:00 committed by GitHub
parent 5aec48da35
commit 0405ea0b89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 1092 additions and 41 deletions

View File

@ -1,9 +1,12 @@
from collections import namedtuple
UserAccount = namedtuple('User', ['name', 'password', 'seed_phrase'])
user_account = UserAccount('squisher', '*P@ssw0rd*', [
user_account_default = UserAccount('squisher', '*P@ssw0rd*', [
'rail', 'witness', 'era', 'asthma', 'empty', 'cheap', 'shed', 'pond', 'skate', 'amount', 'invite', 'year'
])
user_account_one = UserAccount('tester123', 'TesTEr16843/!@00', [])
user_account_two = UserAccount('Athletic', 'TesTEr16843/!@00', [])
user_account_three = UserAccount('Nervous', 'TesTEr16843/!@00', [])
UserCommunity = namedtuple('Community', ['name', 'description', 'members', 'image'])

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1,29 @@
import allure
import configs
from gui.components.base_popup import BasePopup
from gui.elements.qt.button import Button
from gui.elements.qt.text_edit import TextEdit
class ColorSelectPopup(BasePopup):
def __init__(self):
super().__init__()
self._hex_color_text_edit = TextEdit('communitySettings_ColorPanel_HexColor_Input')
self._save_button = Button('communitySettings_SaveColor_Button')
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._hex_color_text_edit.wait_until_appears()
return self
@allure.step('Wait until hidden {0}')
def wait_until_hidden(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._hex_color_text_edit.wait_until_hidden()
@allure.step('Select color {1}')
def select_color(self, value: str):
self._hex_color_text_edit.text = value
self._save_button.click()
self.wait_until_hidden()

View File

@ -0,0 +1,147 @@
import typing
import allure
from gui.components.base_popup import BasePopup
from gui.components.color_select_popup import ColorSelectPopup
from gui.components.community.tags_select_popup import TagsSelectPopup
from gui.components.os.open_file_dialogs import OpenFileDialog
from gui.components.picture_edit_popup import PictureEditPopup
from gui.elements.qt.button import Button
from gui.elements.qt.check_box import CheckBox
from gui.elements.qt.scroll import Scroll
from gui.elements.qt.text_edit import TextEdit
from gui.screens.community import CommunityScreen
class CreateCommunitiesBanner(BasePopup):
def __init__(self):
super().__init__()
self._crete_community_button = Button('create_new_StatusButton')
def open_create_community_popup(self) -> 'CreateCommunityPopup':
self._crete_community_button.click()
return CreateCommunityPopup().wait_until_appears()
class CreateCommunityPopup(BasePopup):
def __init__(self):
super().__init__()
self._scroll = Scroll('o_Flickable')
self._name_text_edit = TextEdit('createCommunityNameInput_TextEdit')
self._description_text_edit = TextEdit('createCommunityDescriptionInput_TextEdit')
self._add_logo_button = Button('addButton_StatusRoundButton2')
self._add_banner_button = Button('addButton_StatusRoundButton')
self._select_color_button = Button('StatusPickerButton')
self._choose_tag_button = Button('choose_tags_StatusPickerButton')
self._archive_support_checkbox = CheckBox('archiveSupportToggle_StatusCheckBox')
self._request_to_join_checkbox = CheckBox('requestToJoinToggle_StatusCheckBox')
self._pin_messages_checkbox = CheckBox('pinMessagesToggle_StatusCheckBox')
self._next_button = Button('createCommunityNextBtn_StatusButton')
self._intro_text_edit = TextEdit('createCommunityIntroMessageInput_TextEdit')
self._outro_text_edit = TextEdit('createCommunityOutroMessageInput_TextEdit')
self._create_community_button = Button('createCommunityFinalBtn_StatusButton')
@property
@allure.step('Get community name')
def name(self) -> str:
return self._name_text_edit.text
@name.setter
@allure.step('Set community name')
def name(self, value: str):
self._name_text_edit.text = value
@property
@allure.step('Get community description')
def description(self) -> str:
return self._description_text_edit.text
@description.setter
@allure.step('Set community name')
def description(self, value: str):
self._description_text_edit.text = value
@property
@allure.step('Get community logo')
def logo(self):
return NotImplementedError
@logo.setter
@allure.step('Set community logo')
def logo(self, kwargs: dict):
self._add_logo_button.click()
OpenFileDialog().wait_until_appears().open_file(kwargs['fp'])
PictureEditPopup().wait_until_appears().make_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
@property
@allure.step('Get community banner')
def banner(self):
raise NotImplementedError
@banner.setter
@allure.step('Set community banner')
def banner(self, kwargs: dict):
self._add_banner_button.click()
OpenFileDialog().wait_until_appears().open_file(kwargs['fp'])
PictureEditPopup().wait_until_appears().make_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
@property
@allure.step('Get community color')
def color(self):
raise NotImplementedError
@color.setter
@allure.step('Set community color')
def color(self, value: str):
self._scroll.vertical_scroll_to(self._select_color_button)
self._select_color_button.click()
ColorSelectPopup().wait_until_appears().select_color(value)
@property
@allure.step('Get community tags')
def tags(self):
raise NotImplementedError
@tags.setter
@allure.step('Set community tags')
def tags(self, values: typing.List[str]):
self._scroll.vertical_scroll_to(self._choose_tag_button)
self._choose_tag_button.click()
TagsSelectPopup().wait_until_appears().select_tags(values)
@property
@allure.step('Get community intro')
def intro(self) -> str:
return self._intro_text_edit.text
@intro.setter
@allure.step('Set community intro')
def intro(self, value: str):
self._intro_text_edit.text = value
@property
@allure.step('Get community outro')
def outro(self) -> str:
return self._outro_text_edit.text
@outro.setter
@allure.step('Set community outro')
def outro(self, value: str):
self._outro_text_edit.text = value
@allure.step('Open intro/outro form')
def open_next_form(self):
self._next_button.click()
@allure.step('Create community')
def create(self, kwargs):
for key in list(kwargs):
if key in ['intro', 'outro'] and self._next_button.is_visible:
self._next_button.click()
setattr(self, key, kwargs.get(key))
self._create_community_button.click()
self.wait_until_hidden()
return CommunityScreen().wait_until_appears()

View File

@ -0,0 +1,48 @@
import time
import typing
import allure
import configs
import driver
from gui.components.base_popup import BasePopup
from gui.elements.qt.button import Button
from gui.elements.qt.object import QObject
class TagsSelectPopup(BasePopup):
def __init__(self):
super().__init__()
self._tag_template = QObject('o_StatusCommunityTag')
self._save_button = Button('confirm_Community_Tags_StatusButton')
@allure.step('Wait until appears {0}')
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
self._tag_template.wait_until_appears()
return self
@allure.step('Select tags')
def select_tags(self, values: typing.List[str]):
tags = []
checked = []
unchecked = []
for obj in driver.findAllObjects(self._tag_template.real_name):
name = str(obj.name)
tags.append(name)
if name in values:
if not obj.removable:
driver.mouseClick(obj)
checked.append(name)
time.sleep(1)
values.remove(name)
else:
# Selected and should be unselected
if obj.removable:
driver.mouseClick(obj)
time.sleep(1)
unchecked.append(name)
if values:
raise LookupError(
f'Tags: {values} not found in {tags}. Checked tags: {checked}, Unchecked tags: {unchecked}')
self._save_button.click()

View File

@ -12,17 +12,17 @@ from gui.elements.qt.slider import Slider
shift_image = namedtuple('Shift', ['left', 'right', 'top', 'bottom'])
class ProfilePicturePopup(BasePopup):
class PictureEditPopup(BasePopup):
def __init__(self):
super(ProfilePicturePopup, self).__init__()
super(PictureEditPopup, self).__init__()
self._zoom_slider = Slider('o_StatusSlider')
self._view = QObject('cropSpaceItem_Item')
self._make_profile_picture_button = Button('make_this_my_profile_picture_StatusButton')
self._make_picture_button = Button('make_picture_StatusButton')
self._slider_handler = QObject('o_DropShadow')
@allure.step('Make profile image')
def make_profile_picture(
@allure.step('Make picture')
def make_picture(
self,
zoom: int = None,
shift: shift_image = None
@ -48,5 +48,4 @@ class ProfilePicturePopup(BasePopup):
self._view.object, 1, self._view.height, 1, self._view.height - shift.bottom, step=1)
time.sleep(1)
self._make_profile_picture_button.click()
self.wait_until_hidden()
self._make_picture_button.click()

View File

@ -23,7 +23,7 @@ class NativeObject(BaseObject):
def is_visible(self):
try:
return self.object is not None
except LookupError as err:
except (LookupError, ValueError) as err:
_logger.debug(err)
return False

View File

@ -86,8 +86,7 @@ class QObject(BaseObject):
@property
@allure.step('Get image {0}')
def image(self):
if self._image.view is None:
self._image.update_view()
self._image.update_view()
return self._image
@allure.step('Click {0}')

View File

@ -0,0 +1,24 @@
import time
import allure
import driver
from .object import QObject
class Scroll(QObject):
@allure.step('Scroll vertical to object')
def vertical_scroll_to(self, element: QObject, timeout_sec: int = 5):
started_at = time.monotonic()
step = 10
direction = 1
while not element.is_visible:
step *= 2
direction *= -1
driver.flick(self.object, 0, step * direction)
time.sleep(0.1)
if time.monotonic() - started_at > timeout_sec:
raise LookupError(f'Object not found: {element}')
if hasattr(element.object, 'y'):
driver.flick(self.object, 0, int(element.object.y))

View File

@ -1,11 +1,24 @@
import logging
import typing
import allure
import configs
import constants
import driver
from constants import UserAccount
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
from gui.components.onboarding.welcome_status_popup import WelcomeStatusPopup
from gui.components.splash_screen import SplashScreen
from gui.components.user_canvas import UserCanvas
from gui.elements.qt.button import Button
from gui.elements.qt.object import QObject
from gui.elements.qt.window import Window
from gui.screens.community import CommunityScreen
from gui.screens.community_portal import CommunitiesPortal
from gui.screens.onboarding import AllowNotificationsView, WelcomeView, TouchIDAuthView, LoginView
from gui.screens.settings import SettingsScreen
from scripts.tools.image import Image
_logger = logging.getLogger(__name__)
@ -15,6 +28,17 @@ class LeftPanel(QObject):
def __init__(self):
super(LeftPanel, self).__init__('mainWindow_StatusAppNavBar')
self._profile_button = Button('mainWindow_ProfileNavBarButton')
self._communities_portal_button = Button('communities_Portal_navbar_StatusNavBarTabButton')
self._community_template_button = Button('statusCommunityMainNavBarListView_CommunityNavBarButton')
self._settings_button = Button('settings_navbar_StatusNavBarTabButton')
@property
@allure.step('Get communities names')
def communities(self) -> typing.List[str]:
community_names = []
for obj in driver.findAllObjects(self._community_template_button.real_name):
community_names.append(obj.name)
return community_names
@property
@allure.step('Get user badge color')
@ -38,9 +62,63 @@ class LeftPanel(QObject):
def user_is_set_to_automatic(self):
return self.user_badge_color == '#4ebc60'
@allure.step('Open community portal')
def open_communities_portal(self) -> CommunitiesPortal:
self._communities_portal_button.click()
return CommunitiesPortal().wait_until_appears()
def _get_community(self, name: str):
community_names = []
for obj in driver.findAllObjects(self._community_template_button.real_name):
community_names.append(str(obj.name))
if str(obj.name) == str(name):
return obj
raise LookupError(f'Community: {name} not found in {community_names}')
@allure.step('Open community')
def select_community(self, name: str) -> CommunityScreen:
driver.mouseClick(self._get_community(name))
return CommunityScreen().wait_until_appears()
@allure.step('Get community logo')
def get_community_logo(self, name: str) -> Image:
return Image(driver.objectMap.realName(self._get_community(name)))
@allure.step('Open settings')
def open_settings(self) -> CommunitiesPortal:
self._settings_button.click()
return SettingsScreen().wait_until_appears()
class MainWindow(Window):
def __init__(self):
super(MainWindow, self).__init__('statusDesktop_mainWindow')
self.left_panel = LeftPanel()
@allure.step('Sign Up user')
def sign_up(self, user_account: UserAccount = constants.user.user_account_one):
if configs.system.IS_MAC:
AllowNotificationsView().wait_until_appears().allow()
BeforeStartedPopUp().get_started()
wellcome_screen = WelcomeView().wait_until_appears()
profile_view = wellcome_screen.get_keys().generate_new_keys()
profile_view.set_display_name(user_account.name)
details_view = profile_view.next()
create_password_view = details_view.next()
confirm_password_view = create_password_view.create_password(user_account.password)
confirm_password_view.confirm_password(user_account.password)
if configs.system.IS_MAC:
TouchIDAuthView().wait_until_appears().prefer_password()
SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.DEV_BUILD:
WelcomeStatusPopup().confirm()
return self
@allure.step('Log in user')
def log_in(self, user_account: UserAccount):
LoginView().log_in(user_account)
SplashScreen().wait_until_appears().wait_until_hidden()
if not configs.DEV_BUILD:
WelcomeStatusPopup().wait_until_appears().confirm()
return self

View File

@ -1,4 +1,6 @@
from .community_names import *
from .component_names import *
from .main_names import *
from .onboarding_names import *
from .os_names import *
from .settings_names import *

View File

@ -0,0 +1,62 @@
from .main_names import statusDesktop_mainWindow, statusDesktop_mainWindow_overlay
# Community Portal
mainWindow_communitiesPortalLayout_CommunitiesPortalLayout = {"container": statusDesktop_mainWindow, "objectName": "communitiesPortalLayout", "type": "CommunitiesPortalLayout", "visible": True}
mainWindow_Create_New_Community_StatusButton = {"checkable": False, "container": mainWindow_communitiesPortalLayout_CommunitiesPortalLayout, "objectName": "createCommunityButton", "type": "StatusButton", "visible": True}
# Community View
mainWindow_communityLoader_Loader = {"container": statusDesktop_mainWindow, "id": "communityLoader", "type": "Loader", "unnamed": 1, "visible": True}
# Left Panel
mainWindow_communityColumnView_CommunityColumnView = {"container": mainWindow_communityLoader_Loader, "objectName": "communityColumnView", "type": "CommunityColumnView", "visible": True}
mainWindow_communityHeaderButton_StatusChatInfoButton = {"checkable": False, "container": mainWindow_communityColumnView_CommunityColumnView, "objectName": "communityHeaderButton", "type": "StatusChatInfoButton", "visible": True}
mainWindow_identicon_StatusSmartIdenticon = {"container": mainWindow_communityHeaderButton_StatusChatInfoButton, "id": "identicon", "type": "StatusSmartIdenticon", "unnamed": 1, "visible": True}
mainWindow_statusChatInfoButtonNameText_TruncatedTextWithTooltip = {"container": mainWindow_communityHeaderButton_StatusChatInfoButton, "objectName": "statusChatInfoButtonNameText", "type": "TruncatedTextWithTooltip", "visible": True}
mainWindow_Members_TruncatedTextWithTooltip = {"container": mainWindow_communityHeaderButton_StatusChatInfoButton, "type": "TruncatedTextWithTooltip", "unnamed": 1, "visible": True}
mainWindow_startChatButton_StatusIconTabButton = {"checkable": True, "container": mainWindow_communityColumnView_CommunityColumnView, "objectName": "startChatButton", "type": "StatusIconTabButton", "visible": True}
mainWindow_createChatOrCommunity_Loader = {"container": mainWindow_communityColumnView_CommunityColumnView, "id": "createChatOrCommunity", "type": "Loader", "unnamed": 1, "visible": True}
mainWindow_scrollView_StatusScrollView = {"container": mainWindow_communityColumnView_CommunityColumnView, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
scrollView_Flickable = {"container": mainWindow_scrollView_StatusScrollView, "type": "Flickable", "unnamed": 1, "visible": True}
# Tool Bar
mainWindow_statusToolBar_StatusToolBar = {"container": mainWindow_communityLoader_Loader, "objectName": "statusToolBar", "type": "StatusToolBar", "visible": True}
statusToolBar_chatToolbarMoreOptionsButton = {"container": mainWindow_statusToolBar_StatusToolBar, "objectName": "chatToolbarMoreOptionsButton", "type": "StatusFlatRoundButton", "visible": True}
delete_Channel_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "deleteOrLeaveMenuItem", "type": "StatusMenuItem", "visible": True}
# Community Settings
mainWindow_communitySettingsBackToCommunityButton_StatusBaseText = {"container": mainWindow_communityLoader_Loader, "objectName": "communitySettingsBackToCommunityButton", "type": "StatusBaseText", "visible": True}
mainWindow_listView_StatusListView = {"container": mainWindow_communityLoader_Loader, "id": "listView", "type": "StatusListView", "unnamed": 1, "visible": True}
overview_StatusNavigationListItem = {"container": mainWindow_listView_StatusListView, "objectName": "CommunitySettingsView_NavigationListItem_Overview", "type": "StatusNavigationListItem", "visible": True}
members_StatusNavigationListItem = {"container": mainWindow_listView_StatusListView, "index": 1, "objectName": "CommunitySettingsView_NavigationListItem_Members", "type": "StatusNavigationListItem", "visible": True}
# Overview Settings View
mainWindow_OverviewSettingsPanel = {"container": mainWindow_communityLoader_Loader, "type": "OverviewSettingsPanel", "unnamed": 1, "visible": True}
communityOverviewSettingsCommunityName_StatusBaseText = {"container": mainWindow_OverviewSettingsPanel, "objectName": "communityOverviewSettingsCommunityName", "type": "StatusBaseText", "visible": True}
communityOverviewSettingsCommunityDescription_StatusBaseText = {"container": mainWindow_OverviewSettingsPanel, "objectName": "communityOverviewSettingsCommunityDescription", "type": "StatusBaseText", "visible": True}
mainWindow_Edit_Community_StatusButton = {"checkable": False, "container": mainWindow_OverviewSettingsPanel, "objectName": "communityOverviewSettingsEditCommunityButton", "text": "Edit Community", "type": "StatusButton", "visible": True}
# Members Settings View
mainWindow_MembersSettingsPanel = {"container": mainWindow_communityLoader_Loader, "type": "MembersSettingsPanel", "unnamed": 1, "visible": True}
embersListViews_ListView = {"container": mainWindow_MembersSettingsPanel, "objectName": "CommunityMembersTabPanel_MembersListViews", "type": "ListView", "visible": True}
memberItem_StatusMemberListItem = {"container": embersListViews_ListView, "id": "memberItem", "type": "StatusMemberListItem", "unnamed": 1, "visible": True}
# Permissions Settings View
mainWindow_PermissionsSettingsPanel = {"container": mainWindow_communityLoader_Loader, "type": "PermissionsSettingsPanel", "unnamed": 1, "visible": True}
# Edit Community
mainWindow_communityEditPanelScrollView_EditSettingsPanel = {"container": statusDesktop_mainWindow, "objectName": "communityEditPanelScrollView", "type": "EditSettingsPanel", "visible": True}
communityEditPanelScrollView_Flickable = {"container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "type": "Flickable", "unnamed": 1, "visible": True}
communityEditPanelScrollView_communityNameInput_TextEdit = {"container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "objectName": "communityNameInput", "type": "TextEdit", "visible": True}
communityEditPanelScrollView_communityDescriptionInput_TextEdit = {"container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "objectName": "communityDescriptionInput", "type": "TextEdit", "visible": True}
communityEditPanelScrollView_communityLogoPicker_LogoPicker = {"container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "objectName": "communityLogoPicker", "type": "LogoPicker", "visible": True}
communityEditPanelScrollView_image_StatusImage = {"container": communityEditPanelScrollView_communityLogoPicker_LogoPicker, "id": "image", "type": "StatusImage", "unnamed": 1, "visible": True}
communityEditPanelScrollView_editButton_StatusRoundButton = {"container": communityEditPanelScrollView_communityLogoPicker_LogoPicker, "id": "editButton", "type": "StatusRoundButton", "unnamed": 1, "visible": True}
communityEditPanelScrollView_communityBannerPicker_BannerPicker = {"container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "objectName": "communityBannerPicker", "type": "BannerPicker", "visible": True}
communityEditPanelScrollView_image_StatusImage_2 = {"container": communityEditPanelScrollView_communityBannerPicker_BannerPicker, "id": "image", "type": "StatusImage", "unnamed": 1, "visible": True}
communityEditPanelScrollView_editButton_StatusRoundButton_2 = {"container": communityEditPanelScrollView_communityBannerPicker_BannerPicker, "id": "editButton", "type": "StatusRoundButton", "unnamed": 1, "visible": True}
communityEditPanelScrollView_StatusPickerButton = {"checkable": False, "container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "type": "StatusPickerButton", "unnamed": 1, "visible": True}
communityEditPanelScrollView_communityTagsPicker_TagsPicker = {"container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "objectName": "communityTagsPicker", "type": "TagsPicker", "visible": True}
communityEditPanelScrollView_flow_Flow = {"container": communityEditPanelScrollView_communityTagsPicker_TagsPicker, "id": "flow", "type": "Flow", "unnamed": 1, "visible": True}
communityEditPanelScrollView_StatusCommunityTag = {"container": communityEditPanelScrollView_communityTagsPicker_TagsPicker, "type": "StatusCommunityTag", "unnamed": 1, "visible": True}
communityEditPanelScrollView_Choose_StatusPickerButton = {"checkable": False, "container": communityEditPanelScrollView_communityTagsPicker_TagsPicker, "type": "StatusPickerButton", "unnamed": 1, "visible": True}
communityEditPanelScrollView_archiveSupportToggle_StatusCheckBox = {"checkable": True, "container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "id": "archiveSupportToggle", "type": "StatusCheckBox", "unnamed": 1, "visible": True}
communityEditPanelScrollView_requestToJoinToggle_StatusCheckBox = {"checkable": True, "container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "id": "requestToJoinToggle", "type": "StatusCheckBox", "unnamed": 1, "visible": True}
communityEditPanelScrollView_pinMessagesToggle_StatusCheckBox = {"checkable": True, "container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "id": "pinMessagesToggle", "type": "StatusCheckBox", "unnamed": 1, "visible": True}
communityEditPanelScrollView_editCommunityIntroInput_TextEdit = {"container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "objectName": "editCommunityIntroInput", "type": "TextEdit", "visible": True}
communityEditPanelScrollView_editCommunityOutroInput_TextEdit = {"container": mainWindow_communityEditPanelScrollView_EditSettingsPanel, "objectName": "editCommunityOutroInput", "type": "TextEdit", "visible": True}
mainWindow_Save_changes_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow, "objectName": "settingsDirtyToastMessageSaveButton", "text": "Save changes", "type": "StatusButton", "visible": True}

View File

@ -1,5 +1,13 @@
from objectmaphelper import *
from . main_names import statusDesktop_mainWindow_overlay
from .main_names import statusDesktop_mainWindow_overlay
# Scroll
o_Flickable = {"container": statusDesktop_mainWindow_overlay, "type": "Flickable", "unnamed": 1, "visible": True}
# Context Menu
o_StatusListView = {"container": statusDesktop_mainWindow_overlay, "type": "StatusListView", "unnamed": 1,
"visible": True}
# Before you get started Popup
acknowledge_checkbox = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "objectName": "acknowledgeCheckBox", "type": "StatusCheckBox", "visible": True}
@ -56,8 +64,38 @@ agreeToUse_StatusCheckBox = {"checkable": True, "container": statusDesktop_mainW
readyToUse_StatusCheckBox = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "id": "readyToUse", "type": "StatusCheckBox", "unnamed": 1, "visible": True}
i_m_ready_to_use_Status_Desktop_Beta_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "type": "StatusButton", "unnamed": 1, "visible": True}
# Profile Picture Popup
# Picture Edit Popup
o_StatusSlider = {"container": statusDesktop_mainWindow_overlay, "type": "StatusSlider", "unnamed": 1, "visible": True}
cropSpaceItem_Item = {"container": statusDesktop_mainWindow_overlay, "id": "cropSpaceItem", "type": "Item", "unnamed": 1, "visible": True}
make_this_my_profile_picture_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "imageCropperAcceptButton", "type": "StatusButton", "visible": True}
o_DropShadow = {"container": statusDesktop_mainWindow_overlay, "type": "DropShadow", "unnamed": 1, "visible": True}
make_picture_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "imageCropperAcceptButton", "type": "StatusButton", "visible": True}
o_DropShadow = {"container": statusDesktop_mainWindow_overlay, "type": "DropShadow", "unnamed": 1, "visible": True}
# Create Community Banner
create_new_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "communityBannerButton", "type": "StatusButton", "visible": True}
# Create Community Popup
createCommunityNameInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityNameInput", "type": "TextEdit", "visible": True}
createCommunityDescriptionInput_TextEdit = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityDescriptionInput", "type": "TextEdit", "visible": True}
communityBannerPicker_BannerPicker = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityBannerPicker", "type": "BannerPicker", "visible": True}
addButton_StatusRoundButton = {"container": communityBannerPicker_BannerPicker, "id": "addButton", "type": "StatusRoundButton", "unnamed": 1, "visible": True}
communityLogoPicker_LogoPicker = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityLogoPicker", "type": "LogoPicker", "visible": True}
addButton_StatusRoundButton2 = {"container": communityLogoPicker_LogoPicker, "id": "addButton", "type": "StatusRoundButton", "unnamed": 1, "visible": True}
communityColorPicker_ColorPicker = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityColorPicker", "type": "ColorPicker", "visible": True}
StatusPickerButton = {"checkable": False, "container": communityColorPicker_ColorPicker, "type": "StatusPickerButton", "unnamed": 1, "visible": True}
communityTagsPicker_TagsPicker = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityTagsPicker", "type": "TagsPicker", "visible": True}
choose_tags_StatusPickerButton = {"checkable": False, "container": communityTagsPicker_TagsPicker, "type": "StatusPickerButton", "unnamed": 1, "visible": True}
archiveSupportToggle_StatusCheckBox = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "id": "archiveSupportToggle", "type": "StatusCheckBox", "unnamed": 1, "visible": True}
requestToJoinToggle_StatusCheckBox = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "id": "requestToJoinToggle", "type": "StatusCheckBox", "unnamed": 1, "visible": True}
pinMessagesToggle_StatusCheckBox = {"checkable": True, "container": statusDesktop_mainWindow_overlay, "id": "pinMessagesToggle", "type": "StatusCheckBox", "unnamed": 1, "visible": True}
createCommunityNextBtn_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityNextBtn", "type": "StatusButton", "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}
createCommunityFinalBtn_StatusButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "createCommunityFinalBtn", "type": "StatusButton", "visible": True}
# Select Color Popup
communitySettings_ColorPanel_HexColor_Input = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityColorPanelHexInput", "type": "TextEdit", "visible": True}
communitySettings_SaveColor_Button = {"container": statusDesktop_mainWindow_overlay, "objectName": "communityColorPanelSelectColorButton", "type": "StatusButton", "visible": True}
# Select Tag Popup
o_StatusCommunityTag = {"container": statusDesktop_mainWindow_overlay, "type": "StatusCommunityTag", "unnamed": 1, "visible": True}
confirm_Community_Tags_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "type": "StatusButton", "unnamed": 1, "visible": True}

View File

@ -9,6 +9,8 @@ communities_Portal_navbar_StatusNavBarTabButton = {"checkable": True, "container
wallet_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_StatusAppNavBar, "objectName": "Wallet-navbar", "type": "StatusNavBarTabButton", "visible": True}
settings_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_StatusAppNavBar, "objectName": "Settings-navbar", "type": "StatusNavBarTabButton", "visible": True}
mainWindow_ProfileNavBarButton = {"container": statusDesktop_mainWindow, "objectName": "statusProfileNavBarTabButton", "type": "StatusNavBarTabButton", "visible": True}
mainWindow_statusCommunityMainNavBarListView_ListView = {"container": statusDesktop_mainWindow, "objectName": "statusCommunityMainNavBarListView", "type": "ListView", "visible": True}
statusCommunityMainNavBarListView_CommunityNavBarButton = {"checkable": True, "container": mainWindow_statusCommunityMainNavBarListView_ListView, "objectName": "CommunityNavBarButton", "type": "StatusNavBarTabButton", "visible": True}
# Banners
secureYourSeedPhraseBanner_ModuleWarning = {"container": statusDesktop_mainWindow, "objectName": "secureYourSeedPhraseBanner", "type": "ModuleWarning", "visible": True}

View File

@ -0,0 +1,22 @@
from gui.objects_map.main_names import statusDesktop_mainWindow
mainWindow_ProfileLayout = {"container": statusDesktop_mainWindow, "type": "ProfileLayout", "unnamed": 1, "visible": True}
mainWindow_StatusSectionLayout_ContentItem = {"container": mainWindow_ProfileLayout, "objectName": "StatusSectionLayout", "type": "ContentItem", "visible": True}
# Left Panel
mainWindow_LeftTabView = {"container": mainWindow_StatusSectionLayout_ContentItem, "type": "LeftTabView", "unnamed": 1, "visible": True}
mainWindow_Settings_StatusNavigationPanelHeadline = {"container": mainWindow_LeftTabView, "type": "StatusNavigationPanelHeadline", "unnamed": 1, "visible": True}
mainWindow_scrollView_StatusScrollView = {"container": mainWindow_LeftTabView, "id": "scrollView", "type": "StatusScrollView", "unnamed": 1, "visible": True}
scrollView_AppMenuItem_StatusNavigationListItem = {"container": mainWindow_scrollView_StatusScrollView, "type": "StatusNavigationListItem", "visible": True}
# Communities View
mainWindow_CommunitiesView = {"container": statusDesktop_mainWindow, "type": "CommunitiesView", "unnamed": 1, "visible": True}
mainWindow_settingsContentBaseScrollView_StatusScrollView = {"container": mainWindow_CommunitiesView, "objectName": "settingsContentBaseScrollView", "type": "StatusScrollView", "visible": True}
settingsContentBaseScrollView_listItem_StatusListItem = {"container": mainWindow_settingsContentBaseScrollView_StatusScrollView, "id": "listItem", "type": "StatusListItem", "unnamed": 1, "visible": True}
settings_iconOrImage_StatusSmartIdenticon = {"id": "iconOrImage", "type": "StatusSmartIdenticon", "unnamed": 1, "visible": True}
settings_Name_StatusTextWithLoadingState = {"type": "StatusTextWithLoadingState", "unnamed": 1, "visible": True}
settings_statusListItemSubTitle = {"objectName": "statusListItemSubTitle", "type": "StatusTextWithLoadingState", "visible": True}
settings_member_StatusTextWithLoadingState = {"text": "1 member", "type": "StatusTextWithLoadingState", "unnamed": 1, "visible": True}
settings_StatusFlatButton = {"type": "StatusFlatButton", "unnamed": 1, "visible": True}

View File

@ -0,0 +1,59 @@
import allure
from gui.elements.qt.button import Button
from gui.elements.qt.list import List
from gui.elements.qt.object import QObject
from gui.elements.qt.text_label import TextLabel
from gui.screens.community_settings import CommunitySettingsScreen
from scripts.tools.image import Image
class CommunityScreen(QObject):
def __init__(self):
super().__init__('mainWindow_communityLoader_Loader')
self.left_panel = LeftPanel()
self._tool_bar = ToolBar()
class ToolBar(QObject):
def __init__(self):
super().__init__('mainWindow_statusToolBar_StatusToolBar')
self._more_options_button = Button('statusToolBar_chatToolbarMoreOptionsButton')
self._options_list = List('o_StatusListView')
@allure.step('Open edit community popup')
def open_edit_community_popup(self):
self._more_options_button.click()
self._options_list.select()
class LeftPanel(QObject):
def __init__(self):
super().__init__('mainWindow_communityColumnView_CommunityColumnView')
self._community_info_button = Button('mainWindow_communityHeaderButton_StatusChatInfoButton')
self._community_logo = QObject('mainWindow_identicon_StatusSmartIdenticon')
self._name_text_label = TextLabel('mainWindow_statusChatInfoButtonNameText_TruncatedTextWithTooltip')
self._members_text_label = TextLabel('mainWindow_Members_TruncatedTextWithTooltip')
@property
@allure.step('Get community logo')
def logo(self) -> Image:
return self._community_logo.image
@property
@allure.step('Get community name')
def name(self) -> str:
return self._name_text_label.text
@property
@allure.step('Get community members label')
def members(self) -> str:
return self._members_text_label.text
@allure.step('Open community settings')
def open_community_settings(self):
self._community_info_button.click()
return CommunitySettingsScreen().wait_until_appears()

View File

@ -0,0 +1,18 @@
import allure
from gui.components.community.create_community_popups import CreateCommunitiesBanner
from gui.elements.qt.button import Button
from gui.elements.qt.object import QObject
from gui.screens.community import CommunityScreen
class CommunitiesPortal(QObject):
def __init__(self):
super().__init__('mainWindow_communitiesPortalLayout_CommunitiesPortalLayout')
self._create_community_button = Button('mainWindow_Create_New_Community_StatusButton')
@allure.step('Open create community popup')
def open_create_community_popup(self) -> CommunityScreen:
self._create_community_button.click()
return CreateCommunitiesBanner().wait_until_appears().open_create_community_popup()

View File

@ -0,0 +1,206 @@
import typing
import allure
import driver
from gui.components.color_select_popup import ColorSelectPopup
from gui.components.community.tags_select_popup import TagsSelectPopup
from gui.components.os.open_file_dialogs import OpenFileDialog
from gui.components.picture_edit_popup import PictureEditPopup
from gui.elements.qt.button import Button
from gui.elements.qt.check_box import CheckBox
from gui.elements.qt.object import QObject
from gui.elements.qt.scroll import Scroll
from gui.elements.qt.text_edit import TextEdit
from gui.elements.qt.text_label import TextLabel
from scripts.tools.image import Image
class CommunitySettingsScreen(QObject):
def __init__(self):
super().__init__('mainWindow_communityLoader_Loader')
self.left_panel = LeftPanel()
class LeftPanel(QObject):
def __init__(self):
super().__init__('mainWindow_communityColumnView_CommunityColumnView')
self._back_to_community_button = Button('mainWindow_communitySettingsBackToCommunityButton_StatusBaseText')
self._overview_button = Button('overview_StatusNavigationListItem')
self._members_button = Button('members_StatusNavigationListItem')
@allure.step('Open community main view')
def back_to_community(self):
self._back_to_community_button.click()
@allure.step('Open community overview')
def open_overview(self) -> 'OverviewView':
if not self._overview_button.is_selected:
self._overview_button.click()
return OverviewView().wait_until_appears()
@allure.step('Open community members')
def open_members(self) -> 'MembersView':
if not self._members_button.is_selected:
self._members_button.click()
return MembersView().wait_until_appears()
class OverviewView(QObject):
def __init__(self):
super().__init__('mainWindow_OverviewSettingsPanel')
self._name_text_label = TextLabel('communityOverviewSettingsCommunityName_StatusBaseText')
self._description_text_label = TextLabel('communityOverviewSettingsCommunityDescription_StatusBaseText')
self._edit_button = Button('mainWindow_Edit_Community_StatusButton')
@property
@allure.step('Get community name')
def name(self) -> str:
return self._name_text_label.text
@property
@allure.step('Get community description')
def description(self) -> str:
return self._description_text_label.text
@allure.step('Open edit community view')
def open_edit_community_view(self) -> 'EditCommunityView':
self._edit_button.click()
return EditCommunityView().wait_until_appears()
class EditCommunityView(QObject):
def __init__(self):
super().__init__('mainWindow_communityEditPanelScrollView_EditSettingsPanel')
self._scroll = Scroll('communityEditPanelScrollView_Flickable')
self._name_text_edit = TextEdit('communityEditPanelScrollView_communityNameInput_TextEdit')
self._description_text_edit = TextEdit('communityEditPanelScrollView_communityDescriptionInput_TextEdit')
self._logo = QObject('communityEditPanelScrollView_image_StatusImage')
self._add_logo_button = Button('communityEditPanelScrollView_editButton_StatusRoundButton')
self._banner = QObject('communityEditPanelScrollView_image_StatusImage_2')
self._add_banner_button = Button('communityEditPanelScrollView_editButton_StatusRoundButton_2')
self._select_color_button = Button('communityEditPanelScrollView_StatusPickerButton')
self._choose_tag_button = Button('communityEditPanelScrollView_Choose_StatusPickerButton')
self._tag_item = QObject('communityEditPanelScrollView_StatusCommunityTag')
self._archive_support_checkbox = CheckBox('communityEditPanelScrollView_archiveSupportToggle_StatusCheckBox')
self._request_to_join_checkbox = CheckBox('communityEditPanelScrollView_requestToJoinToggle_StatusCheckBox')
self._pin_messages_checkbox = CheckBox('communityEditPanelScrollView_pinMessagesToggle_StatusCheckBox')
self._intro_text_edit = TextEdit('communityEditPanelScrollView_editCommunityIntroInput_TextEdit')
self._outro_text_edit = TextEdit('communityEditPanelScrollView_editCommunityOutroInput_TextEdit')
self._save_changes_button = Button('mainWindow_Save_changes_StatusButton')
@property
@allure.step('Get community name')
def name(self) -> str:
return self._name_text_edit.text
@name.setter
@allure.step('Set community name')
def name(self, value: str):
self._name_text_edit.text = value
@property
@allure.step('Get community description')
def description(self) -> str:
return self._description_text_edit.text
@description.setter
@allure.step('Set community description')
def description(self, value: str):
self._description_text_edit.text = value
@property
@allure.step('Get community logo')
def logo(self) -> Image:
return self._logo.image
@logo.setter
@allure.step('Set community description')
def logo(self, kwargs: dict):
self._add_logo_button.click()
OpenFileDialog().wait_until_appears().open_file(kwargs['fp'])
PictureEditPopup().wait_until_appears().make_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
@property
@allure.step('Get community banner')
def banner(self) -> Image:
return self._banner.image
@banner.setter
@allure.step('Set community description')
def banner(self, kwargs: dict):
self._add_banner_button.click()
OpenFileDialog().wait_until_appears().open_file(kwargs['fp'])
PictureEditPopup().wait_until_appears().make_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
@property
@allure.step('Get community color')
def color(self) -> str:
return str(self._select_color_button.object.text)
@color.setter
@allure.step('Set community color')
def color(self, value: str):
self._scroll.vertical_scroll_to(self._select_color_button)
self._select_color_button.click()
ColorSelectPopup().wait_until_appears().select_color(value)
@property
@allure.step('Get community tags')
def tags(self):
self._scroll.vertical_scroll_to(self._choose_tag_button)
return [str(tag.title) for tag in driver.fiandAllObjects(self._tag_item.real_name)]
@tags.setter
@allure.step('Set community tags')
def tags(self, values: typing.List[str]):
self._scroll.vertical_scroll_to(self._choose_tag_button)
self._choose_tag_button.click()
TagsSelectPopup().wait_until_appears().select_tags(values)
@property
@allure.step('Get community intro')
def intro(self) -> str:
self._scroll.vertical_scroll_to(self._intro_text_edit)
return self._intro_text_edit.text
@intro.setter
@allure.step('Set community intro')
def intro(self, value: str):
self._scroll.vertical_scroll_to(self._intro_text_edit)
self._intro_text_edit.text = value
@property
@allure.step('Get community outro')
def outro(self) -> str:
self._scroll.vertical_scroll_to(self._outro_text_edit)
return self._outro_text_edit.text
@outro.setter
@allure.step('Set community outro')
def outro(self, value: str):
self._scroll.vertical_scroll_to(self._outro_text_edit)
self._outro_text_edit.text = value
@allure.step('Edit community')
def edit(self, kwargs):
for key in list(kwargs):
setattr(self, key, kwargs.get(key))
self._save_changes_button.click()
self.wait_until_hidden()
class MembersView(QObject):
def __init__(self):
super().__init__('mainWindow_MembersSettingsPanel')
self._member_list_item = QObject('memberItem_StatusMemberListItem')
@property
@allure.step('Get community members')
def members(self) -> typing.List[str]:
return [str(member.title) for member in driver.findAllObjects(self._member_list_item.real_name)]

View File

@ -5,10 +5,11 @@ from abc import abstractmethod
import allure
import configs
import constants.tesseract
import driver
from gui.components.os.open_file_dialogs import OpenFileDialog
from gui.components.profile_picture_popup import ProfilePicturePopup
from gui.components.picture_edit_popup import PictureEditPopup
from gui.elements.qt.button import Button
from gui.elements.qt.object import QObject
from gui.elements.qt.text_edit import TextEdit
@ -31,10 +32,10 @@ class AllowNotificationsView(QObject):
self.wait_until_hidden()
class WelcomeScreen(QObject):
class WelcomeView(QObject):
def __init__(self):
super(WelcomeScreen, self).__init__('mainWindow_WelcomeView')
super(WelcomeView, self).__init__('mainWindow_WelcomeView')
self._new_user_button = Button('mainWindow_I_am_new_to_Status_StatusBaseText')
self._existing_user_button = Button('mainWindow_I_already_use_Status_StatusBaseText')
@ -45,10 +46,10 @@ class WelcomeScreen(QObject):
return KeysView().wait_until_appears()
class OnboardingScreen(QObject):
class OnboardingView(QObject):
def __init__(self, object_name):
super(OnboardingScreen, self).__init__(object_name)
super(OnboardingView, self).__init__(object_name)
self._back_button = Button('mainWindow_onboardingBackButton_StatusRoundButton')
@abstractmethod
@ -56,7 +57,7 @@ class OnboardingScreen(QObject):
pass
class KeysView(OnboardingScreen):
class KeysView(OnboardingView):
def __init__(self):
super(KeysView, self).__init__('mainWindow_KeysMainView')
@ -80,12 +81,12 @@ class KeysView(OnboardingScreen):
return ImportSeedPhraseView().wait_until_appears()
@allure.step('Go back')
def back(self) -> WelcomeScreen:
def back(self) -> WelcomeView:
self._back_button.click()
return WelcomeScreen().wait_until_appears()
return WelcomeView().wait_until_appears()
class ImportSeedPhraseView(OnboardingScreen):
class ImportSeedPhraseView(OnboardingView):
def __init__(self):
super(ImportSeedPhraseView, self).__init__('mainWindow_KeysMainView')
@ -102,7 +103,7 @@ class ImportSeedPhraseView(OnboardingScreen):
return KeysView().wait_until_appears()
class SeedPhraseInputView(OnboardingScreen):
class SeedPhraseInputView(OnboardingView):
def __init__(self):
super(SeedPhraseInputView, self).__init__('mainWindow_SeedPhraseInputView')
@ -134,7 +135,7 @@ class SeedPhraseInputView(OnboardingScreen):
return YourProfileView().wait_until_appears()
class KeycardInitView(OnboardingScreen):
class KeycardInitView(OnboardingView):
def __init__(self):
super(KeycardInitView, self).__init__('mainWindow_KeycardInitView')
@ -149,7 +150,7 @@ class KeycardInitView(OnboardingScreen):
return KeysView().wait_until_appears()
class YourProfileView(OnboardingScreen):
class YourProfileView(OnboardingView):
def __init__(self):
super(YourProfileView, self).__init__('mainWindow_InsertDetailsView')
@ -175,13 +176,13 @@ class YourProfileView(OnboardingScreen):
return self
@allure.step('Set user image')
def set_user_image(self, fp: SystemPath) -> ProfilePicturePopup:
def set_user_image(self, fp: SystemPath) -> PictureEditPopup:
allure.attach(name='User image', body=fp.read_bytes(), attachment_type=allure.attachment_type.PNG)
self._upload_picture_button.hover()
self._upload_picture_button.click()
file_dialog = OpenFileDialog().wait_until_appears()
file_dialog.open_file(fp)
return ProfilePicturePopup().wait_until_appears()
return PictureEditPopup().wait_until_appears()
@allure.step('Open Emoji and Icon view')
def next(self) -> 'EmojiAndIconView':
@ -195,7 +196,7 @@ class YourProfileView(OnboardingScreen):
return KeysView().wait_until_appears()
class EmojiAndIconView(OnboardingScreen):
class EmojiAndIconView(OnboardingView):
def __init__(self):
super(EmojiAndIconView, self).__init__('mainWindow_InsertDetailsView')
@ -265,7 +266,7 @@ class EmojiAndIconView(OnboardingScreen):
return self.profile_image.has_color(constants.Color.WHITE, crop=crop)
class CreatePasswordView(OnboardingScreen):
class CreatePasswordView(OnboardingView):
def __init__(self):
super(CreatePasswordView, self).__init__('mainWindow_CreatePasswordView')
@ -294,7 +295,7 @@ class CreatePasswordView(OnboardingScreen):
return EmojiAndIconView().wait_until_appears()
class ConfirmPasswordView(OnboardingScreen):
class ConfirmPasswordView(OnboardingView):
def __init__(self):
super(ConfirmPasswordView, self).__init__('mainWindow_ConfirmPasswordView')
@ -312,7 +313,7 @@ class ConfirmPasswordView(OnboardingScreen):
return CreatePasswordView().wait_until_appears()
class TouchIDAuthView(OnboardingScreen):
class TouchIDAuthView(OnboardingView):
def __init__(self):
super(TouchIDAuthView, self).__init__('mainWindow_TouchIDAuthView')
@ -322,3 +323,44 @@ class TouchIDAuthView(OnboardingScreen):
def prefer_password(self):
self._prefer_password_button.click()
self.wait_until_hidden()
class LoginView(QObject):
def __init__(self):
super(LoginView, self).__init__('mainWindow_LoginView')
self._password_text_edit = TextEdit('loginView_passwordInput')
self._arrow_right_button = Button('loginView_submitBtn')
self._current_user_name_label = TextLabel('loginView_currentUserNameLabel')
self._change_account_button = Button('loginView_changeAccountBtn')
self._accounts_combobox = QObject('accountsView_accountListPanel')
@allure.step('Log in user')
def log_in(self, account):
if self._current_user_name_label.text != account.name:
self._change_account_button.hover()
self._change_account_button.click()
self.select_user_name(account.name)
self._password_text_edit.text = account.password
self._arrow_right_button.click()
self.wait_until_hidden()
@allure.step('Select user')
def select_user_name(self, user_name, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
names = set()
def _select_user() -> bool:
for index in range(self._accounts_combobox.object.count):
name_object = self._accounts_combobox.object.itemAt(index)
name_label = str(name_object.label)
names.add(name_label)
if name_label == user_name:
try:
driver.mouseClick(name_object)
except RuntimeError:
continue
return True
return False
assert driver.waitFor(lambda: _select_user(), timeout_msec), f'User name: "{user_name}" not found in {names}'

View File

@ -0,0 +1,77 @@
import typing
import allure
import driver
from constants import UserCommunity
from driver import objects_access
from gui.elements.qt.button import Button
from gui.elements.qt.object import QObject
from gui.elements.qt.text_label import TextLabel
from gui.screens.community_settings import CommunitySettingsScreen
class SettingsScreen(QObject):
def __init__(self):
super().__init__('mainWindow_ProfileLayout')
self._settings_section_template = QObject('scrollView_AppMenuItem_StatusNavigationListItem')
def _open_settings(self, index: int):
self._settings_section_template.real_name['objectName'] = f'{index}-AppMenuItem'
self._settings_section_template.click()
@allure.step('Open communities settings')
def open_communities_settings(self):
self._open_settings(12)
return CommunitiesSettingsView()
class CommunitiesSettingsView(QObject):
def __init__(self):
super().__init__('mainWindow_CommunitiesView')
self._community_item = QObject('settingsContentBaseScrollView_listItem_StatusListItem')
self._community_template_image = QObject('settings_iconOrImage_StatusSmartIdenticon')
self._community_template_name = TextLabel('settings_Name_StatusTextWithLoadingState')
self._community_template_description = TextLabel('settings_statusListItemSubTitle')
self._community_template_members = TextLabel('settings_member_StatusTextWithLoadingState')
self._community_template_button = Button('settings_StatusFlatButton')
@property
@allure.step('Get communities')
def communities(self) -> typing.List[UserCommunity]:
_communities = []
for obj in driver.findAllObjects(self._community_item.real_name):
container = driver.objectMap.realName(obj)
self._community_template_image.real_name['container'] = container
self._community_template_name.real_name['container'] = container
self._community_template_description.real_name['container'] = container
self._community_template_members.real_name['container'] = container
_communities.append(UserCommunity(
self._community_template_name.text,
self._community_template_description.text,
self._community_template_members.text,
self._community_template_image.image
))
return _communities
def _get_community_item(self, name: str):
for obj in driver.findAllObjects(self._community_item.real_name):
for item in objects_access.walk_children(obj):
if getattr(item, 'text', '') == name:
return obj
raise LookupError(f'Community item: {name} not found')
@allure.step('Open community info')
def get_community_info(self, name: str) -> UserCommunity:
for community in self.communities:
if community.name == name:
return community
raise LookupError(f'Community item: {name} not found')
@allure.step('Open community overview settings')
def open_community_overview_settings(self, name: str):
driver.mouseClick(self._get_community_item(name))
return CommunitySettingsScreen().wait_until_appears()

View File

@ -66,11 +66,15 @@ class Image:
path.parent.mkdir(parents=True, exist_ok=True)
if path.exists() and not force:
raise FileExistsError(path)
if self.view is None:
self.update_view()
cv2.imwrite(str(path), self.view)
@allure.step('Compare images')
def compare(
self, expected: np.ndarray, threshold: float = 0.99) -> bool:
if self.view is None:
self.update_view()
correlation = Ocv.compare_images(self.view, expected)
result = correlation >= threshold
_logger.info(f'Images equals on: {abs(round(correlation, 4) * 100)}%')

View File

@ -3,8 +3,11 @@ from datetime import datetime
import pytest
import configs
import constants
from constants import UserAccount
from driver.aut import AUT
from gui.main_window import MainWindow
from gui.screens.onboarding import LoginView
from scripts.utils import system_path
@ -33,3 +36,21 @@ def main_window(aut: AUT, user_data):
aut.launch(f'-d={user_data.parent}')
yield MainWindow().wait_until_appears().prepare()
aut.detach().stop()
@pytest.fixture
def user_account(request) -> UserAccount:
if hasattr(request, 'param'):
user_account = request.param
assert isinstance(user_account, UserAccount)
else:
user_account = constants.user.user_account_default
yield user_account
@pytest.fixture
def main_screen(user_account: UserAccount, main_window: MainWindow) -> MainWindow:
if LoginView().is_visible:
yield main_window.log_in(user_account)
else:
yield main_window.sign_up(user_account)

View File

@ -0,0 +1,171 @@
from datetime import datetime
import allure
import pytest
from allure_commons._allure import step
import configs.testpath
from gui.main_window import MainWindow
from scripts.tools import image
pytestmark = allure.suite("Communities")
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703084', 'Create community')
@pytest.mark.case(703084)
@pytest.mark.parametrize('community_params', [
{
'name': f'Name',
'description': f'Description',
'logo': {'fp': configs.testpath.TEST_FILES / 'tv_signal.png', 'zoom': None, 'shift': None},
'banner': {'fp': configs.testpath.TEST_FILES / 'banner.png', 'zoom': None, 'shift': None},
'color': '#ff7d46',
'tags': ['Culture', 'Sports'],
'intro': 'Intro',
'outro': 'Outro'
}
])
def test_create_community(user_account, main_screen: MainWindow, community_params):
with step('Create community'):
communities_portal = main_screen.left_panel.open_communities_portal()
create_community_form = communities_portal.open_create_community_popup()
community_screen = create_community_form.create(community_params)
with step('Verify community parameters in community overview'):
with step('Icon is correct'):
community_icon = main_screen.left_panel.get_community_logo(community_params['name'])
image.compare(community_icon, 'button_logo.png', timout_sec=5)
with step('Name is correct'):
assert community_screen.left_panel.name == community_params['name']
with step('Members count is correct'):
assert '1' in community_screen.left_panel.members
with step('Logo is correct'):
image.compare(community_screen.left_panel.logo, 'logo.png')
with step('Verify community parameters in community settings view'):
community_setting = community_screen.left_panel.open_community_settings()
overview_setting = community_setting.left_panel.open_overview()
with step('Name is correct'):
assert overview_setting.name == community_params['name']
with step('Description is correct'):
assert overview_setting.description == community_params['description']
with step('Members count is correct'):
members_settings = community_setting.left_panel.open_members()
assert user_account.name in members_settings.members
with step('Verify community parameters in community settings screen'):
settings_screen = main_screen.left_panel.open_settings()
community_settings = settings_screen.open_communities_settings()
community = community_settings.get_community_info(community_params['name'])
assert community.name == community_params['name']
assert community.description == community_params['description']
assert '1' in community.members
image.compare(community.image, 'logo_in_settings.png')
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703056', 'Edit community separately')
@pytest.mark.case(703056)
@pytest.mark.parametrize('default_params, update_params', [(
{
'name': 'Name',
'description': 'Description',
'logo': {'fp': configs.testpath.TEST_FILES / 'tv_signal.png', 'zoom': None, 'shift': None},
'banner': {'fp': configs.testpath.TEST_FILES / 'banner.png', 'zoom': None, 'shift': None},
'intro': 'Intro',
'outro': 'Outro'
},
{
'name': f'Name_{datetime.now():%H%M%S}',
'description': f'Description_{datetime.now():%H%M%S}',
'color': '#ff7d46',
},
)])
def test_edit_community_separately(main_screen: MainWindow, default_params, update_params):
with step('Create community'):
communities_portal = main_screen.left_panel.open_communities_portal()
create_community_form = communities_portal.open_create_community_popup()
community_screen = create_community_form.create(default_params)
with step('Edit community name'):
community_setting = community_screen.left_panel.open_community_settings()
edit_community_form = community_setting.left_panel.open_overview().open_edit_community_view()
edit_community_form.edit({'name': update_params['name']})
with step('Name is correct'):
overview_setting = community_setting.left_panel.open_overview()
assert overview_setting.name == update_params['name']
with step('Description is correct'):
assert overview_setting.description == default_params['description']
with step('Edit community name'):
edit_community_form = overview_setting.open_edit_community_view()
edit_community_form.edit({'description': update_params['description']})
with step('Name is correct'):
overview_setting = community_setting.left_panel.open_overview()
assert overview_setting.name == update_params['name']
with step('Description is correct'):
assert overview_setting.description == update_params['description']
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703057', 'Edit community')
@pytest.mark.case(703057)
@pytest.mark.parametrize('default_params, community_params', [(
{
'name': f'Name_{datetime.now():%H%M%S}',
'description': f'Description_{datetime.now():%H%M%S}',
'logo': {'fp': configs.testpath.TEST_FILES / 'tv_signal.png', 'zoom': None, 'shift': None},
'banner': {'fp': configs.testpath.TEST_FILES / 'banner.png', 'zoom': None, 'shift': None},
'color': '#ff7d46',
'tags': ['Culture', 'Sports'],
'intro': 'Intro',
'outro': 'Outro'
},
{
'name': 'Updated Name',
'description': 'Updated Description',
'logo': {'fp': configs.testpath.TEST_FILES / 'banner.png', 'zoom': None, 'shift': None},
'banner': {'fp': configs.testpath.TEST_FILES / 'tv_signal.png', 'zoom': None, 'shift': None},
'color': '#7140fd',
'tags': ['Ethereum'],
'intro': 'Updated Intro',
'outro': 'Updated Outro'
}
)])
def test_edit_community(main_screen: MainWindow, default_params, community_params):
with step('Create community'):
communities_portal = main_screen.left_panel.open_communities_portal()
create_community_form = communities_portal.open_create_community_popup()
community_screen = create_community_form.create(default_params)
with step('Edit community'):
community_setting = community_screen.left_panel.open_community_settings()
edit_community_form = community_setting.left_panel.open_overview().open_edit_community_view()
edit_community_form.edit(community_params)
with step('Verify community parameters on settings overview'):
overview_setting = community_setting.left_panel.open_overview()
with step('Name is correct'):
assert overview_setting.name == community_params['name']
with step('Description is correct'):
assert overview_setting.description == community_params['description']
with step('Verify community parameters in community screen'):
community_setting.left_panel.back_to_community()
with step('Icon is correct'):
community_icon = main_screen.left_panel.get_community_logo(community_params['name'])
image.compare(community_icon, 'button_updated_logo.png')
with step('Name is correct'):
assert community_screen.left_panel.name == community_params['name']
with step('Logo is correct'):
image.compare(community_screen.left_panel.logo, 'updated_logo.png')
with step('Verify community parameters in community settings screen'):
settings_screen = main_screen.left_panel.open_settings()
community_settings = settings_screen.open_communities_settings()
community = community_settings.communities[0]
assert community.name == community_params['name']
assert community.description == community_params['description']
assert '1' in community.members
image.compare(community.image, 'logo_in_settings_updated.png')

View File

@ -7,11 +7,11 @@ from allure import step
import configs.timeouts
import constants
import driver
from gui.components.before_started_popup import BeforeStartedPopUp
from gui.components.profile_picture_popup import shift_image
from gui.components.onboarding.before_started_popup import BeforeStartedPopUp
from gui.components.onboarding.welcome_status_popup import WelcomeStatusPopup
from gui.components.picture_edit_popup import shift_image
from gui.components.splash_screen import SplashScreen
from gui.components.welcome_status_popup import WelcomeStatusPopup
from gui.screens.onboarding import AllowNotificationsView, WelcomeScreen, TouchIDAuthView, KeysView
from gui.screens.onboarding import AllowNotificationsView, WelcomeView, TouchIDAuthView, KeysView
from scripts.tools import image
_logger = logging.getLogger(__name__)
@ -24,7 +24,7 @@ def keys_screen(main_window) -> KeysView:
if configs.system.IS_MAC:
AllowNotificationsView().wait_until_appears().allow()
BeforeStartedPopUp().get_started()
wellcome_screen = WelcomeScreen().wait_until_appears()
wellcome_screen = WelcomeView().wait_until_appears()
return wellcome_screen.get_keys()
@ -43,7 +43,7 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
profile_view.set_display_name(user_name)
if user_image is not None:
profile_picture_popup = profile_view.set_user_image(configs.testpath.TEST_FILES / user_image)
profile_picture_popup.make_profile_picture(zoom=zoom, shift=shift)
profile_picture_popup.make_picture(zoom=zoom, shift=shift)
assert not profile_view.error_message
with step('Open Profile details view and verify user info'):
@ -108,7 +108,7 @@ def test_generate_new_keys(main_window, keys_screen, user_name: str, password, u
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703039', 'Import: 12 word seed phrase')
@pytest.mark.case(703039)
@pytest.mark.parametrize('user_account', [constants.user.user_account])
@pytest.mark.parametrize('user_account', [constants.user.user_account_default])
def test_import_seed_phrase(keys_screen, main_window, user_account):
with step('Open import seed phrase view and enter seed phrase'):
input_view = keys_screen.open_import_seed_phrase_view().open_seed_phrase_input_view()

View File

@ -8,5 +8,5 @@ _logger = logging.getLogger(__name__)
pytestmark = allure.suite("Self")
def test_start_aut(main_window):
def test_start_aut():
driver.context.detach()