diff --git a/pages/groups_page.py b/pages/groups_page.py index c732d2085f..ff37cc84c6 100644 --- a/pages/groups_page.py +++ b/pages/groups_page.py @@ -181,13 +181,19 @@ 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): opened_pages = [] - self.element_is_present_and_clickable(self.locators.PAGE_LINK1).click() - time.sleep(3) + + 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()) self.element_is_present_and_clickable(self.locators1.LOGO_LINK).click() - self.element_is_present_and_clickable(self.locators.PAGE_LINK2).click() - time.sleep(3) + 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()) + return opened_pages @allure.step("Click on links on the 'en' local and thereby open corresponding web pages in the same tab") diff --git a/tests/groups_page_test.py b/tests/groups_page_test.py index 3adc673678..1c65e5e9ad 100644 --- a/tests/groups_page_test.py +++ b/tests/groups_page_test.py @@ -154,6 +154,7 @@ def test_gp_03_04_verify_links_en(self, driver, groups_en_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() + 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" @@ -162,7 +163,7 @@ def test_gp_03_05_verify_ru_links_lead_to_proper_pages(self, driver, groups_ru_p 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 + 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"