Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 37 additions & 46 deletions test_data/used_resources_page_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,47 @@


class UsedResourcesPageData:
tab_title_current = ["Brn", "BrainUp"]
tab_title_expected = ["Используемые ресурсы | BrainUp", "Used Resources | BrainUp"]

page_title = ["Используемые ресурсы", "Used Resources"]

text_on_page = [
"Фотографии упражнений в приложении взяты со следующих платформ:",
"Exercise pictures in the application are taken from the following platforms:"
]

links_text = [
"freepik.com",
"Plants (Köhler's Medizinal-Pflanzen)",
"Flora («Flora von Deutschland, Österreich und der Schweiz in Wort und Bild für Schule und Haus»)"
]

links_href = [
"https://freepik.com/",
"https://ru.wikipedia.org/wiki/%D0%A1%D0%BF%D0%B8%D1%81%D0%BE%D0%BA_"
"%D1%80%D0%B0%D1%81%D1%82%D0%B5%D0%BD%D0%B8%D0%B9,"
"_%D0%B8%D0%BB%D0%BB%D1%8E%D1%81%D1%82%D1%80%D0%B0%D1%86%D0%B8%D0%B8_%D0%BA_"
"%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%BC_"
"%D1%80%D0%B0%D0%B7%D0%BC%D0%B5%D1%89%D0%B5%D0%BD%D1%8B_%D0%B2_"
"%D1%81%D0%BF%D1%80%D0%B0%D0%B2%D0%BE%D1%87%D0%BD%D0%B8%D0%BA%D0%B5_"
"K%C3%B6hler%E2%80%99s_Medizinal-Pflanzen",
"https://web.archive.org/web/20090601012031/http://caliban.mpiz-koeln.mpg.de/~stueber/"
"thome/Alphabetical_list.html"
]

link_status_codes = [200, 301]
tab_title_current = ("Brn", "BrainUp")
tab_title_expected = ("Используемые ресурсы | BrainUp", "Used Resources | BrainUp")

page_title = ("Используемые ресурсы", "Used Resources")

text_on_page = ("Фотографии упражнений в приложении взяты со следующих платформ:",
"Exercise pictures in the application are taken from the following platforms:")

links_text = ("freepik.com",
"Plants (Köhler's Medizinal-Pflanzen)",
"Flora («Flora von Deutschland, Österreich und der Schweiz in Wort und Bild für Schule und Haus»)")

links_href = ("https://freepik.com/",
"https://ru.wikipedia.org/wiki/%D0%A1%D0%BF%D0%B8%D1%81%D0%BE%D0%BA_"
"%D1%80%D0%B0%D1%81%D1%82%D0%B5%D0%BD%D0%B8%D0%B9,"
"_%D0%B8%D0%BB%D0%BB%D1%8E%D1%81%D1%82%D1%80%D0%B0%D1%86%D0%B8%D0%B8_%D0%BA_"
"%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%BC_"
"%D1%80%D0%B0%D0%B7%D0%BC%D0%B5%D1%89%D0%B5%D0%BD%D1%8B_%D0%B2_"
"%D1%81%D0%BF%D1%80%D0%B0%D0%B2%D0%BE%D1%87%D0%BD%D0%B8%D0%BA%D0%B5_"
"K%C3%B6hler%E2%80%99s_Medizinal-Pflanzen",
"https://web.archive.org/web/20090601012031/http://caliban.mpiz-koeln.mpg.de/~stueber/"
"thome/Alphabetical_list.html")

link_status_codes = (200, 301)

icons_xmlns = "http://www.w3.org/2000/svg"

# Related web pages urls and titles
pages_urls = [
"https://ru.wikipedia.org/wiki/%D0%A1%D0%BF%D0%B8%D1%81%D0%BE%D0%BA"
"_%D1%80%D0%B0%D1%81%D1%82%D0%B5%D0%BD%D0%B8%D0%B9,"
"_%D0%B8%D0%BB%D0%BB%D1%8E%D1%81%D1%82%D1%80%D0%B0%D1%86%D0%B8%D0%B8_%D0%BA"
"_%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%BC_%D1%80%D0%B0%D0%B7%D0%BC%D0%B5%D1%89%D0%B5%D0%BD%D1%8B"
"_%D0%B2_%D1%81%D0%BF%D1%80%D0%B0%D0%B2%D0%BE%D1%87%D0%BD%D0%B8%D0%BA%D0%B5_K%C3%B6hler%E2%80%99s"
"_Medizinal-Pflanzen",
"https://www.freepik.com/", "https://freepik.com/",
"http://caliban.mpiz-koeln.mpg.de/~stueber/thome/Alphabetical_list.html",
"https://web.archive.org/web/20090601012031/http://caliban.mpiz-koeln.mpg.de/~stueber/"
"thome/Alphabetical_list.html"
]

