def validate_statistics_by_stages(user_content): # Validate Scrolling # FEOverview.click_on_vf(user_content) Click.id(Constants.Dashboard.Statuses.ID) Wait.text_by_id("dashboard-title", "Statuses") Wait.css(Constants.Dashboard.Statuses.Statistics.FilterDropdown.CSS) Select( session.ice_driver.find_element_by_css_selector( Constants.Dashboard.Statuses.Statistics.FilterDropdown.CSS) ).select_by_visible_text("All") engLeadID = DBUser.select_user_native_id(user_content['el_email']) countOfEngInStagePerUser = DBUser.select_all_user_engagements( engLeadID) # Scroll # Wait.text_by_id( Constants.Dashboard.Statuses.Statistics.EngagementsNumber.ID, str(countOfEngInStagePerUser), wait_for_page=True) element = session.ice_driver.find_element_by_id( Constants.Dashboard.Statuses.Statistics.EngagementsNumber.ID) # Stage Active Validation # element.location_once_scrolled_into_view Wait.css(Constants.Dashboard.Statuses.Statistics.FilterDropdown.CSS, wait_for_page=True) Select( session.ice_driver.find_element_by_css_selector( Constants.Dashboard.Statuses.Statistics.FilterDropdown.CSS) ).select_by_visible_text("Active") countOfEngInStagePerUser = DBUser.select_user_engagements_by_stage( "Active", engLeadID) Wait.text_by_id( Constants.Dashboard.Statuses.Statistics.EngagementsNumber.ID, str(countOfEngInStagePerUser), wait_for_page=True)
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 click_on_checklist(user_content, checklistName, checklist_uuid=None): FEOverview.click_on_vf(user_content) if checklist_uuid is None: checklist_uuid = DBGeneral.select_where_not_and_order_by_desc( 'uuid', Constants.DBConstants.IceTables.CHECKLIST, 'name', checklistName, 'state', Constants.ChecklistStates.Archive.TEXT, 'create_time')[0] Click.id("checklist-" + checklist_uuid, True)
def test_ns_choose_all_vf_gitlab_repo_files_via_select_all(self): self.user_content['session_token'] = "token " + \ API.User.login_user(self.user_content['el_email']) API.GitLab.git_clone_push(self.user_content) API.Checklist.create_checklist(self.user_content) FEUser.login(self.user_content['el_email'], Constants.Default.Password.TEXT) FEOverview.click_on_vf(self.user_content) Frontend.Checklist.get_to_create_new_ns_modal_via_overview() FENextStep.check_select_deselect_all_files()
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 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 validate_filtering_by_stage_with_page_ids(user_content, stage): FEOverview.click_on_vf(user_content) Click.id(Constants.Dashboard.Statuses.ID) # Stage Active Validation # Wait.text_by_id("dashboard-title", "Statuses") Wait.id(Constants.Dashboard.Statuses.FilterDropdown.ID) Select( session.ice_driver.find_element_by_id( Constants.Dashboard.Statuses.FilterDropdown.ID) ).select_by_visible_text("Intake") Wait.page_has_loaded() Select( session.ice_driver.find_element_by_id( Constants.Dashboard.Statuses.FilterDropdown.ID) ).select_by_visible_text(stage) Wait.id(Constants.Dashboard.Statuses.ExportExcel.ID, wait_for_page=True) countIdsActive = 0 engLeadID = DBUser.select_user_native_id(user_content['el_email']) 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 if countOfEngInStagePerUser <= NUM_OF_RESULTS_PER_PAGES: number_of_pages = 1 if number_of_pages == 1: # Count all engagements on current page logger.debug("Number of pages: " + str(number_of_pages)) ids = session.ice_driver.find_elements_by_xpath('//*[@id]') for ii in ids: if "starred-" in ii.get_attribute('id'): # Print ii.tag_name (id name as string). logger.debug(ii.get_attribute('id')) countIdsActive += 1 Wait.id(Constants.Dashboard.Statuses.ExportExcel.ID) if countIdsActive == countOfEngInStagePerUser: logger.debug("result right") else: 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") element = session.ice_driver.find_element_by_id( "engagements-pagination") element.location_once_scrolled_into_view if number_of_pages > 1: Click.link_text(str(number_of_pages), wait_for_page=True)
def create_cl_without_files(user_content): FEOverview.click_on_vf(user_content) Click.id("checklist-plus-" + user_content['engagement_uuid']) Wait.id(Constants.Dashboard.Modal.CLOSE_BUTTON_ID) checklistName = "NoAssociatedFiles" + \ Helper.rand_string("randomString") Enter.text_by_name("checkListName", checklistName) Wait.xpath("//select") if settings.DATABASE_TYPE == 'local': Select(session.ice_driver.find_element_by_xpath( "//select")).select_by_visible_text( Constants.Template.Heat.TEXT) else: Click.xpath("//select") Click.xpath("//option[2]") Click.id(Constants.Dashboard.LeftPanel.CreateChecklist.ID) Wait.text_by_id(Constants.Dashboard.Checklist.Name.ID, checklistName)
class Frontend: User = FEUser() Invite = FEInvite() Checklist = FEChecklist() Dashboard = FEDashboard() DetailedView = FEDetailedView() General = FEGeneral() Overview = FEOverview() Wizard = FEWizard() Cms = FECms() ChecklistTemplate = FEChecklistTemplate()