From 12503730372d4b62e21ccbefaad2c2972b64d079 Mon Sep 17 00:00:00 2001 From: Valentina1133 <141633821+Valentina1133@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:18:41 +0700 Subject: [PATCH] chore: more verifications added (community title and description on web page) (#15022) --- test/e2e/requirements.txt | 1 + test/e2e/scripts/utils/browser.py | 14 +++++++++++++- .../communities/test_communities_share_link.py | 9 ++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/test/e2e/requirements.txt b/test/e2e/requirements.txt index 4059de1a9f..f13e9ef081 100644 --- a/test/e2e/requirements.txt +++ b/test/e2e/requirements.txt @@ -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 diff --git a/test/e2e/scripts/utils/browser.py b/test/e2e/scripts/utils/browser.py index 319f27b001..6bbc3b44e9 100644 --- a/test/e2e/scripts/utils/browser.py +++ b/test/e2e/scripts/utils/browser.py @@ -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 diff --git a/test/e2e/tests/communities/test_communities_share_link.py b/test/e2e/tests/communities/test_communities_share_link.py index 6ab655ca59..42f8d19290 100644 --- a/test/e2e/tests/communities/test_communities_share_link.py +++ b/test/e2e/tests/communities/test_communities_share_link.py @@ -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