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
17 changes: 17 additions & 0 deletions pages/base_page.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import allure
from selenium.common import TimeoutException
from selenium.webdriver import ActionChains
Expand Down Expand Up @@ -79,6 +81,21 @@ def go_to_element(self, element):
return self.driver.execute_script("arguments[0].scrollIntoView({ block: 'center'});", element)

def check_expected_link(self, url):
with allure.step(f'Check url starts with: {url}'):
# Increasing the CI timeout
timeout = 45 if os.getenv('GITHUB_ACTIONS') else self.timeout

# Waiting for URL
Wait(self.driver, timeout).until(
lambda d: d.current_url.startswith(url),
message=f"URL doesn't start with {url}. Current: {self.driver.current_url}")

# Waiting for the page to be ready
Wait(self.driver, timeout).until(lambda d: d.execute_script("return document.readyState") == "complete")

return True

def check_expected_link1(self, url):
with allure.step(f'Check url is present: {url}'):
try:
# return Wait(self.driver, self.timeout).until(
Expand Down
8 changes: 4 additions & 4 deletions pages/header_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,15 @@ def click_on_Statistics_link_auth2(self):
self.click_more_button()
self.element_is_present_and_clickable(self.locators1.LINK_STATISTICS_AUTH2).click()
current_url = self.get_current_tab_url()
# print(current_url)
print(current_url)
return current_url

@allure.step("Click on the 'About' link #2 for AUTHORIZED user")
def click_on_About_link_auth2(self):
self.click_more_button()
self.element_is_present_and_clickable(self.locators1.LINK_ABOUT_AUTH2).click()
current_url = self.get_current_tab_url()
# print(current_url)
print(current_url)
return current_url

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

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

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