Skip to content

Commit 06d04ae

Browse files
ref check_expected_link for supporting of the CI timeout
update base_page.py, header_page.py #268
1 parent d198659 commit 06d04ae

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

pages/base_page.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import allure
24
from selenium.common import TimeoutException
35
from selenium.webdriver import ActionChains
@@ -79,6 +81,21 @@ def go_to_element(self, element):
7981
return self.driver.execute_script("arguments[0].scrollIntoView({ block: 'center'});", element)
8082

8183
def check_expected_link(self, url):
84+
with allure.step(f'Check url starts with: {url}'):
85+
# Increasing the CI timeout
86+
timeout = 45 if os.getenv('GITHUB_ACTIONS') else self.timeout
87+
88+
# Waiting for URL
89+
Wait(self.driver, timeout).until(
90+
lambda d: d.current_url.startswith(url),
91+
message=f"URL doesn't start with {url}. Current: {self.driver.current_url}")
92+
93+
# Waiting for the page to be ready
94+
Wait(self.driver, timeout).until(lambda d: d.execute_script("return document.readyState") == "complete")
95+
96+
return True
97+
98+
def check_expected_link1(self, url):
8299
with allure.step(f'Check url is present: {url}'):
83100
try:
84101
# return Wait(self.driver, self.timeout).until(

pages/header_page.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,15 +483,15 @@ def click_on_Statistics_link_auth2(self):
483483
self.click_more_button()
484484
self.element_is_present_and_clickable(self.locators1.LINK_STATISTICS_AUTH2).click()
485485
current_url = self.get_current_tab_url()
486-
# print(current_url)
486+
print(current_url)
487487
return current_url
488488

489489
@allure.step("Click on the 'About' link #2 for AUTHORIZED user")
490490
def click_on_About_link_auth2(self):
491491
self.click_more_button()
492492
self.element_is_present_and_clickable(self.locators1.LINK_ABOUT_AUTH2).click()
493493
current_url = self.get_current_tab_url()
494-
# print(current_url)
494+
print(current_url)
495495
return current_url
496496

497497
@allure.step("Click on the 'Contacts' link for AUTHORIZED user -- ACTUAL")
@@ -519,7 +519,7 @@ def click_on_Contributors_link_auth(self):
519519
self.element_is_present_and_clickable(self.locators1.LINK_CONTRIBUTORS_AUTH).click()
520520
Wait(self.driver, 10).until(EC.url_changes(current_url))
521521
current_url = self.get_current_tab_url()
522-
# print(current_url)
522+
print(current_url)
523523
return current_url
524524

525525
@allure.step("Click on the 'Used Resources' link for AUTHORIZED user -- ACTUAL")
@@ -529,7 +529,7 @@ def click_on_Used_Resources_link_auth(self):
529529
self.element_is_present_and_clickable(self.locators1.LINK_USED_RESOURCES_AUTH).click()
530530
Wait(self.driver, 10).until(EC.url_changes(current_url))
531531
current_url = self.get_current_tab_url()
532-
# print(current_url)
532+
print(current_url)
533533
return current_url
534534

535535
@allure.step("Click on the 'Audiometry' link for AUTHORIZED user -- ACTUAL")

0 commit comments

Comments
 (0)