test: share community link test

This commit is contained in:
Valentina Novgorodtceva 2024-05-31 17:45:47 +07:00 committed by Anastasiya
parent 5ea1eb5c3c
commit 2467af110f
7 changed files with 60 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import typing
import allure
import pyperclip
import configs.timeouts
import driver
@ -20,6 +21,7 @@ class InviteContactsPopup(BasePopup):
self._message_text_edit = TextEdit(names.communityProfilePopupInviteMessagePanel_MessageInput_TextEdit)
self._invited_member_item = QObject(names.o_StatusMemberListItem_2)
self._send_button = Button(names.send_1_invite_StatusButton)
self._copy_button = Button(names.copy_icon_StatusIcon)
@property
@allure.step('Get contacts')
@ -53,3 +55,8 @@ class InviteContactsPopup(BasePopup):
self._send_button.click()
self.wait_until_hidden()
@allure.step('Copy community link')
def copy_community_link(self):
self._copy_button.click()
return str(pyperclip.paste())

View File

@ -1,5 +1,6 @@
import allure
from gui.components.community.invite_contacts import InviteContactsPopup
from gui.elements.object import QObject
from gui.objects_map import names, communities_names
@ -17,6 +18,8 @@ class ContextMenu(QObject):
self._context_delete_saved_address_option = QObject(names.contextSavedAddressDelete)
self._edit_channel_context_item = QObject(communities_names.edit_Channel_StatusMenuItem)
self._delete_channel_context_item = QObject(communities_names.delete_Channel_StatusMenuItem)
self._invite_people_item = QObject(communities_names.invite_People_StatusMenuItem)
self._mute_community_item = QObject(communities_names.mute_Community_StatusMenuItem)
@allure.step('Is edit channel option present in context menu')
def is_edit_channel_option_present(self):
@ -58,3 +61,8 @@ class ContextMenu(QObject):
@allure.step('Check delete option visibility in context menu')
def is_delete_account_option_present(self):
return self._context_delete_account_option.is_visible
@allure.step('Select invite people to community')
def select_invite_people(self):
self._invite_people_item.click()
return InviteContactsPopup()

View File

@ -129,8 +129,8 @@ class LeftPanel(QObject):
@allure.step('Open context menu for community')
def open_community_context_menu(self, name: str) -> ContextMenu:
driver.objectMap.realName(self._get_community(name))['name'] = name
self._get_community(name).right_click()
community = QObject(driver.objectMap.realName(self._get_community(name)))
community.right_click()
return ContextMenu().wait_until_appears()
@allure.step('Invite people in community')

View File

@ -35,6 +35,8 @@ scrollView_toggleButton_StatusChatListCategoryItemButton = {"container": mainWin
scrollView_addButton_StatusChatListCategoryItemButton = {"container": mainWindow_scrollView_StatusScrollView, "id": "addButton", "type": "StatusChatListCategoryItemButton", "unnamed": 1, "visible": True}
add_channels_StatusButton = {"checkable": False, "container": mainWindow_scrollView_StatusScrollView, "id": "addMembersBtn", "type": "StatusButton", "unnamed": 1, "visible": True}
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}
# Tool Bar
mainWindow_statusToolBar_StatusToolBar = {"container": mainWindow_StatusWindow, "objectName": "statusToolBar", "type": "StatusToolBar", "visible": True}

View File

@ -155,6 +155,7 @@ next_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_o
communityProfilePopupInviteMessagePanel_MessageInput_TextEdit = {"container": communityProfilePopupInviteMessagePanel, "objectName": "CommunityProfilePopupInviteMessagePanel_MessageInput", "type": "TextEdit", "visible": True}
send_1_invite_StatusButton = {"checkable": False, "container": statusDesktop_mainWindow_overlay, "objectName": "InviteFriendsToCommunityPopup_SendButton", "text": "Send 1 invite", "type": "StatusButton", "visible": True}
o_StatusMemberListItem_2 = {"container": communityProfilePopupInviteMessagePanel, "type": "StatusMemberListItem", "unnamed": 1, "visible": True}
copy_icon_StatusIcon = {"container": statusDesktop_mainWindow_overlay, "objectName": "copy-icon", "type": "StatusIcon", "visible": True}
# Welcome community
o_ColumnLayout = {"container": statusDesktop_mainWindow_overlay, "type": "ColumnLayout", "unnamed": 1, "visible": True}

View File

@ -0,0 +1,13 @@
import webbrowser
import requests
def open_link(url):
webbrowser.open(url)
def get_response(url):
response = requests.get(
url)
return response

View File

@ -0,0 +1,27 @@
import allure
import pytest
from allure_commons._allure import step
import constants
from gui.main_window import MainWindow
from scripts.utils.browser import open_link, get_response
from . import marks
pytestmark = marks
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/736382', 'Share community link')
@pytest.mark.case(736382)
def test_share_community_link(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'):
community_params = constants.community_params
main_screen.create_community(community_params['name'], community_params['description'],
community_params['intro'], community_params['outro'],
community_params['logo']['fp'], community_params['banner']['fp'])
with step('Copy community link and verify that it does not give 404 error'):
community_link = main_screen.left_panel.open_community_context_menu(
community_params['name']).select_invite_people().copy_community_link()
assert get_response(community_link).status_code != 404