chore: fix creation of community

This commit is contained in:
Valentina Novgorodtceva 2024-05-02 17:04:06 +02:00 committed by Anastasiya
parent 2a4adb344b
commit 0e1d0bc854
5 changed files with 91 additions and 54 deletions

View File

@ -54,38 +54,32 @@ class CreateCommunityPopup(BasePopup):
self._cropped_image_logo_item = QObject(names.croppedImageLogo)
self._cropped_image_banner_item = QObject(names.croppedImageBanner)
@property
@allure.step('Get next button enabled state')
def is_next_button_enabled(self) -> bool:
return driver.waitForObjectExists(self._next_button.real_name, configs.timeouts.UI_LOAD_TIMEOUT_MSEC).enabled
@property
@allure.step('Get archive support checkbox state')
def is_archive_checkbox_checked(self) -> bool:
self._scroll.vertical_scroll_to(self._archive_support_checkbox)
return self._archive_support_checkbox.is_checked
@property
@allure.step('Get request to join checkbox state')
def is_request_to_join_checkbox_checked(self) -> bool:
self._scroll.vertical_scroll_to(self._request_to_join_checkbox)
return self._request_to_join_checkbox.is_checked
@property
@allure.step('Get pin messaged checkbox state')
def is_pin_messages_checkbox_checked(self) -> bool:
self._scroll.vertical_scroll_to(self._pin_messages_checkbox)
return self._pin_messages_checkbox.is_checked
@property
@allure.step('Get community name')
def name(self) -> str:
def get_name(self) -> str:
self._scroll.vertical_scroll_to(self._name_text_edit)
return self._name_text_edit.text
@name.setter
@allure.step('Set community name')
def name(self, value: str):
def set_name(self, value: str):
self._scroll.vertical_scroll_to(self._name_text_edit)
self._name_text_edit.text = value
@ -95,9 +89,8 @@ class CreateCommunityPopup(BasePopup):
self._scroll.vertical_scroll_to(self._description_text_edit)
return self._description_text_edit.text
@description.setter
@allure.step('Set community name')
def description(self, value: str):
def set_description(self, value: str):
self._scroll.vertical_scroll_to(self._description_text_edit)
self._description_text_edit.text = value
@ -120,7 +113,8 @@ class CreateCommunityPopup(BasePopup):
@allure.step('Set community logo')
def logo(self, kwargs: dict):
self._open_logo_file_dialog().open_file(kwargs['fp'])
PictureEditPopup().wait_until_appears().set_zoom_shift_for_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
PictureEditPopup().wait_until_appears().set_zoom_shift_for_picture(kwargs.get('zoom', None),
kwargs.get('shift', None))
@property
@allure.step('Get community banner')
@ -131,7 +125,8 @@ class CreateCommunityPopup(BasePopup):
def banner(self, kwargs: dict):
self._add_banner_button.click()
OpenFileDialog().wait_until_appears().open_file(kwargs['fp'])
PictureEditPopup().wait_until_appears().set_zoom_shift_for_picture(kwargs.get('zoom', None), kwargs.get('shift', None))
PictureEditPopup().wait_until_appears().set_zoom_shift_for_picture(kwargs.get('zoom', None),
kwargs.get('shift', None))
@allure.step('Set community logo without file upload dialog')
def set_logo_without_file_upload_dialog(self, path):
@ -145,30 +140,26 @@ class CreateCommunityPopup(BasePopup):
self._cropped_image_banner_item.object.cropImage('file://' + str(path))
return PictureEditPopup()
@property
@allure.step('Get community color')
def color(self):
def get_color(self):
return self._select_color_button.object.bgColor.name
@color.setter
@allure.step('Set community color')
def color(self, value: str):
def set_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):
def get_tags(self):
tags_string = str(self._community_tags_picker_button.object.selectedTags)
symbols = '[]"'
for symbol in symbols:
tags_string = tags_string.replace(symbol, '')
return tags_string.split(',')
@tags.setter
@allure.step('Set community tags')
def tags(self, values: typing.List[str]):
def set_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)
@ -178,9 +169,8 @@ class CreateCommunityPopup(BasePopup):
def intro(self) -> str:
return self._intro_text_edit.text
@intro.setter
@allure.step('Set community intro')
def intro(self, value: str):
def set_intro(self, value: str):
self._intro_text_edit.text = value
@property
@ -188,26 +178,46 @@ class CreateCommunityPopup(BasePopup):
def outro(self) -> str:
return self._outro_text_edit.text
@outro.setter
@allure.step('Set community outro')
def outro(self, value: str):
def set_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 without file upload dialog usage')
def create_community(self, name, description, intro, outro, logo, banner):
self.name = name
self.description = description
@allure.step('Select color and verify it was set correctly')
def verify_color(self, color: str):
assert self.get_color() == color
@allure.step('Select tags and verify they were set correctly')
def verify_tags(self, tags: typing.List[str]):
actual_tags = self.get_tags()
assert tags == actual_tags
@allure.step('Verify default values of checkboxes')
def verify_checkboxes_values(self):
assert not self.is_archive_checkbox_checked()
assert not self.is_request_to_join_checkbox_checked()
assert not self.is_pin_messages_checkbox_checked()
@allure.step('Verify community create popup fields and create community without file upload dialog usage')
def create_community(self, name: str, description: str, intro: str, outro: str, logo, banner, color: str,
tags_to_set: typing.List[str], tags):
self.set_name(name)
self.set_description(description)
self.set_logo_without_file_upload_dialog(logo)
PictureEditPopup().set_zoom_shift_for_picture(None, None)
self.set_banner_without_file_upload_dialog(banner)
PictureEditPopup().set_zoom_shift_for_picture(None, None)
self.set_color(color)
self.verify_color(color)
self.set_tags(tags_to_set)
self.verify_tags(tags)
self.verify_checkboxes_values()
self._next_button.click()
self.intro = intro
self.outro = outro
self.set_intro(intro)
self.set_outro(outro)
self._create_community_button.click()
self.wait_until_hidden()
return CommunityScreen().wait_until_appears()

