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
5 changes: 4 additions & 1 deletion app/selenium_ui/bitbucket/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def measure():
@print_timing("selenium_login:open_login_page")
def sub_measure():
login_page.go_to()
webdriver.app_version = login_page.get_app_version()
webdriver.app_version = login_page.get_app_major_version()
if login_page.is_logged_in():
login_page.delete_all_cookies()
login_page.go_to()
Expand All @@ -40,7 +40,10 @@ def sub_measure():
login_page.submit_login()
get_started_page = GetStarted(webdriver)
get_started_page.wait_for_page_loaded()
webdriver.node_id = login_page.get_node_id()
print(f"node_id:{webdriver.node_id}")
sub_measure()

measure()


Expand Down
11 changes: 9 additions & 2 deletions app/selenium_ui/bitbucket/pages/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@ def set_credentials(self, username, password):
self.fill_password(password)

def get_app_version(self):
el = self.get_element(LoginPageLocators.application_version)
return ''.join([i for i in el.text.split('.')[0] if i.isdigit()])
text = self.get_element(LoginPageLocators.application_version).text
return text.replace('v', '')

def get_app_major_version(self):
return self.get_app_version().split('.')[0]

def get_node_id(self):
text = self.get_element(LoginPageLocators.node_id).text
return text.split('\n')[2]

def is_logged_in(self):
elements = self.get_elements(GetStartedLocators.user_profile_icon)
Expand Down
1 change: 1 addition & 0 deletions app/selenium_ui/bitbucket/pages/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class LoginPageLocators:
username_textfield = {'6': (By.ID, "j_username"), '7': (By.ID, "j_username")}
password_textfield = {'6': (By.ID, "j_password"), '7': (By.ID, "j_password")}
application_version = (By.ID, 'product-version')
node_id = (By.CLASS_NAME, 'footer-body')


class LogoutPageLocators:
Expand Down
2 changes: 2 additions & 0 deletions app/selenium_ui/confluence/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def sub_measure():
login_page.delete_all_cookies()
login_page.go_to()
login_page.wait_for_page_loaded()
webdriver.node_id = login_page.get_node_id()
print(f"node_id:{webdriver.node_id}")
sub_measure()

login_page.set_credentials(username=datasets['username'], password=datasets['password'])
Expand Down
8 changes: 8 additions & 0 deletions app/selenium_ui/confluence/pages/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ def first_user_setup(self):
self.wait_until_any_element_visible(LoginPageLocators.skip_find_content)[0].click()
self.wait_until_clickable(LoginPageLocators.finish_setup).click()

def get_app_version(self):
text = self.get_element(LoginPageLocators.footer_build_info).text
return text

def get_node_id(self):
text = self.get_element(LoginPageLocators.footer_node_info).text
return text.split(':')[-1].replace(')', '').replace(' ', '')


class Logout(BasePage):
page_url = UrlManager().logout_url()
Expand Down
2 changes: 2 additions & 0 deletions app/selenium_ui/confluence/pages/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class LoginPageLocators:
login_button = (By.ID, "loginButton")
login_username_field = (By.ID, "os_username")
login_password_field = (By.ID, "os_password")
footer_build_info = (By.ID, "footer-build-information")
footer_node_info = (By.ID, "footer-cluster-node")

# Setup user page per first login
first_login_setup_page = (By.ID, "grow-ic-nav-container")
Expand Down
4 changes: 3 additions & 1 deletion app/selenium_ui/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

class InitGlobals:
def __init__(self):
self.driver = False
self.driver = None
self.driver_title = False
self.login_failed = False

Expand Down Expand Up @@ -182,6 +182,8 @@ def driver_quit():
# check if driver is not broken
globals.driver_title = globals.driver.title
print('get driver from global')
globals.driver.delete_all_cookies()
print('clear browser cookies')
return globals.driver
except WebDriverException:
# re-init driver if it broken
Expand Down
2 changes: 2 additions & 0 deletions app/selenium_ui/jira/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ def measure():
@print_timing("selenium_login:open_login_page")
def sub_measure():
login_page.go_to()
webdriver.node_id = login_page.get_node_id()
print(f"node_id:{webdriver.node_id}")
sub_measure()

@print_timing("selenium_login:login_and_view_dashboard")
Expand Down
11 changes: 11 additions & 0 deletions app/selenium_ui/jira/pages/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ def set_credentials(self, username, password):
self.get_element(LoginPageLocators.password_field).send_keys(password)
self.get_element(LoginPageLocators.login_submit_button).click()

def __get_footer_text(self):
return self.get_element(LoginPageLocators.footer).text

def get_app_version(self):
text = self.__get_footer_text()
return text.split('#')[0].replace('(v', '')

def get_node_id(self):
text = self.__get_footer_text()
return text.split(':')[-1].replace(')', '')


class Logout(BasePage):
page_url = LogoutLocators.logout_url
Expand Down
1 change: 1 addition & 0 deletions app/selenium_ui/jira/pages/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class LoginPageLocators:
password_field = (By.ID, 'login-form-password')
login_submit_button = (By.ID, 'login-form-submit')
system_dashboard = (By.ID, "dashboard")
footer = (By.ID, 'footer-build-information')


class LogoutLocators:
Expand Down
3 changes: 2 additions & 1 deletion app/selenium_ui/jsm/modules_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def measure():
@print_timing("selenium_agent_login:open_login_page")
def sub_measure():
login_page.go_to()

webdriver.node_id = login_page.get_node_id()
print(f"node_id:{webdriver.node_id}")
sub_measure()

@print_timing("selenium_agent_login:login_and_view_dashboard")
Expand Down
11 changes: 11 additions & 0 deletions app/selenium_ui/jsm/pages/agent_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ def set_credentials(self, username, password):
self.get_element(LoginPageLocators.password_field).send_keys(password)
self.get_element(LoginPageLocators.login_submit_button).click()

def __get_footer_text(self):
return self.get_element(LoginPageLocators.footer).text

def get_app_version(self):
text = self.__get_footer_text()
return text.split('#')[0].replace('(v', '')

def get_node_id(self):
text = self.__get_footer_text()
return text.split(':')[-1].replace(')', '')


class Logout(BasePage):
page_url = LogoutLocators.logout_url
Expand Down
1 change: 1 addition & 0 deletions app/selenium_ui/jsm/pages/agent_selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class LoginPageLocators:
password_field = (By.ID, 'login-form-password')
login_submit_button = (By.ID, 'login-form-submit')
system_dashboard = (By.ID, "dashboard")
footer = (By.ID, 'footer-build-information')


class DashboardLocators:
Expand Down