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 validate_multi_eng(user_content, checklist_content, newEL_content, actualVfNameid): query = "UPDATE ice_user_profile SET role_id=2 WHERE email = '" + \ str(newEL_content['email']) + "';" DBGeneral.update_by_query(query) FEWizard.invite_team_members_modal(newEL_content['email']) # Fetch one AT&T user ID. enguuid = DBGeneral.select_where("uuid", "ice_engagement", "engagement_manual_id", user_content['engagement_manual_id'], 1) invitation_token = DBUser.select_invitation_token( "invitation_token", "ice_invitation", "engagement_uuid", enguuid, newEL_content['email'], 1) URL = Constants.Default.InviteURL.Login.TEXT + invitation_token FEGeneral.re_open(URL) FEUser.login(newEL_content['email'], Constants.Default.Password.TEXT, expected_element=actualVfNameid) Click.id(actualVfNameid, wait_for_page=True) count = None try: session.ice_driver.find_element_by_id("checklist-" + checklist_content['uuid']) count += 1 except BaseException: logger.debug("check list not visible for EL invited : " + str(newEL_content['email'])) assertTrue(count is None) query = "UPDATE ice_user_profile SET role_id=1 WHERE email = '" + \ str(newEL_content['email']) + "';" DBGeneral.update_by_query(query)
def validate_filtering_by_stage(user_content, stage): FEGeneral.re_open(Constants.Default.LoginURL.TEXT) # Validate Scrolling # FEUser.login(user_content['el_email'], Constants.Default.Password.TEXT) FEOverview.click_on_vf(user_content) Click.id(Constants.Dashboard.Statuses.ID, wait_for_page=True) Wait.text_by_id("dashboard-title", "Statuses", wait_for_page=True) Wait.id("search-filter-stage") Select(session.ice_driver.find_element_by_id( "search-filter-stage")).select_by_visible_text(stage) Wait.id(Constants.Dashboard.Statuses.ExportExcel.ID, wait_for_page=True) engLeadID = DBUser.select_user_native_id(user_content['el_email']) # Query for fetching count of rows per stage. countOfEngInStagePerUser = DBUser.select_user_engagements_by_stage( stage, engLeadID) # Calculate number of pages # NUM_OF_RESULTS_PER_PAGES = 8 number_of_pages = countOfEngInStagePerUser // NUM_OF_RESULTS_PER_PAGES logger.debug("Number of pages: " + str(number_of_pages)) if (countOfEngInStagePerUser % NUM_OF_RESULTS_PER_PAGES != 0): number_of_pages += 1 logger.debug("number_of_pages " + str(number_of_pages)) # Scroll # Wait.id("engagements-pagination", wait_for_page=True) element = session.ice_driver.find_element_by_id( "engagements-pagination") element.location_once_scrolled_into_view Click.link_text(str(number_of_pages), wait_for_page=True)
def activate_and_login( email, password, expected_element=Constants.Dashboard.Statuses.Title.ID, element_type="id"): activationUrl = DBUser.get_activation_url(email) FEGeneral.re_open(activationUrl) FEUser.login(email, password, expected_element, element_type)
def validate_deployment_targets(user_content, users): for user in users: FEGeneral.re_open(Constants.Default.LoginURL.TEXT) logger.debug("Login with user " + user) FEUser.login(user, Constants.Default.Password.TEXT) FEDetailedView.search_vf_and_go_to_detailed_view( user_content['engagement_manual_id'], user_content['vfName']) Wait.id(Constants.Dashboard.DetailedView.DeploymentTarget. AddDeploymentTargetButton.ID)
def invite_x_users(user_content, vf_left_nav_id, x): for _ in range(x): # Invites 2-5 Click.id(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) FEWizard.invite_team_members_modal(user_content[1]['email']) FEGeneral.refresh()
def add_remove_deployment_targets(user_content, users): for user in users: FEGeneral.re_open(Constants.Default.LoginURL.TEXT) logger.debug("Login with user " + user) FEUser.login(user, Constants.Default.Password.TEXT) FEDetailedView.search_vf_and_go_to_detailed_view( user_content['engagement_manual_id'], user_content['vfName']) FEDetailedView.add_deployment_target(user_content) FEDetailedView.remove_deployment_target(user_content)
def search_by_vf(user_content): engName = user_content['engagement_manual_id'] + ": " + user_content[ 'vfName'] engSearchID = "eng-" + engName FEGeneral.re_open_not_clean_cache(Constants.Default.DashbaordURL.TEXT) logger.debug("Search engagement by engagement_manual_id") Enter.text_by_id(Constants.Dashboard.Statuses.SearchBox.ID, user_content['engagement_manual_id'], wait_for_page=True) eng_manual_id = user_content['engagement_manual_id'] + ":" Wait.text_by_id(engSearchID, eng_manual_id)
def validate_negative_role_for_deployment_targets(user_content, users): for user in users: FEGeneral.re_open(Constants.Default.LoginURL.TEXT) logger.debug("Login with user " + user) FEUser.login(user, Constants.Default.Password.TEXT) FEDetailedView.search_vf_and_go_to_detailed_view( user_content['engagement_manual_id'], user_content['vfName']) session.run_negative( lambda: Click.id(Constants.Dashboard.DetailedView. DeploymentTarget.AddDeploymentTargetButton.ID ), "Negative test failed at click_on_ deployment-targets " + "with user %s" % user)
def search_in_dashboard(user_content, vfcName, users): engName = user_content['engagement_manual_id'] + ": " + user_content[ 'vfName'] engSearchID = "eng-" + engName for user in users: FEGeneral.re_open(Constants.Default.LoginURL.TEXT) logger.debug("Login with user " + user) FEUser.login(user, Constants.Default.Password.TEXT) logger.debug("Search engagement by engagement_manual_id") Enter.text_by_id(Constants.Dashboard.Statuses.SearchBox.ID, user_content['engagement_manual_id']) eng_manual_id = user_content['engagement_manual_id'] + ":" Wait.text_by_id(engSearchID, eng_manual_id) logger.debug("Engagement found (searched by engagement_manual_id)") FEGeneral.smart_refresh() logger.debug("Search engagement by VF name") # Search by VF name. Enter.text_by_id(Constants.Dashboard.Statuses.SearchBox.ID, user_content['vfName']) Wait.text_by_id(engSearchID, eng_manual_id) logger.debug("Engagement found (searched by VF name)") FEGeneral.smart_refresh() logger.debug("Search engagement by VFC") # Search by VFC. Enter.text_by_id(Constants.Dashboard.Statuses.SearchBox.ID, vfcName) Wait.text_by_id(engSearchID, eng_manual_id) logger.debug("Engagement found (searched by VFC)") FEGeneral.smart_refresh() logger.debug("Negative search: search by random string") # Search by VFC. Enter.text_by_id(Constants.Dashboard.Statuses.SearchBox.ID, "RND_STR_" + Helper.rand_string("randomString")) Wait.text_by_id("search-results", "Export to Excel >>")
def check_cl_after_lineitem_added(): template_name = Constants.Dashboard.LeftPanel.\ EditChecklistTemplate.HEAT user_content = APIVirtualFunction.create_engagement() FEUser.login(Constants.Users.Admin.EMAIL, Constants.Default.Password.TEXT) vfName = user_content['vfName'] engagement_id = DBChecklist.fetchEngByVfName(vfName) engLeadEmail = DBUser.select_el_email(vfName) engagement_manual_id = DBChecklist.fetchEngManIdByEngUuid( engagement_id) FEOverview.click_on_vf(user_content) FEGeneral.re_open(Constants.Default.LoginURL.TEXT) FEUser.login(engLeadEmail, Constants.Default.Password.TEXT, engagement_manual_id) Click.id( Constants.Dashboard.LeftPanel.EditChecklistTemplate.DASHBOARD_ID) Enter.text_by_id( Constants.Dashboard.LeftPanel.EditChecklistTemplate.SEARCH_ENG_ID, vfName) Click.id("test_" + vfName) checklistName = FEChecklist.create_checklist(engagement_id, vfName, None, engagement_manual_id) FEUser.go_to_admin() result = DBChecklist.fetchChecklistByName(checklistName) FEUser.go_to_admin() FEChecklistTemplate.click_on_template_name_on_navigation( Constants.Dashboard.LeftPanel.EditChecklistTemplate.HEAT, template_name) Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. EDIT_LINE_ITEM_BTN) Enter.text_by_id( Constants.Dashboard.LeftPanel.EditChecklistTemplate. EDIT_LINE_ITEM_NAME, "test_lineitem_added_and_audit_log_on_dupl_cl-NAME") Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. EDIT_LINE_ITEM_BTN) FEChecklistTemplate.click_on_save_and_assert_success_msg() Click.id( Constants.Dashboard.LeftPanel.EditChecklistTemplate.DASHBOARD_ID) Enter.text_by_id( Constants.Dashboard.LeftPanel.EditChecklistTemplate.SEARCH_ENG_ID, vfName) Click.id("test_" + vfName) Click.id("checklist-" + str(result)) Helper.internal_assert( "1. automation", session.ice_driver.find_element_by_xpath("//li[@id='']").text)
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 test_all_vf_gitlab_repo_files_can_be_chosen_in_new_ns(self): newObj, user_content = API.User.create_new_user_content() user_content['session_token'] = "token " + \ API.User.login_user(user_content['el_email']) checklist = API.Checklist.create_checklist(user_content) DB.Checklist.state_changed( "uuid", checklist['uuid'], Constants.ChecklistStates.Review.TEXT) Frontend.User.relogin( user_content['el_email'], 'iceusers') eng_id = "clickable-%s: %s" % ( user_content['engagement_manual_id'], user_content['vfName']) Frontend.Checklist.go_to_checklist(eng_id, checklist['uuid']) Frontend.Checklist.get_to_create_new_ns_modal() files = API.VirtualFunction.get_engagement(user_content)["files"] FEGeneral.verify_existing_files_in_list( files, 'associated-files-list')
def validations_for_user2(user_content, inviteEmail, vflist): # Fetch one AT&T user ID. engagement_id = DBGeneral.select_where("engagement_id", "ice_vf", "name", vflist[0], 1) engagement_manual_id = DBGeneral.select_where("engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) engLeadEmail = DBUser.select_el_email(vflist[0]) user_content['engagement_uuid'] = engagement_id user_content['el_email'] = engLeadEmail uuid = DBGeneral.select_where_email("uuid", "ice_user_profile", user_content['email']) sponsor = [ ServiceProvider.MainServiceProvider, 'aaaaaa', inviteEmail, '3058000000' ] invitation_token = DBUser.select_invitation_token( "invitation_token", "ice_invitation", "engagement_uuid", engagement_id, inviteEmail, 1) signUpURLforContact = DBUser.get_contact_signup_url( invitation_token, uuid, sponsor[2], sponsor[1], sponsor[3], sponsor[0]) APIUser.signup_invited_user(sponsor[0], inviteEmail, invitation_token, signUpURLforContact, user_content, True, wait_for_gitlab=False) activationUrl2 = DBUser.get_activation_url(sponsor[2]) FEGeneral.re_open(activationUrl2) # Login with 2nd user # engName = engagement_manual_id + ": " + vflist[0] title_id = "clickable-" + engName FEUser.login(inviteEmail, Constants.Default.Password.TEXT, title_id) for vfName in vflist: # Fetch one AT&T user ID. engagement_id = DBGeneral.select_where("engagement_id", "ice_vf", "name", vfName, 1) engagement_manual_id = DBGeneral.select_where( "engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) engName = engagement_manual_id + ": " + vfName vf_left_nav_id = "clickable-" + engName Click.id(vf_left_nav_id, wait_for_page=True)
def invite_x_users_and_verify_VF_appers_for_invited(user_content, engName): inviteEmail = Helper.rand_string( 'randomString') + "@" + ServiceProvider.email vflist = FEInvite.create_x_vfs(user_content, engName, x=3) for vfName in vflist: # Fetch one AT&T user ID. engagement_id = DBGeneral.select_where("engagement_id", "ice_vf", "name", vfName, 1) engagement_manual_id = DBGeneral.select_where( "engagement_manual_id", "ice_engagement", "uuid", engagement_id, 1) engName = engagement_manual_id + ": " + vfName vf_left_nav_id = "clickable-" + engName Click.id(vf_left_nav_id) FEWizard.invite_team_members_modal(inviteEmail, wait_modal_to_disappear=False) FEGeneral.refresh() # validations FEInvite.validations_for_user2(user_content, inviteEmail, vflist)
class Frontend: User = FEUser() Invite = FEInvite() Checklist = FEChecklist() Dashboard = FEDashboard() DetailedView = FEDetailedView() General = FEGeneral() Overview = FEOverview() Wizard = FEWizard() Cms = FECms() ChecklistTemplate = FEChecklistTemplate()
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 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 add_deployment_target(user_content): Click.id(Constants.Dashboard.DetailedView.TargetLabEntry.Add.ID) Wait.text_by_id( Constants.Dashboard.Modal.TITLE_ID, Constants.Dashboard.DetailedView.DeploymentTarget.TITLE) # FIXME: empty drop-down, tests will fail. Select(session.ice_driver.find_element_by_xpath( "//select")).select_by_visible_text("Lisle (DPA3)") Click.id(Constants.Dashboard.DetailedView.DeploymentTarget.SAVE, wait_for_page=True) Wait.text_by_css(Constants.Dashboard.DetailedView.DeploymentTarget.CSS, "Lisle (DPA3)", wait_for_page=True) Wait.text_by_id( Constants.Dashboard.DetailedView.AIC.ID + user_content['target_aic'], user_content['target_aic']) e2edate = FEGeneral.date_short_formatter() Wait.text_by_css( Constants.Dashboard.DetailedView.TargetLabEntry.CONTENT_CSS, e2edate)
def validate_aic_version(): FEGeneral.refresh() Wait.id(Constants.Dashboard.DetailedView.AIC.ID + "3.0", wait_for_page=True)
def validate_ecomp_version(): FEGeneral.refresh() Wait.id(Constants.Dashboard.DetailedView.ECOMP.ID + Constants. Dashboard.DetailedView.ValidationDetails.ECOMPRelease.UNKNOW, wait_for_page=True)
def relogin(email, password, expected_element=Constants.Dashboard.Statuses.Title.ID, element_type="id"): FEGeneral.re_open(Constants.Default.LoginURL.TEXT) FEUser.login(email, password, expected_element, element_type)
def check_notification_number_is_not_presented(): FEGeneral.refresh() Wait.id_to_dissappear( Constants.Dashboard.Avatar.Notifications.Count.ID, wait_for_page=True)
def validate_vf_version(newVFVersionName): FEGeneral.refresh() Wait.id(Constants.Dashboard.DetailedView.ValidationDetails.VFVersion. VF_VERSION_ID + newVFVersionName, wait_for_page=True)
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