Skip to content

Commit

Permalink
TC_02.01.31_Check_href_in_the_Write_for_us_link (#347)
Browse files Browse the repository at this point in the history
* add tc_02.01.31
update test_footer.py, footer_page.py, footer_data.py

* update footer_data.py because the interface has changed
  • Loading branch information
alena-krauchuk authored Jan 13, 2024
1 parent b8697f3 commit 15cc3e6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
11 changes: 10 additions & 1 deletion data/footer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@
class FooterElementsText:
ADVANCED_SEARCH_LINK_TEXT = "Advanced Search"
CONTACT_US_LINK_TEXT = "Contact us"
COPYRIGHT_TEXT = "Copyright © 2013-present Magento, Inc. All rights reserved."
# COPYRIGHT_TEXT = "Copyright © 2013-present Magento, Inc. All rights reserved."
COPYRIGHT_TEXT = "We know you have an assignment to complete. If this site is not functioning as expected, " \
"drop us an email. Copyright © 2013-present Magento, Inc. All rights reserved."
ORDERS_AND_RETURNS_LINK_TEXT = "Orders and Returns"
PRIVACY_AND_COOKIE_POLICY_LINK_TEXT = "Privacy and Cookie Policy"
SEARCH_TERMS_LINK_TEXT = "Search Terms"
SUBSCRIBE_TO_OUR_MAILING_LIST_TEXT = "Subscribe to our mailing list"
WRITE_FOR_US_LINK_TEXT = "Write for us"
# SUBSCRIBE_BUTTON_TEXT = "Subscribe" # excluded from interface
# SUBSCRIBE_EMAIL_FIELD_PLACEHOLDER_TEXT = "Enter your email address" # excluded from interface


class FooterElementsAttributes:
write_for_us_link_href = "https://softwaretestingboard.com/write-for-us/"
contact_us_link_href = "https://softwaretestingboard.com/contact/"
search_terms_link_href = "https://magento.softwaretestingboard.com/search/term/popular/"
orders_and_returns_link_href = "https://magento.softwaretestingboard.com/sales/guest/form/"
7 changes: 6 additions & 1 deletion pages/footer_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,5 +352,10 @@ def check_title_display_of_subscribe_page(self):
"""Checks that the title of opened page Subscribe is displayed"""
return self.get_text(self.locators7.SUBSCRIBE_TITLE)

@allure.step("Get attribute 'href' of link")
def get_link_href(self, locator):
return self.driver.find_element(*locator).get_attribute("href")


@allure.step("Get attribute 'href' of the Write for us link")
def get_write_for_us_link_href(self):
return self.get_link_href(self.footer_locators.WRITE_FOR_US_LINK)
14 changes: 13 additions & 1 deletion tests/test_footer.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""This section contains footer tests"""
import allure
import pytest
import requests
from selenium.webdriver.common.by import By
from data.data_urls import MAIN_PAGE_URL, DATA_1, FooterLinks
from pages.footer_page import FooterPage
from data.footer_data import FooterElementsText
from data.footer_data import FooterElementsText, FooterElementsAttributes


@allure.epic("Test Footer")
Expand Down Expand Up @@ -257,6 +258,17 @@ def test_tc_02_01_30_check_clickability_of_write_for_us_link_on_pages(self, driv
write_for_us_link = page.check_write_for_us_link_clickability()
assert write_for_us_link, "The Write for us link is not clickable"

@allure.title("TC 02.01.31 - Check correctness of the attribute 'href' in the 'Write for us' link in the footer")
def test_tc_02_01_31_check_href_in_write_for_us_link(self, driver):
"""Check that attribute 'href' in the 'Write for us' link is correct"""
page = FooterPage(driver, MAIN_PAGE_URL)
page.open()
link_href = page.get_write_for_us_link_href()
link_status = requests.head(link_href).status_code # this equals 406 for all footer links exactly on this site
assert link_href == FooterElementsAttributes.write_for_us_link_href \
and link_status == 406, "The attribute 'href' of the 'Write for us' link does not match " \
"the expected value or the link functionality is broken"

@allure.title("TC 02.01.32 - Check text of Write for us link on each page specified in DATA_1")
@pytest.mark.parametrize('URL', DATA_1)
def test_tc_02_01_32_check_text_of_write_for_us_link_on_pages(self, driver, URL):
Expand Down

0 comments on commit 15cc3e6

Please sign in to comment.