chore: create community test updated

This commit is contained in:
Valentina Novgorodtceva 2024-02-19 14:18:46 +07:00 committed by Anastasiya
parent 1081d9768e
commit 0f90508113
8 changed files with 112 additions and 63 deletions

View File

@ -50,3 +50,5 @@ private_key_address_pair_1 = wallet_account('2daa36a3abe381a9c01610bf10fda272fbc
ens_user_name = ''.join(
random.choices(string.digits + string.ascii_lowercase, k=8))
community_tags = ['Activism', 'Art', 'Blockchain', 'Books & blogs', 'Career', 'Collaboration', 'Commerce', 'Culture', 'DAO', 'DIY', 'DeFi', 'Design', 'Education', 'Entertainment', 'Environment', 'Ethereum', 'Event', 'Fantasy', 'Fashion', 'Food', 'Gaming', 'Global', 'Health', 'Hobby', 'Innovation', 'Language', 'Lifestyle', 'Local', 'Love', 'Markets', 'Movies & TV', 'Music', 'NFT', 'NSFW', 'News', 'Non-profit', 'Org', 'Pets', 'Play', 'Podcast', 'Politics', 'Privacy', 'Product', 'Psyche', 'Security', 'Social', 'Software dev', 'Sports', 'Tech', 'Travel', 'Vehicles', 'Web3']

View File

@ -3,8 +3,10 @@ import typing
import allure
import configs
import driver
from gui.components.base_popup import BasePopup
from gui.components.color_select_popup import ColorSelectPopup
from gui.components.community.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
@ -41,6 +43,7 @@ class CreateCommunityPopup(BasePopup):
self._add_banner_button = Button(names.addButton_StatusRoundButton)
self._select_color_button = Button(names.StatusPickerButton)
self._choose_tag_button = Button(names.choose_tags_StatusPickerButton)
self._community_tags_picker_button = Button(names.communityTagsPicker_TagsPicker)
self._archive_support_checkbox = CheckBox(names.archiveSupportToggle_StatusCheckBox)
self._request_to_join_checkbox = CheckBox(names.requestToJoinToggle_StatusCheckBox)
self._pin_messages_checkbox = CheckBox(names.pinMessagesToggle_StatusCheckBox)
@ -51,24 +54,51 @@ 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:
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):
self._scroll.vertical_scroll_to(self._name_text_edit)
self._name_text_edit.text = value
@property
@allure.step('Get community description')
def description(self) -> str:
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):
self._scroll.vertical_scroll_to(self._description_text_edit)
self._description_text_edit.text = value
@property
@ -105,18 +135,20 @@ class CreateCommunityPopup(BasePopup):
@allure.step('Set community logo without file upload dialog')
def set_logo_without_file_upload_dialog(self, path):
self._scroll.vertical_scroll_to(self._add_logo_button)
self._cropped_image_logo_item.object.cropImage('file://' + str(path))
return PictureEditPopup()
@allure.step('Set community banner without file upload dialog')
def set_banner_without_file_upload_dialog(self, path):
self._scroll.vertical_scroll_to(self._add_banner_button)
self._cropped_image_banner_item.object.cropImage('file://' + str(path))
return PictureEditPopup()
@property
@allure.step('Get community color')
def color(self):
raise NotImplementedError
return self._select_color_button.object.bgColor.name
@color.setter
@allure.step('Set community color')
@ -128,7 +160,11 @@ class CreateCommunityPopup(BasePopup):
@property
@allure.step('Get community tags')
def tags(self):
raise NotImplementedError
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')
@ -162,15 +198,16 @@ class CreateCommunityPopup(BasePopup):
self._next_button.click()
@allure.step('Create community without file upload dialog usage')
def create_community(self, kwargs):
self.set_logo_without_file_upload_dialog(kwargs['logo']['fp'])
def create_community(self, name, description, intro, outro, logo, banner):
self.name = name
self.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(kwargs['banner']['fp'])
self.set_banner_without_file_upload_dialog(banner)
PictureEditPopup().set_zoom_shift_for_picture(None, None)
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._next_button.click()
self.intro = intro
self.outro = outro
self._create_community_button.click()
self.wait_until_hidden()
return CommunityScreen().wait_until_appears()

View File

