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
2 changes: 1 addition & 1 deletion test_data/contributors_page_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ class ContributorsPageData:
all_team_link_status_code = (200,)
all_team_link_text = ("Вся Команда", "All Team")

images_alt = "user avatar"
images_alt = ("user avatar",)
images_src_start = "https://avatars.githubusercontent"
49 changes: 23 additions & 26 deletions tests/contributors_page_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Auto tests for verifying web elements on the 'Contributors' page"""
import allure
from pages.contributors_page import ContributorsPage
from test_data.contributors_page_data import ContributorsPageData
from pages.contributors_page import ContributorsPage as ctbPage
from test_data.contributors_page_data import ContributorsPageData as ctbPD


# @pytest.mark.skip(reason="unsupported preconditions")
Expand All @@ -11,7 +11,7 @@ class TestContributorsPageStructure:

@allure.title("Verify presence, visibility and structure of content on the page")
def test_cnp_01_01_verify_page_presence_and_visibility(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(driver)
page_content_presence = page.check_presence_of_page_content()
page_content_visibility = page.check_visibility_of_page_content()
assert page_content_presence, "The page content is absent in DOM"
Expand All @@ -20,7 +20,7 @@ def test_cnp_01_01_verify_page_presence_and_visibility(self, driver, contributor
@allure.title("""Verify the composition and visibility of elements
on the 1st-5th levels of nesting on the page""")
def test_cnp_01_02_verify_page_structure_and_visibility(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(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 @@ -42,7 +42,7 @@ def test_cnp_01_02_verify_page_structure_and_visibility(self, driver, contributo

@allure.title("Verify presence, visibility of titles/subtitles, cards, descriptions, links, images on the page")
def test_cnp_01_03_verify_page_structural_elements(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(driver)
title_on_2nd_level = page.check_title_presence()
title_visibility = page.check_title_visibility()
subtitles_on_2nd_level = page.get_list_of_subtitles()
Expand Down Expand Up @@ -71,80 +71,77 @@ def test_cnp_01_03_verify_page_structural_elements(self, driver, contributors_pa
class TestContributorsPageText:
@allure.title("Verify value of the title of the tab")
def test_cnp_02_01_verify_tab_title(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(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 ContributorsPageData.tab_title, \
"The title value of the tab mismatches the valid value"
assert tab_title_value in ctbPD.tab_title, "The title value of the tab mismatches the valid value"

@allure.title("Verify values of title and subtitles with tags h2, h3 on the page")
def test_cnp_02_02_verify_page_title_and_subtitles(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(driver)
title_value = page.get_value_of_title()
subtitle_values = page.get_values_of_subtitles()
assert title_value, "The title value on the page is empty"
assert title_value in ContributorsPageData.page_title, "The title on the page mismatches the valid value"
assert title_value in ctbPD.page_title, "The title on the page mismatches the valid value"
assert subtitle_values, "Subtitle values on the page are empty"
assert all(subtitle_value in ContributorsPageData.page_subtitles for subtitle_value in subtitle_values), \
assert all(element in ctbPD.page_subtitles for element in subtitle_values), \
"Subtitles mismatch any valid values"

@allure.title("Verify content of the text on the page")
def test_cnp_02_03_verify_page_text(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(driver)
text_content = page.get_text_content_on_page()
assert text_content in ContributorsPageData.text_on_page, "Text content mismatches the valid value"
assert text_content in ctbPD.text_on_page, "Text content mismatches the valid value"

@allure.title("Verify values of the text in card descriptions")
def test_cnp_02_04_verify_text_of_card_descriptions(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(driver)
description_values = page.check_values_of_card_descriptions()
assert description_values, "Text in descriptions is absent"

@allure.title("Verify text in card links and the 'All Team' link")
def test_cnp_02_05_verify_text_in_card_links(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(driver)
card_links_text = page.check_text_in_card_links()
link_text = page.get_text_in_all_team_link()
assert card_links_text, "Text in card links is absent"
assert link_text, "Text in the 'All Team' link is absent"
assert link_text in ContributorsPageData.all_team_link_text, \
"Text in the 'All Team' link mismatches any valid values"
assert link_text in ctbPD.all_team_link_text, "Text in the 'All Team' link mismatches any valid values"

class TestContributorsPageLinks:
@allure.title("Verify clickability, href of links on the page")
def test_cnp_03_01_verify_links_on_page(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(driver)
links_clickability = page.check_links_clickability()
links_href = page.get_links_href()
assert links_clickability, "Links are unclickable"
assert links_href, "Links href are empty"

@allure.title("Verify href, status code of the 'All Team' link")
def test_cnp_03_02_verify_all_team_link(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(driver)
link_href = page.get_all_team_link_href()
link_status_code = page.get_all_team_link_status_code()
assert link_href == ContributorsPageData.all_team_link_href, \
"The attribute 'href' of the link mismatches the valid value"
assert link_status_code in ContributorsPageData.all_team_link_status_code, \
assert link_href == ctbPD.all_team_link_href, "The attribute 'href' of the link mismatches the valid value"
assert link_status_code in ctbPD.all_team_link_status_code, \
"The status code of the link mismatches the valid value"

class TestContributorCardImages:
@allure.title("Verify attribute values of images in contributors cards in grids")
def test_cnp_04_01_verify_image_attributes_in_cards(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(driver)
images_src = page.get_images_src()
images_alt = page.get_images_alt()
assert images_src, "The 'src' attribute value of some card images is empty"
assert all(src.startswith(ContributorsPageData.images_src_start) for src in images_src), \
assert all(element.startswith(ctbPD.images_src_start) for element in images_src), \
"The 'src' attribute value of some card images mismatches the valid value"
assert images_alt, "The 'alt' attribute value of some card images is empty"
assert all(image_alt == ContributorsPageData.images_alt for image_alt in images_alt), \
assert all(element in ctbPD.images_alt for element in images_alt), \
"The 'alt' attribute value of some card images mismatches the valid value"

@allure.title("Verify sizes of images in contributor cards in grids")
def test_cnp_04_02_verify_images_sizes_in_cards(self, driver, contributors_page_open):
page = ContributorsPage(driver)
page = ctbPage(driver)
images_size = page.get_images_sizes()
images_size_changes = page.check_size_changes_of_images()
assert images_size != 0, "Images in contributor cards have not sizes"
Expand Down