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
23 changes: 15 additions & 8 deletions pages/groups_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import time
import allure
import requests
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait as Wait

from pages.base_page import BasePage
Expand Down Expand Up @@ -191,17 +193,22 @@ def click_on_links_on_ru_local(self):
@allure.step("Click on links on the 'en' local and thereby open corresponding web pages in the same tab")
def click_on_links_on_en_local(self):
opened_pages = []
# print(self.get_current_tab_url())
self.element_is_present_and_clickable(self.locators.PAGE_LINK1).click()
time.sleep(5)

link1 = self.element_is_present_and_clickable(self.locators.PAGE_LINK1)
current_url = self.driver.current_url
link1.click()
Wait(self.driver, 10).until(EC.url_changes(current_url))
opened_pages.append(self.get_current_tab_url())
# print(self.get_current_tab_url())

self.driver.back()
# print(self.get_current_tab_url())
self.element_is_present_and_clickable(self.locators.PAGE_LINK2).click()
time.sleep(5)
Wait(self.driver, 10).until(EC.presence_of_element_located((By.TAG_NAME, "h3")))

link2 = self.element_is_present_and_clickable(self.locators.PAGE_LINK2)
current_url = self.driver.current_url
link2.click()
Wait(self.driver, 10).until(EC.url_changes(current_url))
opened_pages.append(self.get_current_tab_url())
# print(self.get_current_tab_url())

return opened_pages

# Checking images on the page
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def subtitles_changed(driver):
current_subtitles = [el.text for el in page.elements_are_located(GroupsPageLocators.PAGE_SUBTITLES)]
return current_subtitles != subtitles_before and all(current_subtitles)

Wait(driver, 10).until(subtitles_changed)
Wait(driver, 20).until(subtitles_changed)
page.elements_are_visible(GroupsPageLocators.PAGE_SUBTITLES)


Expand Down
2 changes: 1 addition & 1 deletion tests/footer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_fp_03_01_verify_footer_links(self, driver, main_page_open):
def test_fp_03_02_verify_links_lead_to_the_correct_pages(self, driver, main_page_open):
page = fPage(driver)
actual_domains = page.click_on_links()
assert all(domain in fPD.domains for domain in actual_domains), \
assert all(element in fPD.domains for element in actual_domains), \
"Links in the Footer lead to invalid pages after clicking or don't load within the allotted time"

@allure.title("Verify that the 'Contact us' link in the Footer calls an email client")
Expand Down
11 changes: 6 additions & 5 deletions tests/groups_page_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,23 @@ def test_gp_03_01_verify_links(self, driver, groups_ru_page_open):
"Status codes of links mismatch valid values"

@allure.title("Verify title of links on the 'ru' local")
def test_gp_03_02_01_verify_links_ru_title(self, driver, groups_ru_page_open):
def test_gp_03_02_verify_links_ru_title(self, driver, groups_ru_page_open):
page = gPage(driver)
link_titles_ru = page.get_links_titles_ru()
assert link_titles_ru, "Link titles values are empty on the 'ru' local"
assert all(element in gPD.link_titles_ru for element in link_titles_ru), \
"Link titles mismatch any valid values on the 'ru' local"

@allure.title("Verify href of links on the 'ru' local")
def test_gp_03_02_02_verify_links_ru_href(self, driver, groups_ru_page_open):
def test_gp_03_03_verify_links_ru_href(self, driver, groups_ru_page_open):
page = gPage(driver)
links_href_ru = page.get_links_href_ru()
assert links_href_ru, "Links href are empty on the 'ru' local"
assert all(element.startswith(gPD.link_href_first_part) for element in links_href_ru), \
"Attributes 'href' of links on the 'ru' local mismatch valid values"

@allure.title("Verify title, href of links on the 'en' local")
def test_gp_03_03_verify_links_en(self, driver, groups_en_page_open):
def test_gp_03_04_verify_links_en(self, driver, groups_en_page_open):
page = gPage(driver)
link_titles_en = page.get_links_titles_en()
links_href_en = page.get_links_href_en()
Expand All @@ -151,17 +151,18 @@ def test_gp_03_03_verify_links_en(self, driver, groups_en_page_open):
"Attributes 'href' of links on the 'en' local mismatch valid values"

@allure.title("""Verify if links on the 'ru' local lead to correct pages after clicking""")
def test_gp_03_04_verify_ru_links_lead_to_proper_pages(self, driver, groups_ru_page_open):
def test_gp_03_05_verify_ru_links_lead_to_proper_pages(self, driver, groups_ru_page_open):
page = gPage(driver)
opened_pages = page.click_on_links_on_ru_local()
assert opened_pages, "Transitions to exercises pages have not performed"
assert all(element in gPD.pages_urls for element in opened_pages), \
"Some links lead to incorrect pages after clicking"

@allure.title("""Verify if links on the 'en' local lead to correct pages after clicking""")
def test_gp_03_05_verify_en_links_lead_to_proper_pages(self, driver, groups_en_page_open):
def test_gp_03_06_verify_en_links_lead_to_proper_pages(self, driver, groups_en_page_open):
page = gPage(driver)
opened_pages = page.click_on_links_on_en_local()
print(opened_pages) # Temporarily for refactoring
assert opened_pages, "Transitions to exercises pages have not performed"
assert all(element in gPD.pages_urls for element in opened_pages), \
"Some links lead to incorrect pages after clicking"
Expand Down
Loading