@ -8,6 +8,7 @@ import driver
from gui.components.base_popup import BasePopup
from gui.elements.button import Button
from gui.elements.object import QObject
from gui.elements.text_edit import TextEdit
from gui.objects_map import names
@ -16,14 +17,14 @@ class TagsSelectPopup(BasePopup):
def __init__(self):
super().__init__()
self._tag_template = QObject(names.o_StatusCommunityTag)
self._save_button = Button(names.confirm_Community_Tags_StatusButton)
self._confirm_button = Button(names.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')
@allure.step('Select tags and confirm')
def select_tags(self, values: typing.List[str]):
tags = []
checked = []
@ -46,4 +47,4 @@ class TagsSelectPopup(BasePopup):
if values:
raise LookupError(
f'Tags: {values} not found in {tags}. Checked tags: {checked}, Unchecked tags: {unchecked}')
self._save_button.click()
self._confirm_button.click()

View File

@ -208,10 +208,10 @@ class MainWindow(Window):
return self.sign_up(user_account)
@allure.step('Create community')
def create_community(self, params: dict) -> CommunityScreen:
def create_community(self, name, description, intro, outro, logo, banner) -> CommunityScreen:
communities_portal = self.left_panel.open_communities_portal()
create_community_form = communities_portal.open_create_community_popup()
app_screen = create_community_form.create_community(params)
app_screen = create_community_form.create_community(name, description, intro, outro, logo, banner)
return app_screen
@allure.step('Wait for notification and get text')

View File

@ -173,6 +173,8 @@ 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}
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}
# Signing phrase popup
signPhrase_Ok_Button = {"container": statusDesktop_mainWindow, "type": "StatusFlatButton", "objectName": "signPhraseModalOkButton", "visible": True}

View File

@ -5,7 +5,7 @@ import allure
import driver
from driver.objects_access import walk_children
from gui.components.color_select_popup import ColorSelectPopup
from gui.components.community.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
@ -232,13 +232,16 @@ class EditCommunityView(QObject):
return self._pin_messages_checkbox.object.checked
@allure.step('Edit community')
def edit(self, kwargs):
self.set_logo_without_file_upload_dialog(kwargs['logo']['fp'])
def edit(self, name, description, intro, outro, logo, banner):
self._scroll.vertical_scroll_to(self._name_text_edit)
self.name = name
self.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(kwargs['banner']['fp'])
self.set_banner_without_file_upload_dialog(banner)
PictureEditPopup().set_zoom_shift_for_picture(None, None)
for key in list(kwargs):
setattr(self, key, kwargs.get(key))
self.intro = intro
self.outro = outro
self._save_changes_button.click()
self.wait_until_hidden()

View File

@ -3,6 +3,9 @@ from datetime import datetime
import allure
import pytest
from allure_commons._allure import step
import driver
from constants import ColorCodes
from . import marks
import configs.testpath
@ -13,14 +16,39 @@ pytestmark = marks
# @pytest.mark.critical TODO: https://github.com/status-im/status-desktop/issues/13483
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703084', 'Create community')
@pytest.mark.case(703084)
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703630', 'Create community')
@pytest.mark.case(703630)
@pytest.mark.parametrize('params', [constants.community_params])
def test_create_community(user_account, main_screen: MainWindow, params):
with step('Create community'):
tags_to_set = constants.community_tags[:2]
color = ColorCodes.ORANGE.value
with step('Open create community popup'):
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 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
community_screen = create_community_form.create_community(params['name'], params['description'],
params['intro'], params['outro'],
params['logo']['fp'], params['banner']['fp'])
with step('Verify community parameters in community overview'):
with step('Name is correct'):
@ -28,6 +56,14 @@ def test_create_community(user_account, main_screen: MainWindow, params):
with step('Members count is correct'):
assert '1' in community_screen.left_panel.members
with step('Verify General channel is present for recently created community'):
community_screen.verify_channel(
'general',
'General channel for the community',
None,
color
)
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()
@ -48,42 +84,6 @@ def test_create_community(user_account, main_screen: MainWindow, params):
assert '1' in community.members
@pytest.mark.skip(reason='https://github.com/status-im/desktop-qa-automation/issues/487')
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703056', 'Edit community separately')
@pytest.mark.case(703056)
@pytest.mark.parametrize('community_params', [
{
'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, community_params):
main_screen.create_community(constants.community_params)
with step('Edit community name'):
community_screen = main_screen.left_panel.select_community(constants.community_params['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': community_params['name']})
with step('Name is correct'):
overview_setting = community_setting.left_panel.open_overview()
assert overview_setting.name == community_params['name']
with step('Description is correct'):
assert overview_setting.description == constants.community_params['description']
with step('Edit community name'):
edit_community_form = overview_setting.open_edit_community_view()
edit_community_form.edit({'description': community_params['description']})
with step('Name is correct'):
overview_setting = community_setting.left_panel.open_overview()
assert overview_setting.name == community_params['name']
with step('Description is correct'):
assert overview_setting.description == community_params['description']
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703057', 'Edit community')
@pytest.mark.case(703057)
@pytest.mark.critical
@ -100,13 +100,17 @@ def test_edit_community_separately(main_screen, community_params):
}
])
def test_edit_community(main_screen: MainWindow, params):
main_screen.create_community(constants.community_params)
main_screen.create_community(constants.community_params['name'], constants.community_params['description'],
constants.community_params['intro'], constants.community_params['outro'],
constants.community_params['logo']['fp'], constants.community_params['banner']['fp'])
with step('Edit community'):
community_screen = main_screen.left_panel.select_community(constants.community_params['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(params)
edit_community_form.edit(params['name'], params['description'],
params['intro'], params['outro'],
params['logo']['fp'], params['banner']['fp'])
with step('Verify community parameters on settings overview'):
overview_setting = community_setting.left_panel.open_overview()