chore: more verifications added (community title and description on web page) (#15022)

This commit is contained in:
Valentina1133 2024-06-13 21:18:41 +07:00 committed by GitHub
parent e6c32fd619
commit 1250373037
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 2 deletions

View File

@ -13,3 +13,4 @@ pytest-ignore-flaky==2.1.0
pytest-timeout==2.2.0
shortuuid==1.0.12
pluggy==1.2.0
beautifulsoup4==4.12.3

View File

@ -1,13 +1,25 @@
import allure
import requests
import webbrowser
import requests
from bs4 import BeautifulSoup
@allure.step('Open link in default browser')
def open_link(url):
webbrowser.open(url)
@allure.step('Get response')
def get_response(url):
response = requests.get(
url)
return response
@allure.step('Get page content')
def get_page_content(url):
request = requests.get(url)
src = request.text
soup = BeautifulSoup(src, 'html.parser')
return soup

View File

@ -4,7 +4,7 @@ from allure_commons._allure import step
import constants
from gui.main_window import MainWindow
from scripts.utils.browser import open_link, get_response
from scripts.utils.browser import get_response, get_page_content
from . import marks
pytestmark = marks
@ -25,3 +25,10 @@ def test_share_community_link(main_screen: MainWindow):
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
with step('Verify that community title and description are displayed on webpage and correct'):
web_content = get_page_content(community_link)
community_title = web_content.findAll(attrs={"name": "title"})[0].attrs['content']
community_description = web_content.findAll(attrs={"name": "description"})[0].attrs['content']
assert community_params['name'] in community_title
assert community_params['description'] == community_description