def assigned_one_NS_to_user(user_content): nextStepsNumber = int( Get.by_id("next-steps-header").split('(')[1][:-1]) if (nextStepsNumber != 0): logger.error("assigned ns: " + str(nextStepsNumber)) logger.error( "APIUser should not have assigned next steps at first login.") raise if (Get.by_id("next-steps-list") != "No next steps are assigned to you."): logger.error( "No assigned next steps and text 'No next steps are " + "assigned to you.' was not found.") raise token = "token " + APIUser.login_user(user_content['el_email']) user_content['session_token'] = token logger.debug( "Adding new next step (via api) and assigning it to user " + user_content['full_name']) APIVirtualFunction.add_next_step(user_content) logger.debug("Refresh page and look for changes in assigned " + "next steps section:") FEGeneral.refresh() logger.debug(" > Check if number has changed in 'Assigned To You'") FEUser.logout() FEUser.login(user_content['email'], Constants.Default.Password.TEXT) text = Get.by_id("next-steps-header", True) Helper.internal_assert(text, "Assigned To You (1)")
def test_starred_recent_searchbar(self): actualVfName = Get.by_id(self.left_panel_eng_id) Helper.internal_assert(self.eng_title, actualVfName) Click.id(self.left_panel_eng_id) Wait.id("title-id-" + self.eng_title) Helper.internal_assert( self.user_content['engagement_manual_id'] + ":", Get.by_id( "title-id-" + self.eng_title)) Click.id(Constants.Dashboard.Overview.Star.ID, wait_for_page=True) Wait.id("title-id-" + self.eng_title) Click.id(Constants.Dashboard.Overview.Star.ID, wait_for_page=True) Wait.id("title-id-" + self.eng_title, wait_for_page=True) Helper.internal_assert( self.eng_title, Get.by_id(self.left_panel_eng_id)) Enter.text_by_xpath( "//input[@type='text']", self.user_content['engagement_manual_id'], wait_for_page=True) Wait.text_by_css( Constants.Dashboard.LeftPanel.SearchBox.Results.CSS, self.eng_title) Click.css( Constants.Dashboard.LeftPanel.SearchBox.Results.CSS, wait_for_page=True)
def create_new_checklist(newObj): try: newObjWithChecklist = None vfName = newObj[0] uuid = newObj[1] inviteEmail = newObj[2] # Fetch one AT&T user ID. vfuuid = DBGeneral.select_where("uuid", "ice_vf", "name", vfName, 1) engagement_id = DBVirtualFunction.select_eng_uuid(vfName) engLeadEmail = DBUser.select_el_email(vfName) logger.debug("EL email: " + engLeadEmail) engagement_manual_id = DBGeneral.select_where( "engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) # Click on all default next steps myVfName = engagement_manual_id + ": " + vfName actualVfNameid = "clickable-" + myVfName actualVfName = Get.by_id(actualVfNameid) Helper.internal_assert(myVfName, actualVfName) # NEXT STEP ID Click.id(actualVfNameid, wait_for_page=True) FEOverview.complete_defaults_nextsteps(engagement_id) inviterURL = Constants.Default.InviteURL.Signup.TEXT + \ vfuuid + "&inviter_uuid=" + uuid + "&email=" + inviteEmail # time.sleep(2) FEGeneral.re_open(inviterURL) FEGeneral.form_validate_email(inviteEmail) # Login with EL role FEGeneral.re_open(Constants.Default.LoginURL.TEXT) FEUser.login(engLeadEmail, Constants.Default.Password.TEXT) Wait.id(Constants.Dashboard.Statuses.Title.ID) Wait.id(engagement_manual_id) # cheklist # VALIDATE SCROLLING actualVfName = Get.by_id(actualVfNameid) myVfName = engagement_manual_id + ": " + vfName # Wait.id(actualVfNameid) Wait.id(engagement_manual_id, wait_for_page=True) Click.id(actualVfNameid, wait_for_page=True) # Create new checklist checklistName = FEChecklist.create_checklist( engagement_id, vfName, actualVfName, engagement_manual_id) checklistUuid = DBGeneral.select_where("uuid", "ice_checklist", "name", checklistName, 1) newObjWithChecklist = [ checklistUuid, engLeadEmail, engagement_manual_id, actualVfNameid, myVfName, checklistName ] return newObjWithChecklist # If failed - count the failure and add the error to list of errors. except Exception as e: errorMsg = "Failed to create checklist." + str(e) raise Exception(errorMsg, "create_new_checklist")
def get_rgwa_access_secret(): Click.id(Constants.Dashboard.Avatar.Account.RGWA.Secret.BUTTON_ID, wait_for_page=True) secret = Get.by_id( Constants.Dashboard.Avatar.Account.RGWA.Secret.SECRET_ID, wait_for_page=True) return secret
def test_validate_duplicate_invite(self): user_content = [] for _ in range(3): user_content.append( API.VirtualFunction.create_engagement(wait_for_gitlab=False)) Frontend.User.login(user_content[0]['email'], Constants.Default.Password.TEXT) engName = user_content[0][ 'engagement_manual_id'] + ": " + user_content[0]['vfName'] vf_left_nav_id = "clickable-" + engName Click.id(vf_left_nav_id) Frontend.Wizard.invite_team_members_modal(user_content[1]['email']) enguuid = DB.General.select_where( "uuid", "ice_engagement", "engagement_manual_id", user_content[0]['engagement_manual_id'], 1) invitation_token = DB.User.select_invitation_token( "invitation_token", "ice_invitation", "engagement_uuid", enguuid, user_content[1]['email'], 1) inviterURL = Constants.Default.InviteURL.Login.TEXT + invitation_token Frontend.General.re_open(inviterURL) title_id = "title-id-" + engName Frontend.User.login(user_content[1]['email'], Constants.Default.Password.TEXT, title_id) vf_left_nav_id = "clickable-" + engName Click.id(vf_left_nav_id) actualVfName = Get.by_id(vf_left_nav_id) Helper.internal_assert(engName, actualVfName) Wait.text_by_id(Constants.Dashboard.Overview.Title.ID, engName) Frontend.User.logout() Frontend.User.login(user_content[0]['email'], Constants.Default.Password.TEXT) engName = user_content[0][ 'engagement_manual_id'] + ": " + user_content[0]['vfName'] vf_left_nav_id = "clickable-" + engName Click.id(vf_left_nav_id) Click.id(Constants.Dashboard.Overview.TeamMember.ID) Wait.text_by_css( Constants.Dashboard.Wizard.Title.CSS, Constants.Dashboard.Wizard.InviteTeamMembers.Title.TEXT) Enter.text_by_name("email", user_content[1]['email']) Wait.text_by_css( Constants.SubmitButton.CSS, Constants.Dashboard.Wizard.InviteTeamMembers.Button.TEXT) Click.css(Constants.SubmitButton.CSS) Wait.id(Constants.Toast.ID) Helper.internal_assert(Get.by_id(Constants.Toast.ID), "Invite couldn't be created")
def test_Validate_SSHkeyNS(self): ''' Insert a valid ssh key in wizard, validate "add ssh key" next step marked as completed. ''' user_content = API.User.create_new_user() activationUrl = DB.User.get_activation_url(user_content['email']) Frontend.General.re_open(activationUrl) Frontend.User.login(user_content['email'], Constants.Default.Password.TEXT) Wait.text_by_id(Constants.Toast.ID, Constants.Dashboard.ActivateMsg.Success.TEXT) Click.id(Constants.Dashboard.Wizard.CloseButton.ID) Wait.modal_to_dissappear() Frontend.User.logout() Frontend.User.login(user_content['email'], Constants.Default.Password.TEXT) Wait.text_by_css(Constants.Dashboard.LeftPanel.Title.CSS, Constants.Dashboard.LeftPanel.Title.TEXT) logger.debug("click_on on + Dashboard") Click.id(Constants.Dashboard.LeftPanel.AddEngagement.ID) # Wizard vfName = Frontend.Wizard.add_vf() Frontend.Wizard.add_vendor_contact() inviteEmail = Helper.rand_invite_email() Frontend.Wizard.invite_team_members(inviteEmail) sshKey = Frontend.Wizard.add_ssh_key() Frontend.User.go_to_account() Wait.id(user_content['email']) actualFullName = Get.value_by_name( Constants.Dashboard.Avatar.Account.FullName.NAME) Helper.internal_assert(user_content['full_name'], actualFullName) actualSSHkey = Get.value_by_name( Constants.Dashboard.Avatar.Account.SSHKey.NAME) Helper.internal_assert(sshKey, actualSSHkey) Click.id(Constants.Dashboard.Statuses.ID) # VALIDATION FOR CONFIRMED BY ENG. LEAD engLeadEmail = DB.User.select_el_email(vfName) engagement_id = DB.General.select_where("engagement_id", "ice_vf", "name", vfName, 1) engagement_manual_id = DB.General.select_where("engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) myVfName = engagement_manual_id + ": " + vfName actualVfNameid = "clickable-" + myVfName Click.id(actualVfNameid) Click.id("overview-" + myVfName) Click.css("span.engagement_detail_menu_name") Click.xpath("//span[2]/multiselect/div/button") Click.link_text("Completed") elFullName = DB.General.select_where("full_name", "ice_user_profile", "email", engLeadEmail, 1) idNs = elFullName + "_Completed" actualConfirmBy = str(Get.by_id(idNs)) expectedConfirmBy = "System Next Step Completed: " Helper.internal_assert(expectedConfirmBy, actualConfirmBy)
def validate_audit_log(log_txt): audit_log_list_text = Get.by_id( Constants.Dashboard.Checklist.AuditLog.AuditLogList.ID, wait_for_page=True) try: log_txt in audit_log_list_text logger.debug("validate_audit_log PASS") except Exception: errorMsg = "Failed in validate_audit_log" raise Exception(errorMsg)
def get_jenkins_log(): Click.id(Constants.Dashboard.Checklist.JenkinsLog.ID, True) Wait.text_by_id( Constants.Dashboard.Checklist.JenkinsLog.Modal.Title.ID, Constants.Dashboard.Checklist.JenkinsLog.Modal.Title.TEXT, True) log = Get.by_id(Constants.Dashboard.Checklist.JenkinsLog.Modal.Body.ID, True) Helper.assertTrue( Constants.Dashboard.Checklist.JenkinsLog.Modal.Body.TEXT_SAMPLE in log, "Jenkins log could not be viewed.") Click.id(Constants.Dashboard.Modal.CLOSE_BUTTON_ID) return log
def validate_notifications(notificationIDs, notification_list): ui_list = [] for notifID in notificationIDs: if isinstance(notifID, tuple): notifID = notifID[0] ui_list.append( str( Get.by_id(Constants.Dashboard.Avatar.Notifications. NotificationColumn.ID + notifID))) for activity in notification_list: if not any(activity in s for s in ui_list): raise AssertionError("Activity: \"" + activity + "\" not appears in UI")
def add_nsteps(checklistUuid, actualVfNameid, myVfName, checklistName, newFileNames): Click.id(actualVfNameid, wait_for_page=True) checklistUuid = DBChecklist.select_where_cl_not_archive( "uuid", "ice_checklist", "name", newFileNames[0], 1) Click.id("checklist-" + checklistUuid, wait_for_page=True) Wait.text_by_id(Constants.Dashboard.Checklist.Name.ID, newFileNames[0]) FEChecklist.add_next_step_updated(checklistName, newFileNames[1]) # vALIDATE SCROLLING actualVfNameid = "clickable-" + myVfName actualVfName = Get.by_id(actualVfNameid, wait_for_page=True) if actualVfName != '': Helper.internal_assert(myVfName, actualVfName)
def create_checklist(engagement_id, vfName, actualVfName, engagement_manual_id): try: checklistName = Helper.rand_string("randomString") Wait.id("checklist-plus-" + engagement_id, wait_for_page=True) Click.id("checklist-plus-" + engagement_id, wait_for_page=True) Helper.internal_assert("Create Checklist", Get.by_id("modal-header-checklist-15")) # vm.checkListName Enter.text_by_name("checkListName", checklistName, wait_for_page=True) Wait.xpath("//select") Select( session.ice_driver.find_element_by_id( Constants.Template.Subtitle.SelectTemplateTitle.TEXT) ).select_by_visible_text(Constants.Template.Heat.TEXT) Click.id(Constants.Template.Heat.TEXT, wait_for_page=True) # Click.css("option.ng-binding.ng-scope") Helper.internal_assert( "Associate Files", Get.by_id("associated-files-title", wait_for_page=True)) Click.xpath("//multiselect/div/button", wait_for_page=True) Click.link_text("file0", wait_for_page=True) Click.link_text("file1") Wait.text_by_css(Constants.SubmitButton.CSS, "Create Checklist") Click.id(Constants.Dashboard.LeftPanel.CreateChecklist.ID) Wait.modal_to_dissappear() Wait.id(engagement_manual_id) return checklistName # If failed - count the failure and add the error to list of errors. except Exception as e: errorMsg = "Failed to create checklist." + str(e) raise Exception(errorMsg, "create_checklist")
def invite_and_validate_limit(user_content, vf_left_nav_id): Click.id(Constants.Dashboard.LeftPanel.AddEngagement.ID) FEWizard.add_vf() Click.id(Constants.Dashboard.Wizard.CloseButton.ID, wait_for_page=True) Click.id(vf_left_nav_id) Click.id(Constants.Dashboard.Overview.TeamMember.ID) Wait.text_by_css( Constants.Dashboard.Wizard.Title.CSS, Constants.Dashboard.Wizard.InviteTeamMembers.Title.TEXT) Enter.text_by_name("email", user_content[1]['email']) Wait.text_by_css( Constants.SubmitButton.CSS, Constants.Dashboard.Wizard.InviteTeamMembers.Button.TEXT) Click.css(Constants.SubmitButton.CSS) Wait.id(Constants.Toast.ID) Helper.internal_assert(Get.by_id(Constants.Toast.ID), "Invite couldn't be created")
def add_next_step(checklistName, newObj): Click.id(Constants.Dashboard.Checklist.AddNS.ID, wait_for_page=True) Wait.text_by_css("span.font_header", "Checklist:") Helper.internal_assert("Checklist:", Get.by_css("span.font_header")) Helper.internal_assert("Add Next Steps", Get.by_css("h2")) # First NS Click.id("description") Enter.text_by_id("description", "description of NS") Click.css("div.modal-content") Click.xpath("(//button[@type='button'])[10]") FEChecklist.assocciatedFileName = "file0" Click.link_text(FEChecklist.assocciatedFileName) Click.css("div.modal-content") Click.xpath("(//button[@type='button'])[11]") try: Click.xpath("//div[3]/multiselect/div/ul/li/a") except BaseException: Click.link_text("Homer Simpson") Click.css("div.modal-content") count = 0 FEWizard.date_picker_add_ns(count) count = +1 Click.css("span.add-text") Click.xpath("(//div[@id='description'])[2]") Enter.text_by_xpath("(//div[@id='description'])[2]", "description of NS2") Click.css("div.modal-content") Click.xpath("(//button[@type='button'])[14]") Click.xpath("(//button[@type='button'])[22]") Click.xpath("//div[3]/div/div[2]/multiselect/div/ul/li[2]/a") Click.css("div.modal-content") Click.xpath("(//button[@type='button'])[23]") Click.css("div.btn-group.open > ul.dropdown-menu > " + "li.ng-scope > a.ng-binding") Click.link_text("Add Another Next Step") Click.xpath("(//button[@type='button'])[25]") FEWizard.date_picker_add_ns(count) Click.xpath("//div[4]/div/span") Helper.internal_assert("Submit Next Steps", Get.by_id("btn-submit")) Click.id("btn-submit", wait_for_page=True)
def invite_users(user_content): engName = user_content[0][ 'engagement_manual_id'] + ": " + user_content[0]['vfName'] vf_left_nav_id = "clickable-" + engName Click.id(vf_left_nav_id) FEWizard.invite_team_members_modal(user_content[1]['email']) # self.sleep(1) # TODO need to wait until modal window is closed. invitation_token = DBUser.select_invitation_token( "invitation_token", "ice_invitation", "engagement_uuid", user_content[0]['engagement_uuid'], user_content[1]['email'], 1) inviterURL = Constants.Default.InviteURL.Login.TEXT + invitation_token FEGeneral.re_open(inviterURL) # Login with 2nd user # title_id = "title-id-" + engName FEUser.login(user_content[1]['email'], Constants.Default.Password.TEXT, title_id) Click.id(vf_left_nav_id) actualVfName = Get.by_id(vf_left_nav_id) Helper.internal_assert(engName, actualVfName) Wait.text_by_id(Constants.Dashboard.Overview.Title.ID, engName) FEUser.logout() return vf_left_nav_id
def test_recent_bar_by_last_updated(self): countIdsActive = 0 myVfName = self.user_content[ 'engagement_manual_id'] + ": " + self.user_content['vfName'] actualVfNameid = "clickable-" + myVfName actualVfName = Get.by_id(actualVfNameid) Helper.internal_assert(myVfName, actualVfName) Click.id(actualVfNameid) uuid = DB.General.select_where_email( "uuid", "ice_user_profile", self.user_content['el_email']) ids2 = DB.User.select_recent_vf_of_user(uuid, 0) part_of_id_to_find = "clickable-" ids1 = session.ice_driver.find_elements_by_css_selector( '[id*="%s"]' % part_of_id_to_find) for ii in ids1: if "clickable-" in ii.get_attribute('id'): logger.debug("Fetched ID: " + ii.get_attribute('id')) vf_name = ii.get_attribute('id').split(" ")[1] vf_uuid = DB.General.select_where( "uuid", "ice_vf", "name", vf_name, 1) if vf_uuid in ids2: countIdsActive += 1 if(countIdsActive == len(ids2.split())): logger.debug("Right result")
def test_create_new_checklist(self): API.GitLab.git_clone_push(self.user_content) Frontend.User.login(self.user_content['email'], Constants.Default.Password.TEXT) vfName = self.user_content['vfName'] # Fetch one AT&T user ID. engagement_id = DB.General.select_where("engagement_id", "ice_vf", "name", vfName, 1) engLeadEmail = DB.User.select_el_email(vfName) engagement_manual_id = DB.General.select_where("engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) myVfName = engagement_manual_id + ": " + vfName actualVfNameid = "clickable-" + myVfName Frontend.Overview.click_on_vf(self.user_content) Frontend.Overview.complete_defaults_nextsteps(engagement_id) Frontend.User.relogin(engLeadEmail, Constants.Default.Password.TEXT, engagement_manual_id) Frontend.Overview.click_on_vf(self.user_content) actualVfName = Get.by_id(actualVfNameid) checklistName = Frontend.Checklist.create_checklist( engagement_id, vfName, actualVfName, engagement_manual_id) Frontend.Checklist.click_on_checklist(self.user_content, checklistName)
def validate_deprecated_aic_version_in_dropdown(expected_aic_version): Helper.internal_assert( Get.by_id(Constants.Dashboard.DetailedView.AIC.Dropdown. UniversalVersion.ID % expected_aic_version), "AIC " + expected_aic_version + " - Deprecated")
def approval_state_actions_and_validations(checklistName, newObj, state): # REWVIEW STEPS AND VALIDATIONS try: Wait.id("checklist-main-section") Wait.text_by_id(Constants.Dashboard.Checklist.Name.ID, checklistName) try: if settings.DATABASE_TYPE == 'local': Wait.text_by_css("h2.ng-binding", "Section 1: Parameter Specification") Helper.internal_assert( "Parameters", Get.by_css("span.col-md-9.ng-binding")) Helper.internal_assert("String parameters", Get.by_xpath("//li[2]/span[2]")) Helper.internal_assert("Numeric parameters", Get.by_xpath("//li[3]/span[2]")) if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Section 2: External References", Get.by_xpath("//li[2]/h2")) Helper.internal_assert( "Normal references", Get.by_xpath("//li[2]/ul/li/span[2]")) Helper.internal_assert( "VF image", Get.by_xpath("//li[2]/ul/li[2]/span[2]")) except BaseException: if settings.DATABASE_TYPE == 'local': Wait.text_by_css("h2.ng-binding", "Section 1: External References") try: Helper.internal_assert( "Normal references", Get.by_css("span.col-md-9.ng-binding")) except BaseException: if "VF image" in Get.by_xpath("//li[2]/span[2]"): logger.debug("All Ok") if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Section 2: Parameter Specification", Get.by_xpath("//li[2]/h2")) try: if settings.DATABASE_TYPE == 'local': Helper.internal_assert("1.1 - Parameters", Get.by_xpath("//header/h2")) except BaseException: if settings.DATABASE_TYPE == 'local': Helper.internal_assert("1.1 - Normal References", Get.by_xpath("//header/h2")) if settings.DATABASE_TYPE == 'local': elementTxt = Get.by_id("line-item-description") Helper.internal_assert( "Numeric parameters should include " + "range and/or allowed values.", elementTxt) Helper.internal_assert("Audit Logs", Get.by_css("h3.col-md-12")) localLogText = "local log" Enter.text_by_id("new-audit-log-text", localLogText) Helper.internal_assert("Add Log Entry", Get.by_id("submit-new-audit-lop-text")) Click.id("submit-new-audit-lop-text") vfName = newObj[0] DBUser.get_el_name(vfName) Helper.internal_assert( localLogText, Get.by_css(Constants.Dashboard.Checklist.AuditLog. LastLocalAuditLog.CSS)) try: if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Parameters", Get.by_xpath("//li[2]/ul/li/span[2]")) except BaseException: if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Numeric parameters", Get.by_xpath("//li[2]/ul/li/span[2]")) session.run_negative( lambda: Wait.css(Constants.Dashboard.Checklist.LineItem.Deny. CSS) or Wait.css(Constants.Dashboard.Checklist .LineItem.Approve.CSS), "Buttons displayed for Admin it's NOT work") if state == "APPROVAL": if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Audit Log (6)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) else: Helper.internal_assert( "Audit Log (7)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) if state == "HANDOFF": if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Audit Log (8)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) else: Helper.internal_assert( "Audit Log (9)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) Click.id(Constants.Dashboard.Checklist.AuditLog.ID) Wait.text_by_xpath("//span[2]", checklistName) DBUser.select_el_email(vfName) Enter.text_by_xpath("//textarea", "zdfgsdyh") Click.css(Constants.SubmitButton.CSS) Wait.modal_to_dissappear() if state == "APPROVAL": if settings.DATABASE_TYPE == 'local': Wait.text_by_id(Constants.Dashboard.Checklist.AuditLog.ID, "Audit Log (7)") else: Wait.text_by_id(Constants.Dashboard.Checklist.AuditLog.ID, "Audit Log (8)") if state == "HANDOFF": if settings.DATABASE_TYPE == 'local': Wait.text_by_id(Constants.Dashboard.Checklist.AuditLog.ID, "Audit Log (9)") else: Wait.text_by_id(Constants.Dashboard.Checklist.AuditLog.ID, "Audit Log (10)") if state == "APPROVAL": Wait.text_by_xpath("//button[3]", "Add Next Steps") Wait.text_by_id( Constants.Dashboard.Checklist.Reject.ID, Constants.Dashboard.Checklist.Reject.Modal.Button.TEXT) Wait.text_by_xpath("//div[@id='state-actions']/button", "Approve") if state == "HANDOFF": Wait.text_by_xpath("//div[@id='state-actions']/button", "Handoff complete?") logger.debug("ALL VALIDATION PASS FOR STATE : " + state) # If failed - count the failure and add the error to list of errors. except Exception as e: logger.error( state + " state FAILED CONNECT TO STAGING MANUAL AND VERIFY WHY! ") errorMsg = "approval_state_actions_and_validations " +\ "FAILED because : " + str(e) raise Exception(errorMsg, "approval_state_actions_and_validations")
def review_state_actions_and_validations(checklistName, vfName, state): try: # REWVIEW STEPS AND VALIDATIONS Wait.id("checklist-main-section") Wait.text_by_id(Constants.Dashboard.Checklist.Name.ID, checklistName) try: if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Section 1: Parameter Specification", Get.by_css("h2.ng-binding")) Helper.internal_assert( "Parameters", Get.by_css("span.col-md-9.ng-binding")) Helper.internal_assert("String parameters", Get.by_xpath("//li[2]/span[2]")) Helper.internal_assert("Numeric parameters", Get.by_xpath("//li[3]/span[2]")) if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Section 2: External References", Get.by_xpath("//li[2]/h2")) Helper.internal_assert("Normal references", Get.by_name("Normal references")) Helper.internal_assert("VF image", Get.by_name("Normal references")) except BaseException: try: Helper.internal_assert("Section 1: External References", Get.by_css("h2.ng-binding")) except BaseException: Helper.internal_assert("Section 1: Scaling Considerations", Get.by_css("h2.ng-binding")) try: Helper.internal_assert( "Normal references", Get.by_css("span.col-md-9.ng-binding")) except BaseException: if "VF image" in Get.by_xpath("//li[2]/span[2]"): logger.debug("All Ok") if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Section 2: Parameter Specification", Get.by_xpath("//li[2]/h2")) Click.name("VF image") Click.name("Normal references") try: Helper.internal_assert("1.1 - Parameters", Get.by_xpath("//header/h2")) except BaseException: text = Get.by_name("Normal references") Helper.internal_assert("Normal references", text) Helper.internal_assert("Audit Logs", Get.by_css("h3.col-md-12")) localLogText = "local log" Enter.text_by_id("new-audit-log-text", localLogText) Helper.internal_assert("Add Log Entry", Get.by_id("submit-new-audit-lop-text")) Click.id("submit-new-audit-lop-text") # Validate Local AuditLog engLeadFullName = DBUser.get_el_name(vfName) Helper.internal_assert( engLeadFullName, Get.by_xpath("//ul[@id='audit-log-list']/li/h4")) Helper.internal_assert( localLogText, Get.by_css(Constants.Dashboard.Checklist.AuditLog. LastLocalAuditLog.CSS)) if settings.DATABASE_TYPE == 'local': try: Helper.internal_assert( "Parameters", Get.by_xpath("//li[2]/ul/li/span[2]")) except BaseException: Helper.internal_assert( "Numeric parameters", Get.by_xpath("//li[2]/ul/li/span[2]")) Click.name("Normal references") Wait.css(Constants.Dashboard.Checklist.LineItem.Deny.CSS) Wait.css(Constants.Dashboard.Checklist.LineItem.Approve.CSS) Click.css(Constants.Dashboard.Checklist.LineItem.Approve.CSS) # NOT LOCAL if settings.DATABASE_TYPE != 'local': checklistUuid = DBChecklist.get_recent_checklist_uuid( checklistName)[0] DBChecklist.update_all_decisions_to_approve(checklistUuid) # NOT LOCAL Click.css(".line-item-row span.manual") print("click on V button approve of decision in state = " + state) try: Wait.css("li.not-relevant-btn") except BaseException: Wait.xpath("//aside/header/ul/li") if state == "review": Wait.id("edit-checklist") if state == "PEER": if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Audit Log (4)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) else: Helper.internal_assert( "Audit Log (5)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) if state == "review": if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Audit Log (2)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) else: Helper.internal_assert( "Audit Log (3)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) if state == "APPROVAL": if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Audit Log (8)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) else: Helper.internal_assert( "Audit Log (9)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) Click.id(Constants.Dashboard.Checklist.AuditLog.ID, wait_for_page=True) Wait.text_by_xpath("//span[2]", checklistName) Enter.text_by_xpath("//textarea", "zdfgsdyh") Click.css(Constants.SubmitButton.CSS) Wait.modal_to_dissappear() if state == "review": if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Audit Log (3)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) else: Helper.internal_assert( "Audit Log (4)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) if state == "PEER": if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Audit Log (5)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) else: Helper.internal_assert( "Audit Log (6)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) if state == "APPROVAL": if settings.DATABASE_TYPE == 'local': Helper.internal_assert( "Audit Log (9)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) else: Helper.internal_assert( "Audit Log (10)", Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID)) # Validate Buttons if settings.DATABASE_TYPE != 'local': FEGeneral.refresh() engagement_id = DBVirtualFunction.select_eng_uuid(vfName) engLeadEmail = DBUser.select_el_email(vfName) logger.debug("EL email: " + engLeadEmail) engagement_manual_id = DBGeneral.select_where( "engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) # Click on all default next steps myVfName = engagement_manual_id + ": " + vfName actualVfNameid = "clickable-" + myVfName Click.id(actualVfNameid) Click.id("checklist-" + checklistUuid) Helper.internal_assert("Add Next Steps", Get.by_xpath("//button[3]")) Wait.text_by_id( Constants.Dashboard.Checklist.Reject.ID, Constants.Dashboard.Checklist.Reject.Modal.Button.TEXT, wait_for_page=True) Helper.internal_assert( "Approve", Get.by_xpath("//div[@id='state-actions']/button")) logger.debug("ALL VALIDATION PASS FOR STATE: " + state) # If failed - count the failure and add the error to list of errors. except Exception as e: errorMsg = "review_state_actions_and_validations " +\ "FAILED because: " + str(e) raise Exception(errorMsg, "review_state_actions_and_validations") logger.error( state + " state FAILED CONNECT TO STAGING MANUAL AND VERIFY WHY!") raise
def test_current_status(self): user_content = API.VirtualFunction.create_engagement( wait_for_gitlab=False) vfName = user_content['vfName'] Frontend.User.login(user_content['email'], Constants.Default.Password.TEXT) # new Frontend.Overview.click_on_vf(user_content) Frontend.User.go_to_account() Wait.id(user_content['email']) actualFullName = Get.value_by_name("fullname") Helper.internal_assert(user_content['full_name'], actualFullName) Click.id(Constants.Dashboard.Statuses.ID) Frontend.Overview.click_on_vf(user_content) Helper.internal_assert( "Current Status", Get.by_css(Constants.Dashboard.Overview.Status.Header.ID)) Wait.text_by_id(Constants.Dashboard.Overview.Status.Description.ID, "No status update has been provided yet.") Click.id(Constants.Dashboard.Avatar.ID) Click.link_text("Logout") engLeadEmail = DB.User.select_el_email(vfName) Frontend.User.relogin(engLeadEmail, Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) Click.css(Constants.Dashboard.Overview.Status.Add.CSS) Helper.internal_assert("Add Status", Get.by_css("h3.modal-title.ng-binding")) Helper.internal_assert( "Use the form below to add the current status of the engagement.", Get.by_css("span.ng-binding")) Click.css("textarea[name=\"description\"]") Enter.text_by_css("textarea[name=\"description\"]", "Add new Status", wait_for_page=True) Helper.internal_assert( "Add status", Get.by_id(Constants.Dashboard.DetailedView.VFC.Save_button.ID)) Click.id(Constants.Dashboard.DetailedView.VFC.Save_button.ID, wait_for_page=True) Helper.assertTrue("Last updated" in Get.by_id("status-update-details")) Wait.text_by_id(Constants.Dashboard.Overview.Status.Description.ID, "Add new Status") Wait.css(Constants.Dashboard.Overview.Status.Edit.CSS) Wait.modal_to_dissappear() Click.css(Constants.Dashboard.Overview.Status.Edit.CSS) Helper.internal_assert("Current Status", Get.by_css("h3.modal-title.ng-binding")) Click.css("textarea[name=\"description\"]") Enter.text_by_css("textarea[name=\"description\"]", "Update Status") Click.id(Constants.Dashboard.DetailedView.VFC.Save_button.ID) Wait.modal_to_dissappear() Wait.text_by_id(Constants.Dashboard.Overview.Status.Description.ID, "Update Status") Frontend.User.logout() Frontend.User.relogin(user_content['email'], Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) Helper.internal_assert( "Current Status", Get.by_css(Constants.Dashboard.Overview.Status.Header.ID)) Wait.text_by_id(Constants.Dashboard.Overview.Status.Description.ID, "Update Status")
def compare_aic_selected_version(expected_aic_version): Helper.internal_assert( Get.by_id(Constants.Dashboard.DetailedView.AIC.ID + expected_aic_version), expected_aic_version)
def test_add_service_provider_internal(self): ''' TC Name: test_add_service_provider_internal Steps: Invite is_service_provider_contact Sponsor and activate the invited user. Validate sponsor has the right VF. ''' user_content = API.User.create_new_user(company="Amdocs") uuid = DB.General.select_where_email("uuid", "ice_user_profile", user_content['email']) activationUrl = DB.User.get_activation_url(user_content['email']) Frontend.General.re_open(activationUrl) Frontend.User.login(user_content['email'], Constants.Default.Password.TEXT) # new Wait.text_by_id(Constants.Toast.ID, Constants.Dashboard.ActivateMsg.Success.TEXT) Click.id(Constants.Dashboard.Wizard.CloseButton.ID) Wait.modal_to_dissappear() Frontend.User.logout() Frontend.User.login(user_content['email'], Constants.Default.Password.TEXT) Wait.text_by_css(Constants.Dashboard.LeftPanel.Title.CSS, Constants.Dashboard.LeftPanel.Title.TEXT) Wait.id(Constants.Dashboard.Statuses.Title.ID) logger.debug("click_on on + Dashboard") Click.id(Constants.Dashboard.LeftPanel.AddEngagement.ID) # Wizard vfName = Frontend.Wizard.add_vf() service_provider_internal = \ Frontend.Wizard.add_service_provider_internal() inviteEmail = "automationqatt" + \ Helper.rand_string("randomString") + "@gmail.com" Frontend.Wizard.invite_team_members(inviteEmail) Frontend.Wizard.add_ssh_key() enguuid = DB.General.select_where("uuid", "ice_vf", "name", vfName, 1) invitation_token = DB.User.select_invitation_token( "invitation_token", "ice_invitation", "engagement_uuid", enguuid, inviteEmail, 1) inviterURL = Constants.Default.InviteURL.Signup.TEXT + \ invitation_token + "&email=" + inviteEmail Frontend.General.re_open(inviterURL) actualInvitedEmail = Get.value_by_name("email") Helper.internal_assert(inviteEmail, actualInvitedEmail) signUpURLforContact = DB.User.get_contact_signup_url( invitation_token, uuid, service_provider_internal["email"], service_provider_internal["full_name"], service_provider_internal["phone"], service_provider_internal["company"]) Frontend.General.re_open(signUpURLforContact) actualInvitedEmail = Get.value_by_name(Constants.Signup.Email.NAME) Helper.internal_assert(str("+" + service_provider_internal["phone"]), Get.value_by_name(Constants.Signup.Phone.NAME)) Helper.internal_assert( service_provider_internal["full_name"], Get.value_by_name(Constants.Signup.FullName.NAME)) Helper.internal_assert( service_provider_internal["company"], Get.value_by_name(Constants.Signup.Company.NAME)) # Fetch one is_service_provider_contact user ID. engagement_id = DB.General.select_where("engagement_id", "ice_vf", "name", vfName, 1) # SignUp for MainServiceProviderSponsorContact engagement_manual_id = DB.General.select_where("engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) invitation_token = DB.User.select_invitation_token( "invitation_token", "ice_invitation", "engagement_uuid", engagement_id, service_provider_internal["email"], 1) engLeadEmail = DB.User.select_el_email(vfName) user_content['engagement_uuid'] = engagement_id user_content['engagement_manual_id'] = engagement_manual_id user_content['vfName'] = vfName user_content['el_email'] = engLeadEmail API.User.signup_invited_user(service_provider_internal["company"], service_provider_internal["email"], invitation_token, signUpURLforContact, user_content, True) activationUrl2 = DB.User.get_activation_url( service_provider_internal["email"]) # Activate for VendorContact engagement_manual_id = DB.General.select_where("engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) # Validate opened right VF for VendorContact myVfName = engagement_manual_id + ": " + vfName actualVfNameid = "clickable-" + myVfName Frontend.General.re_open(activationUrl2) Frontend.User.login(service_provider_internal["email"], Constants.Default.Password.TEXT, actualVfNameid) actualVfName = Get.by_id(actualVfNameid, wait_for_page=True) Helper.internal_assert(myVfName, actualVfName)
def validate_deprecated_ecomp_release_in_dropdown(expected_ecomp_release): Helper.internal_assert( Get.by_id(Constants.Dashboard.DetailedView.ECOMP.Dropdown. UniversalRelease.ID % expected_ecomp_release), expected_ecomp_release + " - Deprecated")
def compare_selected_ecomp_release(expected_ecomp_release): Helper.internal_assert( Get.by_id(Constants.Dashboard.DetailedView.ECOMP.ID + expected_ecomp_release), expected_ecomp_release)