Skip to content

Commit

Permalink
Merge pull request #1665 from atlassian/jsm/fix-flaky-actions
Browse files Browse the repository at this point in the history
jsm/fix-flaky-actions
  • Loading branch information
OlehStefanyshyn authored Jan 24, 2025
2 parents af526f3 + 4302a05 commit 7f13658
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
18 changes: 14 additions & 4 deletions app/selenium_ui/jsm/pages/agent_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ def add_request_comment(self, rte_status):
textarea = self.get_element(ViewCustomerRequestLocators.comment_collapsed_textarea)
self.driver.execute_script("arguments[0].scrollIntoView(true);", textarea)
textarea.click()
comment_button = self.get_element(ViewCustomerRequestLocators.comment_internally_btn)
if not self.get_elements(ViewCustomerRequestLocators.comment_internally_btn):
comment_button = self.get_element(ViewCustomerRequestLocators.comment_internally_btn_jsm10)
else:
comment_button = self.get_element(ViewCustomerRequestLocators.comment_internally_btn)
self.driver.execute_script("arguments[0].scrollIntoView(true);", comment_button)

if rte_status:
Expand Down Expand Up @@ -219,9 +222,16 @@ def __init__(self, driver):
self.page_url = url_manager.view_insight_all_schemas()

def submit_login(self, username, password):
self.get_element(LoginPageLocators.login_field).send_keys(username)
self.get_element(LoginPageLocators.password_field).send_keys(password)
self.get_element(LoginPageLocators.login_submit_button).click()
self.wait_until_visible(LoginPageLocators.login_form)
if self.get_elements(LoginPageLocators.login_field):
self.get_element(LoginPageLocators.login_field).send_keys(username)
self.get_element(LoginPageLocators.password_field).send_keys(password)
self.get_element(LoginPageLocators.login_submit_button).click()
else:
self.get_element(LoginPageLocators.login_field_2sv).send_keys(username)
self.get_element(LoginPageLocators.password_field_2sv).send_keys(password)
self.get_element(LoginPageLocators.login_submit_button_2sv).click()



class InsightNewSchema(BasePage):
Expand Down
2 changes: 2 additions & 0 deletions app/selenium_ui/jsm/pages/agent_selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class LoginPageLocators:
login_submit_button_2sv = (By.ID, 'login-button')
system_dashboard = (By.ID, "dashboard")
footer = (By.ID, 'footer-build-information')
login_form = (By.ID, "login-form")


class DashboardLocators:
Expand Down Expand Up @@ -119,6 +120,7 @@ class ViewCustomerRequestLocators:
comment_text_field = (By.XPATH, "//textarea[@id='comment']")
comment_tinymce_field = (By.ID, "tinymce")
comment_internally_btn = (By.XPATH, "//button[contains(text(),'Comment internally')]")
comment_internally_btn_jsm10 = (By.XPATH, "//span[normalize-space()='Comment internally']")
customers_sidebar_selector = (By.CSS_SELECTOR, 'span.aui-icon.aui-icon-large.sd-sidebar-icon.icon-sidebar-customers')


Expand Down
8 changes: 6 additions & 2 deletions app/selenium_ui/jsm/pages/customer_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ def open_profile_menu(self):

def logout(self):
self.get_element(TopPanelSelectors.logout_button).click()
self.wait_until_visible(LoginPageLocators.login_field)
self.wait_until_visible(LoginPageLocators.login_form)
if not self.get_elements(LoginPageLocators.login_submit_button):
self.wait_until_visible(LoginPageLocators.login_field_2sv)
else:
self.wait_until_visible(LoginPageLocators.login_field)


class CustomerPortals(BasePage):
Expand Down Expand Up @@ -206,7 +210,7 @@ def __init__(self, driver, all_requests=False):
url_manager = UrlManager()
self.page_url = url_manager.all_requests_url() if all_requests else url_manager.my_requests_url()

page_loaded_selector = RequestsSelectors.requests_label
page_loaded_selector = RequestsSelectors.all_requests_filter


class ViewRequestWithInsight(BasePage):
Expand Down
2 changes: 2 additions & 0 deletions app/selenium_ui/jsm/pages/customer_selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class LoginPageLocators:
login_submit_button_2sv = (By.ID, 'login-button')
app_version = (By.NAME, "ajs-sdPluginVersion")
app_version_2sv = (By.NAME, "application-name")
login_form = (By.ID, "login-form")


class TopPanelSelectors:
Expand Down Expand Up @@ -111,3 +112,4 @@ class InsightSelectors:
class RequestsSelectors:
my_requests_url = UrlManager().my_requests_url()
requests_label = (By.XPATH, "//h2[contains(text(),'Requests')]")
all_requests_filter = (By.ID, "sd-all-requests-filter")

0 comments on commit 7f13658

Please sign in to comment.