View File

@ -180,7 +180,7 @@ communitySettings_SaveColor_Button = {"container": statusDesktop_mainWindow_over
# 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}
confirm_Community_Tags_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "confirmCommunityTagsButton", "type": "StatusButton", "visible": True}
tags_edit_TextEdit = {"container": statusDesktop_mainWindow_overlay, "id": "edit", "type": "TextEdit", "unnamed": 1, "visible": True}
selected_tags_text = {"container": statusDesktop_mainWindow_overlay, "type": "StatusBaseText", "unnamed": 1, "visible": True}
@ -630,6 +630,12 @@ mainWindow_EnsRegisteredView = {"container": statusDesktop_mainWindow, "type": "
# ONBOARDING NAMES
mainWindow_onboardingBackButton_StatusRoundButton = {"container": statusDesktop_mainWindow, "objectName": "onboardingBackButton", "type": "StatusRoundButton", "visible": True}
# Advanced view
mainWindow_AdvancedView = {"container": mainWindow_StatusWindow, "type": "AdvancedView", "unnamed": 1, "visible": True}
mainWindow_settingsContentBaseScrollView_StatusScrollView = {"container": mainWindow_StatusWindow, "objectName": "settingsContentBaseScrollView", "type": "StatusScrollView", "visible": True}
manageCommunitiesOnTestnetButton_StatusSettingsLineButton = {"container": mainWindow_settingsContentBaseScrollView_StatusScrollView, "objectName": "manageCommunitiesOnTestnetButton", "type": "StatusSettingsLineButton", "visible": True}
enableCreateCommunityButton_StatusSettingsLineButton = {"container": settingsContentBase_ScrollView, "objectName": "enableCreateCommunityButton", "type": "StatusSettingsLineButton", "visible": True}
# Allow Notification View
mainWindow_AllowNotificationsView = {"container": statusDesktop_mainWindow, "type": "AllowNotificationsView", "unnamed": 1, "visible": True}
mainWindow_Start_using_Status_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow, "objectName": "allowNotificationsOnboardingOkButton", "type": "StatusButton", "visible": True}