pages_titles = [
pages_urls = ("https://ru.wikipedia.org/wiki/%D0%A1%D0%BF%D0%B8%D1%81%D0%BE%D0%BA_"
"%D1%80%D0%B0%D1%81%D1%82%D0%B5%D0%BD%D0%B8%D0%B9,"
"_%D0%B8%D0%BB%D0%BB%D1%8E%D1%81%D1%82%D1%80%D0%B0%D1%86%D0%B8%D0%B8_%D0%BA_"
"%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%BC_%D1%80%D0%B0%D0%B7%D0%BC%D0%B5%D1%89%D0%B5%D0%BD%D1%8B_"
"%D0%B2_%D1%81%D0%BF%D1%80%D0%B0%D0%B2%D0%BE%D1%87%D0%BD%D0%B8%D0%BA%D0%B5_K%C3%B6hler%E2%80%99s"
"_Medizinal-Pflanzen",
"https://www.freepik.com/", "https://freepik.com/",
"http://caliban.mpiz-koeln.mpg.de/~stueber/thome/Alphabetical_list.html",
"https://web.archive.org/web/20090601012031/http://caliban.mpiz-koeln.mpg.de/~stueber/"
"thome/Alphabetical_list.html")

pages_titles = (
"Список растений, иллюстрации к которым размещены в справочнике Köhler’s Medizinal-Pflanzen — Википедия",
"List of plants whose illustrations are included in the Köhler's Medizinal-Pflanzen reference book - Wikipedia",
"Freepik | Create great designs, faster",
"Thomé - Flora von Deutschland Österreich und der Schweiz"
]
"Thomé - Flora von Deutschland Österreich und der Schweiz")
60 changes: 27 additions & 33 deletions tests/used_resources_page_test.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
"""Auto tests for verifying web elements on the 'Used Resources' page"""
import allure
from pages.used_resources_page import UsedResourcesPage
from test_data.used_resources_page_data import UsedResourcesPageData
from pages.used_resources_page import UsedResourcesPage as urPage
from test_data.used_resources_page_data import UsedResourcesPageData as urPD


@allure.epic("Test Used Resources Page")
class TestUsedResourcesPage:
data = UsedResourcesPageData
class TestURPage:

class TestUsedResourcesPageStructure:
class TestURPageStructure:
@allure.title("Verify presence and visibility of content on the page")
def test_ur_01_01_verify_page_presence_and_visibility(self, driver, used_resources_page_open):
page = UsedResourcesPage(driver)
page = urPage(driver)
page_content_presence = page.check_presence_of_page_content()
page_content_visibility = page.check_visibility_of_page_content()
assert page_content_presence is not None, "The page content is absent in DOM"
assert page_content_presence, "The page content is absent in DOM"
assert page_content_visibility, "The page content is invisible"

