def is_error_message_present(self): try: UIInteractions.waiting_for_element_visibility( self.driver, LoginPage.error_message) except NoSuchElementException: return False return True
def is_error_message_present(self): try: UIInteractions.waiting_for_element_visibility( self.driver, CreateIssue.error_message) except None: return False return True
def is_security_token_missing(self): try: UIInteractions.waiting_for_element_visibility( self.driver, CreateIssue.security_token_missing) except None: return False return True
def get_summary_searched_issue(self): self.driver.refresh() print( UIInteractions.get_text(self.driver, SearchPage.issue_summary_value)) return UIInteractions.get_text(self.driver, SearchPage.issue_summary_value)
def is_create_issue_page_present(self): try: UIInteractions.waiting_for_element_visibility( self.driver, CreateIssue.jira_dialog_heading) except NoSuchElementException: return False return True
def update_current_summary(self): UIInteractions.click(self.driver, MyOpenIssues.my_open_issues_summary_value) sleep(2) UIInteractions.input_issue_value( self.driver, MyOpenIssues.my_open_issues_editable_summary_value, " UPDATED")
def cancel_creating_issue(self): UIInteractions.click(self.driver, CreateIssue.cancel_button) alert = self.driver.switch_to.alert if alert: alert.accept()
def create_issue(self, project, issue, summary): UIInteractions.click(self.driver, CreateIssue.assignee_link) UIInteractions.input_text_value(self.driver, CreateIssue.summary_input_field, "") UIInteractions.input_text_value(self.driver, CreateIssue.summary_input_field, summary) UIInteractions.input_issue_value(self.driver, CreateIssue.project_dropdown_field, project) UIInteractions.input_issue_value(self.driver, CreateIssue.issuetype_dropdown_field, issue)
def update_current_priority(self): UIInteractions.click(self.driver, MyOpenIssues.my_open_issues_priority_value) sleep(2) UIInteractions.waiting_for_element_visibility( self.driver, MyOpenIssues.my_open_issues_priority_editable_value).send_keys( Keys.BACKSPACE) sleep(2) UIInteractions.waiting_for_element_visibility( self.driver, MyOpenIssues.my_open_issues_priority_editable_value).send_keys( "High") sleep(2) UIInteractions.waiting_for_element_visibility( self.driver, MyOpenIssues.my_open_issues_priority_editable_value).send_keys( Keys.ENTER) UIInteractions.waiting_for_element_visibility( self.driver, MyOpenIssues.my_open_issues_priority_editable_value).send_keys( Keys.ENTER)
def login_to_jira(self, username, password): UIInteractions.input_text_value(self.driver, LoginPage.login_form_id, username) UIInteractions.input_text_value(self.driver, LoginPage.password_form_id, password) UIInteractions.submit(self.driver, LoginPage.login_button_id) sleep(3) return Dashboard(self.driver)
def submit_issue(self): UIInteractions.submit(self.driver, CreateIssue.create_issue_submit_button) if CreateIssue.is_security_token_missing(self): UIInteractions.click(self.driver, CreateIssue.security_token_missing) UIInteractions.submit(self.driver, CreateIssue.create_issue_submit_button) sleep(3)
def click_search_for_issues_menu_item(self): UIInteractions.click(self.driver, Dashboard.issues_button) UIInteractions.click(self.driver, Dashboard.search_for_issues_menu_item) return SearchPage(self.driver)
def click_my_open_issues_menu_item(self): UIInteractions.click(self.driver, Dashboard.issues_button) UIInteractions.click(self.driver, Dashboard.my_open_issues_menu_item) return MyOpenIssues(self.driver)
def start_create_issue(self): sleep(3) UIInteractions.click(self.driver, Dashboard.create_button) return CreateIssue(self.driver)
def start_search_issue(self, keywords): UIInteractions.input_issue_value(self.driver, SearchPage.issue_search_query_value, keywords)
def get_updated_priority(self): sleep(2) return UIInteractions.get_text( self.driver, MyOpenIssues.my_open_issues_priority_value)
def get_updated_summary(self): sleep(2) self.driver.refresh() return UIInteractions.get_text( self.driver, MyOpenIssues.my_open_issues_summary_value)
def is_dashboard_avatar_icon_present(self): try: UIInteractions.waiting_for_element_visibility(self.driver, Dashboard.avatar_icon) except NoSuchElementException: return False return True
def is_dashboard_create_issue_button_present(self): try: UIInteractions.waiting_for_element_visibility(self.driver, Dashboard.create_button) except NoSuchElementException: return False return True
class CreateIssue(BasePage): jira_dialog_heading = (By.CLASS_NAME, "jira-dialog-heading") project_dropdown_field = (By.ID, "project-field") issuetype_dropdown_field = (By.ID, "issuetype-field") summary_input_field = (By.ID, "summary") text_switch_button = (By.PARTIAL_LINK_TEXT, "Text") description_input_field = (By.ID, "description") create_issue_submit_button = (By.ID, "create-issue-submit") priority_dropdown_field = (By.ID, "priority-field") labels_input_field = (By.ID, "labels-textarea") linked_issues_dropdown_list = (By.ID, "issuelinks-linktype") issue_input_field = (By.ID, "issuelinks-issues-textarea") assignee_link = (By.ID, "assign-to-me-trigger") epic_link_input_field = (By.ID, "customfield_10000-field") security_token_missing = (By.ID, "atl_token_retry_button") error_message = (By.CLASS_NAME, "error") cancel_button = (By.CSS_SELECTOR, "a.cancel") random_summary = UIInteractions.sing_sen_maker() summary = random_summary def is_create_issue_page_present(self): try: UIInteractions.waiting_for_element_visibility( self.driver, CreateIssue.jira_dialog_heading) except NoSuchElementException: return False return True def is_security_token_missing(self): try: UIInteractions.waiting_for_element_visibility( self.driver, CreateIssue.security_token_missing) except None: return False return True def is_error_message_present(self): try: UIInteractions.waiting_for_element_visibility( self.driver, CreateIssue.error_message) except None: return False return True def create_issue(self, project, issue, summary): UIInteractions.click(self.driver, CreateIssue.assignee_link) UIInteractions.input_text_value(self.driver, CreateIssue.summary_input_field, "") UIInteractions.input_text_value(self.driver, CreateIssue.summary_input_field, summary) UIInteractions.input_issue_value(self.driver, CreateIssue.project_dropdown_field, project) UIInteractions.input_issue_value(self.driver, CreateIssue.issuetype_dropdown_field, issue) def submit_issue(self): UIInteractions.submit(self.driver, CreateIssue.create_issue_submit_button) if CreateIssue.is_security_token_missing(self): UIInteractions.click(self.driver, CreateIssue.security_token_missing) UIInteractions.submit(self.driver, CreateIssue.create_issue_submit_button) sleep(3) def cancel_creating_issue(self): UIInteractions.click(self.driver, CreateIssue.cancel_button) alert = self.driver.switch_to.alert if alert: alert.accept()
def get_summary_created_issue(self): return str( UIInteractions.get_text(self.driver, MyOpenIssues.my_open_issues_summary_value))