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 get_to_create_new_ns_modal(): Click.id(Constants.Dashboard.Checklist.AddNS.ID, wait_for_page=True) Wait.text_by_css(Constants.Dashboard.Checklist.AddNS.CSS, Constants.Dashboard.Checklist.TITLE) Helper.internal_assert( Constants.Dashboard.Checklist.TITLE, Get.by_css(Constants.Dashboard.Checklist.AddNS.CSS)) Helper.internal_assert(Constants.Dashboard.Checklist.AddNS.TITLE, Get.by_css(Constants.FEGeneral.CSS.H2))
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_account_details(full_name, phone_number, ssh_key): Helper.internal_assert( full_name, Get.value_by_name( Constants.Dashboard.Avatar.Account.FullName.NAME)) Helper.internal_assert( phone_number, Get.value_by_name(Constants.Dashboard.Avatar.Account.Phone.NAME)) Helper.internal_assert( ssh_key, Get.value_by_name(Constants.Dashboard.Avatar.Account.SSHKey.NAME))
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 validate_target_lab_entry(date): Wait.text_by_css(Constants.Dashboard.DetailedView.TargetLabEntry.CSS, Constants.Dashboard.DetailedView.TargetLabEntry.TEXT, wait_for_page=True) actualDate = Get.by_css( Constants.Dashboard.DetailedView.TargetLabEntry.CONTENT_CSS) Helper.internal_assert(actualDate, date)
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 check_if_creator_of_NS_is_the_EL(user_content): logger.debug(" > Check if creator of NS is the EL " + user_content['el_name']) if (user_content['el_name'] not in Get.by_name("creator-full-name-" + user_content['el_name'])): logger.error("EL is not the creator of the NS according to UI.") raise
def validate_user_profile_settings_checkboxes(checked): Wait.page_has_loaded() receive_emails = Get.is_selected_by_id( Constants.Dashboard.Avatar.Account.UserProfileSettings. ReceiveEmailsID, True) Helper.internal_assert(receive_emails, checked) Get.is_selected_by_id( Constants.Dashboard.Avatar.Account.UserProfileSettings. ReceiveNotificationsID, True) receive_email_every_time = Get.is_selected_by_id( Constants.Dashboard.Avatar.Account.UserProfileSettings. ReceiveEmailEveryTimeID, True) Helper.internal_assert(receive_email_every_time, checked) receive_digest_email = Get.is_selected_by_id( Constants.Dashboard.Avatar.Account.UserProfileSettings. ReceiveDigestEmailID, True) Helper.internal_assert(receive_digest_email, not checked)
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 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 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 reject_checklist(newObj, checklistName): Click.xpath("//button[2]") vfName = newObj[0] engLeadFullName = DBUser.get_el_name(vfName) Enter.text_by_name( Constants.Dashboard.Checklist.Reject.Modal.Comment.NAME, "Reject state By :" + engLeadFullName) Helper.internal_assert("Checklist: " + checklistName, Get.by_css("span.state-title.ng-binding")) Wait.text_by_id(Constants.Dashboard.Checklist.Reject.Modal.Button.ID, Constants.Dashboard.Checklist.Reject.Modal.Button.TEXT) Click.id(Constants.Dashboard.Checklist.Reject.Modal.Button.ID) Wait.modal_to_dissappear()
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 update_target_lab_entry(): Click.id(Constants.Dashboard.DetailedView.TargetLabEntry.CHANGE, wait_for_page=True) Enter.date_picker('#lab-entry-date', 'vm.targetLabDate', wait_for_page=True) Click.css(Constants.Dashboard.DetailedView.TargetLabEntry.INPUT_CSS, wait_for_page=True) Click.css(Constants.SubmitButton.CSS, wait_for_page=True) actualDate = Get.by_css( Constants.Dashboard.DetailedView.TargetLabEntry.CONTENT_CSS, wait_for_page=True) return str(actualDate)
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 edit_description_lineitem_and_save(): desc = Helper.rand_string("randomString") Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. FIRST_LINE_ITEM_ID) Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. EDIT_LINE_ITEM_BTN) Enter.text_by_id( Constants.Dashboard.LeftPanel.EditChecklistTemplate. EDIT_LINE_ITEM_NAME, Helper.rand_string("randomString")) Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. EDIT_LINE_ITEM_DESC) editor_element = Get.wysiwyg_element_by_id( Constants.Dashboard.LeftPanel.EditChecklistTemplate. LINE_ITEM_DESC_TEXT_BOX) editor_element.clear() editor_element.send_keys(desc) Wait.page_has_loaded() actionChains = ActionChains(session.ice_driver) actionChains.double_click(editor_element).perform() Wait.page_has_loaded() Click.xpath(Constants.Dashboard.LeftPanel.EditChecklistTemplate. WYSIWYG_BUTTON_BOLD) Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. EDIT_LINE_ITEM_BTN, wait_for_page=True) isBold = Wait.is_css_exists("b") while not isBold: Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. EDIT_LINE_ITEM_BTN, wait_for_page=True) actionChains.double_click(editor_element).perform() Click.xpath(Constants.Dashboard.LeftPanel.EditChecklistTemplate. WYSIWYG_BUTTON_BOLD, wait_for_page=True) Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. EDIT_LINE_ITEM_BTN, wait_for_page=True) isBold = Wait.is_css_exists("b") if isBold: FEChecklistTemplate.click_on_save_and_assert_success_msg() FEGeneral.refresh() Click.name(Constants.Dashboard.LeftPanel.EditChecklistTemplate.HEAT, wait_for_page=True) Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. FIRST_LINE_ITEM_ID, wait_for_page=True) Wait.css("b") Wait.text_by_css("b", desc, wait_for_page=True)
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 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 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 check_vnf_version(user_content): current_vnf_value = Get.by_css( "#progress_bar_" + user_content['engagement_manual_id'] + " ." + Constants.Dashboard.Overview.Progress.VnfVersion.CLASS, wait_for_page=True) Helper.internal_assert(current_vnf_value, user_content['vnf_version'])
def test_invite_new_user(self): """ Name: test_invite_new_user Steps: Create new APIUser via SignUp request-->Login with This One--> build "activationUrl"--> Validation of successful activate--> close Wizard --> Logout-->login-->Open Wizard--> fill all fields in all Tab's(4)--> build inviteURL from email--> reopen browser with inviteURL--> Validate fields filled's in SignUp form """ user_content = API.User.create_new_user() # Fetch one user ID. uuid = DB.General.select_where_email( "uuid", "ice_user_profile", user_content['email']) Frontend.User.activate_and_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() vendor_contact = Frontend.Wizard.add_vendor_contact() inviteEmail = Helper.rand_invite_email() Frontend.Wizard.invite_team_members(inviteEmail) Frontend.Wizard.add_ssh_key() enguuid = DB.General.select_where("uuid", "ice_vf", "name", vfName, 1) inviterURL = Constants.Default.InviteURL.Signup.TEXT + \ enguuid + "&inviter_uuid=" + uuid + "&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( enguuid, uuid, vendor_contact["email"], vendor_contact["full_name"], vendor_contact["phone"], vendor_contact["company"]) Frontend.General.re_open(signUpURLforContact) actualInvitedEmail = Get.value_by_name(Constants.Signup.Email.NAME) Helper.internal_assert(vendor_contact["email"], actualInvitedEmail) Helper.internal_assert( "+" + vendor_contact["phone"], Get.value_by_name( Constants.Signup.Phone.NAME)) Helper.internal_assert( vendor_contact["full_name"], Get.value_by_name( Constants.Signup.FullName.NAME)) Helper.internal_assert( vendor_contact["company"], Get.value_by_name( Constants.Signup.Company.NAME))
def get_meta_order_of_element(element_id): return Get.meta_order_by_id(element_id)
def test_invite_new_user_of_service_provider_internal(self): ''' TC Name: test_invite_new_user_aservice_provider_internal Steps: Create new NOT-MainServiceProvider APIUser via SignUp request--> Login with This One--> build "activationUrl"--> Validation of successful activate--> close Wizard --> Logout from Dashboard -->login-->Open Wizard--> fill all fields in all Tab's(4)--> validate second Tab is a "add_service_provider_internal"--> build inviteURL from email--> reopen browser with inviteURL--> Validate Login Form opened --> Login--> Validate Dashboard Form opened ''' 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) 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) Click.id(Constants.Dashboard.LeftPanel.AddEngagement.ID) # Wizard vfName = Frontend.Wizard.add_vf() service_provider_internal = \ Frontend.Wizard.add_service_provider_internal() inviteEmail = Helper.rand_invite_email() 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(Constants.Signup.Email.NAME) 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(service_provider_internal["email"], actualInvitedEmail) Helper.internal_assert("+" + 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)) signupCompany = Get.value_by_name(Constants.Signup.Company.NAME, True) Helper.internal_assert(service_provider_internal["company"], signupCompany)
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")