@allure.title("""Verify the composition and visibility of elements
on the 1st-4th levels of nesting on the page""")
def test_ur_01_02_verify_page_structure_and_visibility(self, driver, used_resources_page_open):
page = UsedResourcesPage(driver)
page = urPage(driver)
structure_of_1st_level = page.get_structure_of_1st_level()
visibility_of_elements_on_1st_level = page.check_elements_visibility_on_1st_level_on_page()
structure_of_2nd_level = page.get_structure_of_2nd_level()
Expand All @@ -38,44 +37,39 @@ def test_ur_01_02_verify_page_structure_and_visibility(self, driver, used_resour
assert structure_of_4th_level, "Elements on the 4th level are absent on the page"
assert visibility_of_elements_on_4th_level, "4th-level elements are invisible"

class TestUsedResourcesPageText:
class TestURPageText:
@allure.title("Verify value of the title of the tab")
def test_ur_02_01_verify_tab_title(self, driver, used_resources_page_open):
page = UsedResourcesPage(driver)
page = urPage(driver)
tab_title_value = page.get_value_of_tab_title()
assert tab_title_value, "The title value of the tab is empty"
assert tab_title_value in UsedResourcesPageData.tab_title_expected, \
"The title value of the tab mismatches the valid value"
assert tab_title_value in urPD.tab_title_expected, "The title value of the tab mismatches the valid value"

@allure.title("Verify value of title with tag 'h1' on the page")
def test_ur_02_02_verify_page_title(self, driver, used_resources_page_open):
page = UsedResourcesPage(driver)
page = urPage(driver)
title_value = page.get_value_of_page_title()
assert title_value, "The title value on the page is empty"
assert title_value in UsedResourcesPageData.page_title, \
"The title on the page mismatches the valid value"
assert title_value in urPD.page_title, "The title on the page mismatches the valid value"

@allure.title("Verify content of the text on the page")
def test_ur_02_03_verify_page_text(self, driver, used_resources_page_open):
page = UsedResourcesPage(driver)
# page.open_used_resources_page()
page = urPage(driver)
text_content = page.get_text_content_on_page()
assert text_content, "Text content on the page is empty"
assert text_content in UsedResourcesPageData.text_on_page, "Text content mismatches the valid value"
assert text_content in urPD.text_on_page, "Text content mismatches the valid value"

@allure.title("Verify text in links in sections")
def test_ur_02_04_verify_text_in_links(self, driver, used_resources_page_open):
page = UsedResourcesPage(driver)
# page.open_used_resources_page()
page = urPage(driver)
links_text = page.get_text_in_links()
assert links_text, "Text in links is empty"
assert all(links_text in UsedResourcesPageData.links_text for links_text in links_text), \
"Text in links mismatch valid values"
assert all(element in urPD.links_text for element in links_text), "Text in links mismatch valid values"

class TestUsedResourcesPageLinks:
class TestURPageLinks:
@allure.title("""Verify presence, visibility, clickability, href, status code of links in sections""")
def test_ur_03_01_verify_links_in_sections(self, driver, used_resources_page_open):
page = UsedResourcesPage(driver)
page = urPage(driver)
links_presence = page.get_list_of_links()
links_visibility = page.check_links_visibility()
links_clickability = page.check_links_clickability()
Expand All @@ -85,34 +79,34 @@ def test_ur_03_01_verify_links_in_sections(self, driver, used_resources_page_ope
assert links_visibility, "Links are invisible"
assert links_clickability, "Links are unclickable"
assert links_href, "Links href are empty"
assert all(link_href in UsedResourcesPageData.links_href for link_href in links_href), \
assert all(element in urPD.links_href for element in links_href), \
"Attributes 'href' of links mismatch valid values"
assert all(element in UsedResourcesPageData.link_status_codes for element in link_status_codes), \
assert all(element in urPD.link_status_codes for element in link_status_codes), \
"Status codes of links mismatch valid values"

@allure.title("Verify that links in the sections lead to the correct pages after clicking")
def test_ur_03_02_verify_links_lead_to_the_correct_pages(self, driver, used_resources_page_open):
page = UsedResourcesPage(driver)
page = urPage(driver)
new_tabs_urls = page.click_on_links()
assert all(tab_url in UsedResourcesPageData.pages_urls for tab_url in new_tabs_urls), \
assert all(element in urPD.pages_urls for element in new_tabs_urls), \
"Links in the sections lead to incorrect pages after clicking"

class TestUsedResourcesPageIcons:
class TestURPageIcons:
@allure.title("Verify presence, visibility and attributes of icons in sections")
def test_ur_04_01_verify_icons_in_sections(self, driver, used_resources_page_open):
page = UsedResourcesPage(driver)
page = urPage(driver)
icons_presence = page.get_list_of_icons()
icons_visibility = page.check_icons_visibility()
icons_xmlns = page.get_icons_xmlns()
assert icons_presence, "Icons in sections are absent"
assert icons_visibility, "Icons in sections are invisible"
assert icons_xmlns, "The 'xmlns' attribute value of icons in sections are empty"
assert all(icon_xmlns == UsedResourcesPageData.icons_xmlns for icon_xmlns in icons_xmlns), \
"The 'xmlns' attribute value of some icons is empty or non-accurate"
assert all(element == urPD.icons_xmlns for element in icons_xmlns), \
"The 'xmlns' attribute value of some icons is empty or invalid"

@allure.title("Verify sizes of icons in sections")
def test_ur_04_02_verify_icons_sizes(self, driver, used_resources_page_open):
page = UsedResourcesPage(driver)
page = urPage(driver)
icons_size = page.get_icons_sizes()
icons_size_changes = page.check_size_changes_of_icons()
assert icons_size != 0, "Icons in sections haven't sizes"
Expand Down
Loading