diff --git a/pages/groups_page.py b/pages/groups_page.py index bbdd7938d2..a738aa0221 100644 --- a/pages/groups_page.py +++ b/pages/groups_page.py @@ -166,25 +166,19 @@ def check_links_clickability(self): @allure.step("Get attribute 'title' of links on the 'ru' local") def get_links_titles_ru(self): self.click_on_ru_button() - time.sleep(1) + # time.sleep(1) return [element.get_attribute("title") for element in self.get_list_of_links()] @allure.step("Get attribute 'title' of links on the 'en' local") def get_links_titles_en(self): - self.click_on_en_button() - time.sleep(1) return [element.get_attribute("title") for element in self.get_list_of_links()] @allure.step("Get attribute 'href' of links on the 'ru' local") def get_links_href_ru(self): - self.click_on_ru_button() - time.sleep(1) return [element.get_attribute("href") for element in self.get_list_of_links()] @allure.step("Get attribute 'href' of links on the 'en' local") def get_links_href_en(self): - self.click_on_en_button() - time.sleep(1) return [element.get_attribute("href") for element in self.get_list_of_links()] @allure.step("Check the first part of the attribute 'href' of links") @@ -198,31 +192,31 @@ def get_links_status_codes(self): @allure.step("Click on links on the 'ru' local and thereby open corresponding web pages in the same tab") def click_on_links_on_ru_local(self): - self.click_on_ru_button() - time.sleep(2) + # self.click_on_ru_button() + # time.sleep(2) opened_pages = [] self.element_is_present_and_clickable(self.locators.PAGE_LINK1).click() - time.sleep(4) + time.sleep(3) opened_pages.append(self.get_current_tab_url()) self.element_is_present_and_clickable(self.locators1.LOGO_LINK).click() - time.sleep(4) + # time.sleep(4) self.element_is_present_and_clickable(self.locators.PAGE_LINK2).click() - time.sleep(4) + time.sleep(3) opened_pages.append(self.get_current_tab_url()) return opened_pages @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 = [] - self.click_on_en_button() - time.sleep(2) + # self.click_on_en_button() + # time.sleep(2) print(self.get_current_tab_url()) self.element_is_present_and_clickable(self.locators.PAGE_LINK1).click() time.sleep(5) opened_pages.append(self.get_current_tab_url()) print(self.get_current_tab_url()) self.driver.back() - time.sleep(5) + # time.sleep(5) print(self.get_current_tab_url()) self.element_is_present_and_clickable(self.locators.PAGE_LINK2).click() time.sleep(5) diff --git a/tests/groups_page_test.py b/tests/groups_page_test.py index 65d7862eaf..ca10e35d60 100644 --- a/tests/groups_page_test.py +++ b/tests/groups_page_test.py @@ -117,33 +117,41 @@ def test_gp_02_06_verify_en_page_subtitles(self, driver, groups_en_page_open): "Subtitles mismatch any valid values on the 'en' local" class TestGroupsPageLinks: - @allure.title("Verify clickability, title, href, status code of links on the page") - def test_gp_03_01_verify_links(self, driver, auto_test_user_authorized): + @allure.title("Verify clickability, status code of links on the page") + def test_gp_03_01_verify_links(self, driver, groups_ru_page_open): page = gPage(driver) links_clickability = page.check_links_clickability() - link_titles_ru = page.get_links_titles_ru() - link_titles_en = page.get_links_titles_en() - links_href_ru = page.get_links_href_ru() - links_href_en = page.get_links_href_en() link_status_codes = page.get_links_status_codes() assert links_clickability, "Links are unclickable" + assert all(element in gPD.links_status_code for element in link_status_codes), \ + "Status codes of links mismatch valid values" + + @allure.title("Verify title, href of links on the 'ru' local") + def test_gp_03_02_verify_links_ru(self, driver, groups_ru_page_open): + page = gPage(driver) + link_titles_ru = page.get_links_titles_ru() + links_href_ru = page.get_links_href_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" + 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): + page = gPage(driver) + link_titles_en = page.get_links_titles_en() + links_href_en = page.get_links_href_en() assert link_titles_en, "Link titles values are empty on the 'en' local" assert all(element in gPD.link_titles_en for element in link_titles_en), \ "Link titles mismatch any valid values on the 'en' local" - assert links_href_ru, "Links href are empty on the 'ru' local" assert links_href_en, "Links href are empty on the 'en' 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" assert all(element.startswith(gPD.link_href_first_part) for element in links_href_en), \ "Attributes 'href' of links on the 'en' local mismatch valid values" - assert all(element in gPD.links_status_code for element in link_status_codes), \ - "Status codes of links mismatch valid values" @allure.title("""Verify if links on the 'ru' local lead to correct pages after clicking""") - def test_gp_03_02_verify_ru_links_lead_to_proper_pages(self, driver, auto_test_user_authorized): + def test_gp_03_04_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" @@ -151,7 +159,7 @@ def test_gp_03_02_verify_ru_links_lead_to_proper_pages(self, driver, auto_test_u "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_03_verify_en_links_lead_to_proper_pages(self, driver, auto_test_user_authorized): + def test_gp_03_05_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() assert opened_pages, "Transitions to exercises pages have not performed"