Skip to content

Commit

Permalink
Merge branch 'main' into rf_tests
Browse files Browse the repository at this point in the history
Signed-off-by: Vera Fesianava <[email protected]>
  • Loading branch information
verafes authored Mar 3, 2024
2 parents eb9e8f3 + 6813375 commit 7865bd5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/luma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Get Pytest changed files
id: changed-py-files
uses: tj-actions/changed-files@v23
uses: tj-actions/changed-files@v41
with:
files: |
tests/*.py
Expand Down
10 changes: 9 additions & 1 deletion data/footer_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
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"
Expand All @@ -13,3 +15,9 @@ class FooterElementsText:
WRITE_FOR_US_LINK_TEXT = "Write for us" # excluded from interface
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)
16 changes: 14 additions & 2 deletions 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 @@ -263,7 +264,18 @@ def test_tc_02_01_30_clickability_of_notes_link_on_pages(self, driver, URL):
notes_link = page.check_write_for_us_link_clickability()
assert notes_link, "The Write for us link is not clickable"

@allure.title("TC 02.01.32 - Verify text of Write for us link on each page specified in DATA_1")
@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_text_of_notes_link_on_pages(self, driver, URL):
"""Checks if text of Write for us link is correct on each page in DATA_1"""
Expand Down

0 comments on commit 7865bd5

Please sign in to comment.