From 7b3936522f8b7198c7ce8d6b5fa5ab3cfd2de6d5 Mon Sep 17 00:00:00 2001 From: Anastasiya Semenkevich Date: Mon, 21 Oct 2024 12:16:06 +0300 Subject: [PATCH] chore(@e2e): edit community test improved --- .../{community_settings.py => community.py} | 5 +++ .../community/create_community_popups.py | 3 +- .../community/leave_community_confirmation.py | 15 +++++++ test/e2e/gui/components/context_menu.py | 11 ++++- test/e2e/gui/objects_map/communities_names.py | 6 +++ .../gui/screens/community_settings_tokens.py | 2 +- ...nities.py => test_communities_kick_ban.py} | 45 +------------------ ...test_communities_limit_to_5_permissions.py | 2 +- .../test_communities_screens_overview.py | 2 +- ...unity.py => test_community_create_edit.py} | 29 +++++++++--- ...y_permissions_add_edit_delete_duplicate.py | 2 +- .../test_block_unblock_user.py | 2 +- .../test_mint_owner_and_tokenmaster_tokens.py | 2 +- 13 files changed, 68 insertions(+), 58 deletions(-) rename test/e2e/constants/{community_settings.py => community.py} (97%) create mode 100644 test/e2e/gui/components/community/leave_community_confirmation.py rename test/e2e/tests/communities/{test_communities.py => test_communities_kick_ban.py} (80%) rename test/e2e/tests/crtitical_tests_prs/{test_community_edit_community.py => test_community_create_edit.py} (66%) diff --git a/test/e2e/constants/community_settings.py b/test/e2e/constants/community.py similarity index 97% rename from test/e2e/constants/community_settings.py rename to test/e2e/constants/community.py index 4701c2cbfe..3617dc2654 100644 --- a/test/e2e/constants/community_settings.py +++ b/test/e2e/constants/community.py @@ -72,3 +72,8 @@ class BlockPopupWarnings(Enum): UNBLOCK_TEXT_1 = 'Unblocking ' UNBLOCK_TEXT_2 = ' will allow new messages you receive from ' UNBLOCK_TEXT_3 = ' to reach you.' + + +class Channel(Enum): + DEFAULT_CHANNEL_NAME = 'general' + DEFAULT_CHANNEL_DESC = 'General channel for the community' diff --git a/test/e2e/gui/components/community/create_community_popups.py b/test/e2e/gui/components/community/create_community_popups.py index fb7d4fe499..e499350a08 100644 --- a/test/e2e/gui/components/community/create_community_popups.py +++ b/test/e2e/gui/components/community/create_community_popups.py @@ -6,11 +6,10 @@ import allure import configs import driver -from constants import RandomCommunity, CommunityData +from constants import CommunityData from gui.components.base_popup import BasePopup 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 from gui.elements.button import Button from gui.elements.check_box import CheckBox diff --git a/test/e2e/gui/components/community/leave_community_confirmation.py b/test/e2e/gui/components/community/leave_community_confirmation.py new file mode 100644 index 0000000000..0ce4bd12da --- /dev/null +++ b/test/e2e/gui/components/community/leave_community_confirmation.py @@ -0,0 +1,15 @@ +import allure + +from gui.components.base_popup import BasePopup +from gui.elements.button import Button +from gui.objects_map import communities_names + + +class LeaveCommunityConfirmationPopup(BasePopup): + def __init__(self): + super().__init__() + self.leave_button = Button(communities_names.leaveCommunityContextMenuItem) + + def confirm_action(self): + self.leave_button.click() + diff --git a/test/e2e/gui/components/context_menu.py b/test/e2e/gui/components/context_menu.py index 90c014ecef..47f33cf21a 100644 --- a/test/e2e/gui/components/context_menu.py +++ b/test/e2e/gui/components/context_menu.py @@ -1,6 +1,7 @@ import allure from gui.components.community.invite_contacts import InviteContactsPopup +from gui.components.community.leave_community_confirmation import LeaveCommunityConfirmationPopup from gui.elements.object import QObject from gui.objects_map import names, communities_names @@ -21,13 +22,21 @@ class ContextMenu(QObject): self.delete_channel_from_context = QObject(communities_names.delete_Channel_StatusMenuItem) self.invite_from_context = QObject(communities_names.invite_People_StatusMenuItem) self.mute_from_context = QObject(communities_names.mute_Community_StatusMenuItem) + self.leave_community_option = QObject(communities_names.leave_Community_StatusMenuItem) @allure.step('Select in context menu') def select(self, value: str): self.menu_item.real_name['text'] = value self.menu_item.click() - @allure.step('Select invite people to community') + @allure.step('Select invite people to community in context menu') def select_invite_people(self): self.invite_from_context.click() return InviteContactsPopup() + + @allure.step('Select leave community in context menu') + def leave_community(self): + self.leave_community_option.click() + return LeaveCommunityConfirmationPopup() + + diff --git a/test/e2e/gui/objects_map/communities_names.py b/test/e2e/gui/objects_map/communities_names.py index 4e63f90722..0bdbd2f085 100644 --- a/test/e2e/gui/objects_map/communities_names.py +++ b/test/e2e/gui/objects_map/communities_names.py @@ -9,6 +9,7 @@ mainWindow_Create_New_Community_StatusButton = {"checkable": False, "container": # Community View mainWindow_communityLoader_Loader = {"container": statusDesktop_mainWindow, "objectName": "StatusSectionLayout", "type": "ContentItem", "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} @@ -43,6 +44,7 @@ add_channels_StatusButton = {"checkable": False, "container": mainWindow_scrollV scrollView_general_StatusChatListItem = {"container": mainWindow_scrollView_StatusScrollView, "objectName": "general", "type": "StatusChatListItem", "visible": True} invite_People_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "invitePeople", "type": "StatusMenuItem", "visible": True} mute_Community_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "StatusMenuItemDelegate", "type": "StatusMenuItem", "visible": True} +leave_Community_StatusMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": "leaveCommunityMenuItem", "type": "StatusMenuItem", "visible": True} # Tool Bar mainWindow_statusToolBar_StatusToolBar = {"container": mainWindow_StatusWindow, "objectName": "statusToolBar", "type": "StatusToolBar", "visible": True} @@ -78,6 +80,7 @@ mainWindow_OverviewSettingsPanel = {"container": mainWindow_communityLoader_Load 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 = {"container": statusDesktop_mainWindow, "objectName": "communityOverviewSettingsEditCommunityButton", "type": "StatusButton", "visible": True} + # Members Settings View mainWindow_MembersSettingsPanel = {"container": mainWindow_communityLoader_Loader, "type": "MembersSettingsPanel", "unnamed": 1, "visible": True} membersListViews_ListView = {"container": mainWindow_MembersSettingsPanel, "objectName": "CommunityMembersTabPanel_MembersListViews", "type": "ListView", "visible": True} @@ -236,3 +239,6 @@ statusBadge_StatusBadge = {"container": userListPanel_StatusMemberListItem, "id" mainWindow_membersTabBar_StatusTabBar = {"container": statusDesktop_mainWindow, "id": "membersTabBar", "type": "StatusTabBar", "unnamed": 1, "visible": True} membersTabBar_Banned_StatusTabButton = {"checkable": True, "container": mainWindow_membersTabBar_StatusTabBar, "objectName": "bannedButton", "type": "StatusTabButton", "visible": True} membersTabBar_All_Members_StatusTabButton = {"checkable": True, "container": mainWindow_membersTabBar_StatusTabBar, "objectName": "allMembersButton", "type": "StatusTabButton", "visible": True} + +# Context menu +leaveCommunityContextMenuItem = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "CommunitiesListPanel_leaveCommunityButtonInPopup", "type": "StatusButton", "visible": True} diff --git a/test/e2e/gui/screens/community_settings_tokens.py b/test/e2e/gui/screens/community_settings_tokens.py index 05a149603f..c1d4cf9758 100644 --- a/test/e2e/gui/screens/community_settings_tokens.py +++ b/test/e2e/gui/screens/community_settings_tokens.py @@ -5,7 +5,7 @@ import allure import configs import driver -from constants.community_settings import MintOwnerTokensElements +from constants.community import MintOwnerTokensElements from gui.components.sign_transaction_popup import SignTransactionPopup from gui.elements.button import Button from gui.elements.check_box import CheckBox diff --git a/test/e2e/tests/communities/test_communities.py b/test/e2e/tests/communities/test_communities_kick_ban.py similarity index 80% rename from test/e2e/tests/communities/test_communities.py rename to test/e2e/tests/communities/test_communities_kick_ban.py index 1ada295d77..4913a8599f 100644 --- a/test/e2e/tests/communities/test_communities.py +++ b/test/e2e/tests/communities/test_communities_kick_ban.py @@ -6,7 +6,7 @@ from allure_commons._allure import step import driver from constants import UserAccount, RandomUser, RandomCommunity, CommunityData -from constants.community_settings import ToastMessages +from constants.community import ToastMessages from gui.screens.community import Members from gui.screens.messages import MessagesScreen from . import marks @@ -17,49 +17,6 @@ from gui.main_window import MainWindow pytestmark = marks -@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703630', 'Create community') -@pytest.mark.case(703630) -def test_create_community(user_account, main_screen: MainWindow): - 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 fields of create community popup and create community'): - community = RandomCommunity() - community_screen = create_community_form.create_community(community_data=community) - - with step('Verify community parameters in community overview'): - assert community_screen.left_panel.name == community.name - 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 - ) - - 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() - assert overview_setting.name == community.name - assert overview_setting.description == community.description - 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.left_panel.open_communities_settings() - community = community_settings.get_community_info(community.name) - assert community.name == community.name - assert community.description == community.description - assert '1' in community.members - - @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703252', 'Kick user') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703254', 'Edit chat - Delete any message') @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/736991', 'Owner can ban member') diff --git a/test/e2e/tests/communities/test_communities_limit_to_5_permissions.py b/test/e2e/tests/communities/test_communities_limit_to_5_permissions.py index c0063136a1..075a551bbe 100644 --- a/test/e2e/tests/communities/test_communities_limit_to_5_permissions.py +++ b/test/e2e/tests/communities/test_communities_limit_to_5_permissions.py @@ -6,7 +6,7 @@ import configs import constants import driver from constants import permission_data_member, RandomCommunity -from constants.community_settings import LimitWarnings +from constants.community import LimitWarnings from gui.main_window import MainWindow from . import marks diff --git a/test/e2e/tests/communities/test_communities_screens_overview.py b/test/e2e/tests/communities/test_communities_screens_overview.py index de87203d24..da33d3458a 100644 --- a/test/e2e/tests/communities/test_communities_screens_overview.py +++ b/test/e2e/tests/communities/test_communities_screens_overview.py @@ -5,7 +5,7 @@ from allure_commons._allure import step from constants import RandomCommunity from . import marks -from constants.community_settings import AirdropsElements, TokensElements, PermissionsElements +from constants.community import AirdropsElements, TokensElements, PermissionsElements from constants.images_paths import AIRDROPS_WELCOME_IMAGE_PATH, TOKENS_WELCOME_IMAGE_PATH, PERMISSION_WELCOME_IMAGE_PATH from gui.main_window import MainWindow diff --git a/test/e2e/tests/crtitical_tests_prs/test_community_edit_community.py b/test/e2e/tests/crtitical_tests_prs/test_community_create_edit.py similarity index 66% rename from test/e2e/tests/crtitical_tests_prs/test_community_edit_community.py rename to test/e2e/tests/crtitical_tests_prs/test_community_create_edit.py index 4b73aafeb3..3c98ee73e2 100644 --- a/test/e2e/tests/crtitical_tests_prs/test_community_edit_community.py +++ b/test/e2e/tests/crtitical_tests_prs/test_community_create_edit.py @@ -3,12 +3,12 @@ import pytest from allure_commons._allure import step from constants import RandomCommunity +from constants.community import Channel from scripts.utils.generators import random_community_name, random_community_description, random_community_introduction, \ random_community_leave_message from . import marks import configs.testpath -import constants from gui.main_window import MainWindow pytestmark = marks @@ -17,15 +17,29 @@ pytestmark = marks @allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/703057', 'Edit community') @pytest.mark.case(703057) @pytest.mark.critical -def test_edit_community(main_screen: MainWindow): +def test_create_edit_community(main_screen: MainWindow): 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('Create community and select it'): + 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 fields of create community popup and create community'): community = RandomCommunity() - main_screen.create_community(community_data=community) - community_screen = main_screen.left_panel.select_community(community.name) + community_screen = create_community_form.create_community(community_data=community) + + with step('Verify community parameters in community overview'): + assert community_screen.left_panel.name == community.name + assert '1' in community_screen.left_panel.members + + with step('Verify General channel is present for recently created community'): + community_screen.verify_channel( + Channel.DEFAULT_CHANNEL_NAME.value, + Channel.DEFAULT_CHANNEL_DESC.value, + None + ) with step('Edit community'): community_setting = community_screen.left_panel.open_community_settings() @@ -56,3 +70,8 @@ def test_edit_community(main_screen: MainWindow): assert community_info.name == new_name assert community_info.description == new_description assert '1' in community_info.members + + assert new_name in main_screen.left_panel.communities, \ + f'Community {new_name} should be present in the list of communities but it is not' + context_menu = main_screen.left_panel.open_community_context_menu(new_name) + assert not context_menu.leave_community_option.is_visible, f'Leave option should not be present' diff --git a/test/e2e/tests/crtitical_tests_prs/test_community_permissions_add_edit_delete_duplicate.py b/test/e2e/tests/crtitical_tests_prs/test_community_permissions_add_edit_delete_duplicate.py index fcb9753b09..e0ce8ff06f 100644 --- a/test/e2e/tests/crtitical_tests_prs/test_community_permissions_add_edit_delete_duplicate.py +++ b/test/e2e/tests/crtitical_tests_prs/test_community_permissions_add_edit_delete_duplicate.py @@ -8,7 +8,7 @@ import configs import constants import driver from constants import permission_data, RandomCommunity -from constants.community_settings import ToastMessages, PermissionsElements +from constants.community import ToastMessages, PermissionsElements from gui.components.changes_detected_popup import PermissionsChangesDetectedToastMessage from gui.components.delete_popup import DeletePermissionPopup from gui.main_window import MainWindow diff --git a/test/e2e/tests/settings/settings_messaging/test_block_unblock_user.py b/test/e2e/tests/settings/settings_messaging/test_block_unblock_user.py index 8c26c1fc5d..8ac0560f9e 100644 --- a/test/e2e/tests/settings/settings_messaging/test_block_unblock_user.py +++ b/test/e2e/tests/settings/settings_messaging/test_block_unblock_user.py @@ -5,7 +5,7 @@ from allure_commons._allure import step import constants import driver from constants import UserAccount, RandomUser -from constants.community_settings import BlockPopupWarnings, ToastMessages +from constants.community import BlockPopupWarnings, ToastMessages from gui.main_window import MainWindow import configs from gui.screens.messages import ToolBar diff --git a/test/e2e/tests/transactions_tests/test_mint_owner_and_tokenmaster_tokens.py b/test/e2e/tests/transactions_tests/test_mint_owner_and_tokenmaster_tokens.py index bffcc22525..9d9c04fb58 100644 --- a/test/e2e/tests/transactions_tests/test_mint_owner_and_tokenmaster_tokens.py +++ b/test/e2e/tests/transactions_tests/test_mint_owner_and_tokenmaster_tokens.py @@ -14,7 +14,7 @@ from helpers.OnboardingHelper import open_generate_new_keys_view, open_import_se finalize_onboarding_and_login from helpers.SettingsHelper import enable_testnet_mode from tests.communities import marks -from constants.community_settings import MintOwnerTokensElements +from constants.community import MintOwnerTokensElements from gui.screens.community_settings_tokens import MintedTokensView pytestmark = marks