View File

@ -6,6 +6,7 @@ from gui.components.back_up_your_seed_phrase_popup import BackUpYourSeedPhrasePo
from gui.elements.object import QObject
from gui.elements.scroll import Scroll
from gui.objects_map import names
from gui.screens.settings_advanced import AdvancedSettingsView
from gui.screens.settings_communities import CommunitiesSettingsView
from gui.screens.settings_ens_usernames import ENSSettingsView
from gui.screens.settings_keycard import KeycardSettingsView
@ -100,6 +101,12 @@ class LeftPanel(QObject):
self._open_settings('3-MainMenuItem')
return ENSSettingsView()
@allure.step('Open advanced settings')
def open_advanced_settings(self) -> 'AdvancedSettingsView':
time.sleep(1)
self._open_settings('11-SettingsMenuItem')
return AdvancedSettingsView()
class SettingsScreen(QObject):

View File

@ -0,0 +1,26 @@
import allure
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.elements.scroll import Scroll
from gui.objects_map import names
class AdvancedSettingsView(QObject):
def __init__(self):
super().__init__(names.mainWindow_AdvancedView)
self._scroll = Scroll(names.settingsContentBaseScrollView_Flickable)
self._manage_community_on_testnet_button = Button(
names.manageCommunitiesOnTestnetButton_StatusSettingsLineButton)
self._enable_creation_community_button = Button(names.enableCreateCommunityButton_StatusSettingsLineButton)
@allure.step('Switch manage community on testnet option')
def switch_manage_on_community(self):
self._scroll.vertical_down_to(self._manage_community_on_testnet_button)
self._manage_community_on_testnet_button.click()
@allure.step('Enable creation of communities')
def enable_creation_of_communities(self):
self._scroll.vertical_down_to(self._enable_creation_community_button)
self._enable_creation_community_button.click()

View File

@ -22,36 +22,24 @@ pytestmark = marks
@pytest.mark.case(703630)
@pytest.mark.parametrize('params', [constants.community_params])
def test_create_community(user_account, main_screen: MainWindow, params):
tags_to_set = constants.community_tags[:2]
color = ColorCodes.ORANGE.value
with step('Enable creation of community option'):
settings = main_screen.left_panel.open_settings()
settings.left_panel.open_advanced_settings().enable_creation_of_communities()
with step('Open create community popup'):
communities_portal = main_screen.left_panel.open_communities_portal()
create_community_form = communities_portal.open_create_community_popup()
with step('Verify community popup fields'):
with step('Next button is disabled'):
assert not driver.waitFor(lambda: create_community_form.is_next_button_enabled,
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), \
'Next button is enabled'
with step('Select color and verify that selected color is displayed in colorpicker field'):
create_community_form.color = color
assert create_community_form.color == color
with step(
'Select tags, verify that count of tags was changed and verify that selected tags are displayed in '
'tags field'):
create_community_form.tags = ['Activism', 'Art']
assert create_community_form.tags == tags_to_set
with step('Verify that checkboxes have correct default states'):
assert create_community_form.is_archive_checkbox_checked
assert not create_community_form.is_pin_messages_checkbox_checked
assert not create_community_form.is_request_to_join_checkbox_checked
with step('Verify next button is disabled'):
assert not driver.waitFor(lambda: create_community_form.is_next_button_enabled(),
configs.timeouts.UI_LOAD_TIMEOUT_MSEC), 'Next button is enabled'
with step('Verify fields of create community popup and create community'):
color = ColorCodes.ORANGE.value
community_screen = create_community_form.create_community(params['name'], params['description'],
params['intro'], params['outro'],
params['logo']['fp'], params['banner']['fp'])
params['logo']['fp'], params['banner']['fp'], color,
['Activism', 'Art'], constants.community_tags[:2])
with step('Verify community parameters in community overview'):
with step('Name is correct'):