def test_retire_ecomp_release(self): new_ecomp_release = None try: new_ecomp_release = { "uuid": uuid.uuid4(), "name": Helper.rand_string(), "ui_visibility": "FALSE" } DB.VirtualFunction.insert_ecomp_release( new_ecomp_release['uuid'], new_ecomp_release['name'], new_ecomp_release['ui_visibility']) Frontend.User.login(self.user_content['el_email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( self.user_content['engagement_manual_id'], self.user_content['vfName']) Frontend.DetailedView.click_on_update_ecomp_release() session.run_negative( lambda: Frontend.General.get_meta_order_of_element( Constants.Dashboard.DetailedView.ECOMP.Dropdown. UniversalRelease.ID % new_ecomp_release['name']), "New ECOMP release was found in dropdown.") finally: if new_ecomp_release: DB.VirtualFunction.delete_ecomp_release( new_ecomp_release['uuid'], new_ecomp_release['name'])
def click_on_disabled_save_and_assert_for_promp_msg(): Click.id( Constants.Dashboard.LeftPanel.EditChecklistTemplate.SAVE_BTN_ID) session.run_negative( lambda: Click.id(Constants.Dashboard.LeftPanel. EditChecklistTemplate.APPROVE_BTN_ID), "Ooops modal window is opened although 'Save' " + "button should have been disabled")
def click_on_dashboard_and_validate_statistics(is_negative): # Click.id(Constants.Dashboard.Default.DASHBOARD_ID) Wait.page_has_loaded() if is_negative: session.run_negative( lambda: Wait.id(Constants.Dashboard.Default.STATISTICS), "Negative test failed at Statistics appears") else: Wait.id(Constants.Dashboard.Default.STATISTICS)
def test_bucket_url_not_appears_stage_intake(self): user_content = API.VirtualFunction.create_engagement( wait_for_gitlab=False) Frontend.User.login(Constants.Users.Admin.EMAIL, Constants.Default.Password.TEXT) Frontend.Overview.click_on_vf(user_content) session.run_negative( lambda: Frontend.Overview.validate_bucket_url( user_content['engagement_manual_id'], user_content['vfName']), "Storage bucket URL appears on stage Intake")
def test_negative_admin_page(self): users_email_list = [ self.user_content['email'], self.user_content['pr_email'], self.user_content['el_email'], Constants.Users.AdminRO.EMAIL ] for user_email in users_email_list: Frontend.User.relogin(user_email, Constants.Default.Password.TEXT) Frontend.User.click_on_avatar() session.run_negative( lambda: Frontend.User.click_on_admin(), "Negative test failed at" " click_on_admin with user %s" % user_email)
def validate_expired_post_Announcement(email, title, description): title2 = Constants.Toast.TEXT + title + "." Wait.text_by_id(Constants.Toast.CMS_ID, title2, True) FEDashboard.open_announcement() Wait.text_by_id(Constants.Cms.Toast_title_id, title) Wait.text_by_id(Constants.Cms.Toast_description, description) DBCMS.update_X_days_back_post(title, xdays=3) Click.id(Constants.Cms.Test_addDT_close_modal_button) FEUser.logout() FEUser.login(email, Constants.Default.Password.TEXT) session.run_negative( lambda: Wait.text_by_id(Constants.Toast.CMS_ID, title2), "Announcement toast not disappear after 2 days %s" % title)
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 announcement_validate_toast(title, description, user_content): Wait.text_by_id(Constants.Toast.CMS_ID, title + ".") FEDashboard.open_announcement() Wait.text_by_id(Constants.Cms.Toast_title_id, title) Wait.text_by_id(Constants.Cms.Toast_description, description) Click.id(Constants.Cms.Test_addDT_close_modal_button) Click.css("button.close") FEUser.logout() FEUser.login(user_content['email'], Constants.Default.Password.TEXT) # Validate Announcement displayed in News & Announcements sections session.run_negative( lambda: FEDashboard.open_announcement(), "Announcement toast disappear after 2 days %s" % title) Wait.text_by_id(title, title) Wait.text_by_id(description, description)
def validate_5_last_announcement_displayed(listOfTitleAnDescriptions, user_content, last_title): last_description = listOfTitleAnDescriptions[ len(listOfTitleAnDescriptions) - 1][1] Wait.text_by_id(Constants.Toast.CMS_ID, last_title + ".") FEDashboard.open_announcement() Wait.text_by_id(Constants.Cms.Toast_title_id, last_title) Wait.text_by_id(Constants.Cms.Toast_description, last_description) DBCMS.update_X_days_back_post(last_title, xdays=3) Click.id(Constants.Cms.Test_addDT_close_modal_button) FEUser.logout() # Validate Announcement TOAST not displayed FEUser.login(user_content['email'], Constants.Default.Password.TEXT) session.run_negative( lambda: Wait.text_by_id(Constants.Cms.Toast_title_id, last_title), "Last Announcement displayed in News & Announcements sections %s" % last_title)
def test_retire_aic_version(self): new_aic_version = None try: new_aic_version = DB.VirtualFunction.insert_aic_version("FALSE") Frontend.User.login(self.user_content['el_email'], Constants.Default.Password.TEXT) Frontend.DetailedView.search_vf_and_go_to_detailed_view( self.user_content['engagement_manual_id'], self.user_content['vfName']) Frontend.DetailedView.click_on_update_aic_version() session.run_negative( lambda: Frontend.General.get_meta_order_of_element( Constants.Dashboard.DetailedView.AIC.Dropdown. UniversalVersion.ID % new_aic_version['version']), "New AIC version was found in dropdown.") finally: if new_aic_version: DB.VirtualFunction.delete_aic_version(new_aic_version['uuid'])
def invite_x_users_from_tm(list_of_invite_emails, countofUser, countOfem, num): Enter.text_by_name("email", list_of_invite_emails[countofUser], wait_for_page=True) for _ in range(num): try: session.run_negative(lambda: Click.css("span.add-icon"), "css appears") break except BaseException: # button exists pass countofUser += 1 # Click.css("span.add-icon") Wait.xpath("//fieldset[" + str(countOfem) + "]/div/input") Enter.text_by_xpath("//fieldset[" + str(countOfem) + "]/div/input", list_of_invite_emails[countofUser]) countOfem += 1 Click.css(Constants.SubmitButton.CSS, wait_for_page=True)
def remove_deployment_target(user_content): Wait.text_by_id("visible-dts-Lisle (DPA3)", "Lisle (DPA3)", wait_for_page=True) dt_site_id = DBGeneral.select_query( "SELECT uuid FROM public.ice_deployment_target_site where name" + " = 'Lisle (DPA3)'") Click.id("visible-dts-Lisle (DPA3)") Wait.id( Constants.Dashboard.DetailedView.DeploymentTarget.ID_REMOVE_DTS + dt_site_id) Click.id( Constants.Dashboard.DetailedView.DeploymentTarget.ID_REMOVE_DTS + dt_site_id, wait_for_page=True) session.run_negative( lambda: Wait.text_by_id("visible-dts-Lisle (DPA3)", "Lisle (DPA3)", wait_for_page=True), "Negative test failed at wait text Lisle (DPA3)")
def cl_to_next_stage(actualVfNameid): Click.xpath("//div[@id='state-actions']/button", wait_for_page=True) Wait.id(actualVfNameid, wait_for_page=True) session.run_negative(lambda: Wait.css(Constants.Default.BlockUI.CSS), "Error: CL to next stage failed.")
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")