def edit_template_and_save(): Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. FIRST_SECTION_ID) Enter.text_by_id( Constants.Dashboard.LeftPanel.EditChecklistTemplate. FIRST_SECTION_INPUT_ID, "Ros Is My Mentor") FEChecklistTemplate.click_on_save_and_assert_success_msg()
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 click_on_admin(): try: Click.id(Constants.Dashboard.Avatar.Admin.Title.ID, wait_for_page=True) except Exception as e: errorMsg = "Failed to click_on on Admin." raise Exception(errorMsg, e)
def click_on_update_ecomp_release(): Click.id(Constants.Dashboard.DetailedView.ValidationDetails.PLUS, wait_for_page=True) Wait.text_by_id( Constants.Dashboard.Modal.TITLE_ID, Constants.Dashboard.DetailedView.ValidationDetails.TITLE, wait_for_page=True)
def open_validation_details(): Click.id(Constants.Dashboard.DetailedView.ValidationDetails.PLUS, wait_for_page=True) Wait.text_by_id( Constants.Dashboard.Modal.TITLE_ID, Constants.Dashboard.DetailedView.ValidationDetails.TITLE, wait_for_page=True)
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 remove_vfc(user_content): vf_id = DBGeneral.select_where("uuid", "ice_vf", "name", user_content['vfName'], 1) djoni_uuid = None counter = 0 while not djoni_uuid and counter <= Constants.DBConstants.\ RETRIES_NUMBER: time.sleep(session.wait_until_time_pause_long) djoni_uuid = DBGeneral.select_where_and("uuid", "ice_vfc", "vf_id", vf_id, "name", "djoni", 1) logger.debug("Checklist state not changed yet (%s of %s)" % (counter, Constants.DBConstants.RETRIES_NUMBER)) counter += 1 logger.debug("VFC_UUID was successfully selecteded : " + djoni_uuid + ", and was verified over the DB") Wait.text_by_id(Constants.Dashboard.DetailedView.VFC.ID + "djoni", "djoni (loka)", wait_for_page=True) Wait.text_by_id(Constants.Dashboard.DetailedView.VFC.ID + "djoni2", "djoni2 (loka2)", wait_for_page=True) Click.id(Constants.Dashboard.DetailedView.VFC.ID + "djoni", wait_for_page=True) Click.id(Constants.Dashboard.DetailedView.VFC.Remove.ID + djoni_uuid, wait_for_page=True)
def get_to_create_new_ns_modal_via_overview(): Click.id(Constants.Dashboard.Overview.NextSteps.Add.ID, wait_for_page=True) Wait.text_by_css(Constants.Dashboard.Checklist.AddNS.CSS, Constants.Dashboard.Overview.NextSteps.Add.TITLE) Helper.internal_assert(Constants.Dashboard.Checklist.AddNS.TITLE, Get.by_css(Constants.FEGeneral.CSS.H2))
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 test_invite_existing_user(self): ''' Create user and VF, login, invite existing user, login with second user and verify user has joined to engagement ''' user_content = API.VirtualFunction.create_engagement( wait_for_gitlab=False) second_user_content = API.VirtualFunction.create_engagement( wait_for_gitlab=False) activationUrl = DB.User.get_activation_url(user_content['email']) Frontend.General.re_open(activationUrl) Frontend.User.login(user_content['email'], Constants.Default.Password.TEXT) vfFullName = user_content[ 'engagement_manual_id'] + ": " + user_content['vfName'] actualVfNameid = "clickable-" + vfFullName Click.id(actualVfNameid, wait_for_page=True) Wait.id(Constants.Dashboard.Overview.TeamMember.ID) Frontend.Wizard.invite_team_members_modal(second_user_content['email']) enguuid = DB.General.select_where( "uuid", "ice_engagement", "engagement_manual_id", user_content['engagement_manual_id'], 1) # Fetch one is_service_provider_contact user ID. invitation_token = DB.User.select_invitation_token( "invitation_token", "ice_invitation", "engagement_uuid", enguuid, second_user_content['email'], 1) inviterURL = Constants.Default.InviteURL.Login.TEXT + invitation_token Frontend.General.re_open(inviterURL) actualVfNameid = "clickable-" + vfFullName Frontend.User.login(second_user_content['email'], Constants.Default.Password.TEXT, actualVfNameid) Wait.modal_to_dissappear() Frontend.Overview.click_on_vf(user_content) Wait.text_by_id(Constants.Dashboard.Overview.Title.ID, vfFullName)
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 go_to_checklist(engagement_id, cl_uuid): try: Click.id(engagement_id) Click.id("checklist-" + cl_uuid) Wait.id("line-item-description") except Exception as e: errorMsg = "Failed to go to checklist page." raise Exception(errorMsg, e)
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 test_login_page_dont_have_accaunt_button(self): ''' Go to login page, click_on on "Don't have an account", verify user is redirected to signup page. ''' Click.id(Constants.Login.DontHaveAccount.ID) Wait.text_by_css(Constants.Signup.Title.CSS, Constants.Signup.Title.TEXT)
def check_select_deselect_all_files(): Click.id(Constants.Dashboard.Overview.NextSteps.Add.AssociatedFiles.ID) Click.link_text(Constants.Dashboard.Overview.NextSteps.Add. AssociatedFiles.SELECT_ALL_FILES_NAME) Wait.text_by_id( Constants.Dashboard.Overview.NextSteps.Add.AssociatedFiles.ID, Constants.Dashboard.Overview.NextSteps.Add.AssociatedFiles. ALL_FILES_SELECTED)
def open_documentation(title): try: Click.id("documentation", wait_for_page=True) Wait.id("search-doc") Wait.text_by_id(title, title, wait_for_page=True) except Exception as e: errorMsg = "Failed to go to Announcement page." raise Exception(errorMsg, e)
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 go_to_user_profile_settings(): FEUser.go_to_account() Click.id(Constants.Dashboard.Avatar.Account.UserProfileSettings.ID, wait_for_page=True) Wait.text_by_id( Constants.Dashboard.Avatar.Account.UserProfileSettings.TitleID, Constants.Dashboard.Avatar.Account.UserProfileSettings.TitleText, wait_for_page=True)
def delete_notification(notificationID): if isinstance(notificationID, tuple): notificationID = notificationID[0] delete_button = Constants.Dashboard.Avatar.Notifications.\ DeleteNotification.ID + notificationID # Click on delete button. Click.id(delete_button, wait_for_page=True) Wait.id_to_dissappear(delete_button)
def update_cl_associated_files(engagement_manual_id): Click.id("edit-checklist", True) Wait.text_by_id("modal-header-checklist-15", "Update Checklist") # Select associated files from multi-select drop-down. Click.xpath("//multiselect/div/button") Click.link_text("file2") Click.xpath("//multiselect/div/button") Click.css(Constants.SubmitButton.CSS) Wait.id(engagement_manual_id, True)
def add_lineitem_and_check_db(): Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. FIRST_SECTION_ID) Enter.text_by_id( Constants.Dashboard.LeftPanel.EditChecklistTemplate. FIRST_SECTION_INPUT_ID, "Ros Is My Mentor") FEChecklistTemplate.click_on_save_and_assert_success_msg() result = DBChecklist.checkChecklistIsUpdated() Helper.internal_not_equal(result, None)
def click_on_export_excel(user_content): Enter.text_by_id(Constants.Dashboard.Statuses.SearchBox.ID, user_content['vfName']) engName = user_content['engagement_manual_id'] + ": " + user_content[ 'vfName'] engSearchID = "eng-" + engName Wait.id(engSearchID) # Find the download link and click it Click.id(Constants.Dashboard.Statuses.ExportExcel.ID)
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 add_feedback(): Wait.css("textarea[name=\"description\"]", wait_for_page=True) description = Helper.rand_string("randomString") Enter.text_by_css("textarea[name=\"description\"]", description) Click.id(Constants.Dashboard.Feedback.FeedbackModal.SAVE_BTN_ID, wait_for_page=True) Wait.text_by_id(Constants.Toast.ID, "Feedback was sent successfully.", wait_for_page=True) return description
def del_lineitem_and_save(): Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. FIRST_SECTION_ID, wait_for_page=True) Enter.text_by_id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. FIRST_SECTION_INPUT_ID, "Ros Is My Mentor", wait_for_page=True) Click.id(Constants.Dashboard.LeftPanel.EditChecklistTemplate. FIRST_SECTION_ID) FEChecklistTemplate.click_on_save_and_assert_success_msg()
def statuses_search_vf(engagement_manual_id, vf_name): engName = engagement_manual_id + ": " + vf_name # Search by VF name. Enter.text_by_id(Constants.Dashboard.Statuses.SearchBox.ID, vf_name, wait_for_page=True) Wait.id("eng-" + engName, wait_for_page=True) Click.id("eng-" + engName, wait_for_page=True) Wait.text_by_id(Constants.Dashboard.Overview.Title.ID, engName, wait_for_page=True)
def search_documentation_content(title, content): FEDashboard.open_documentation(title) Wait.text_by_id(title, title) logger.debug("Search Documentation by content") Enter.text_by_id(Constants.Cms.SearchDocumentation, content, wait_for_page=True) Wait.text_by_id(title, title) Click.id(title, wait_for_page=True) Wait.text_by_css(Constants.Cms.DocumentationPageContent, content) logger.debug("Documentation found (searched by content)")
def search_documentation_title(title, user_content): FEDashboard.open_documentation(title) Wait.text_by_id(title, title) logger.debug("Search Documentation by title") Enter.text_by_id(Constants.Cms.SearchDocumentation, title, wait_for_page=True) Wait.text_by_id(title, title) Click.id(title, wait_for_page=True) Wait.text_by_id(title, title) logger.debug("Documentation found (searched by title)")
def click_on_save_and_assert_success_msg(): Click.id( Constants.Dashboard.LeftPanel.EditChecklistTemplate.SAVE_BTN_ID, wait_for_page=True) Click.id( Constants.Dashboard.LeftPanel.EditChecklistTemplate.APPROVE_BTN_ID, wait_for_page=True) Wait.text_by_id( Constants.Dashboard.LeftPanel.EditChecklistTemplate.SUCCESS_ID, Constants.Dashboard.LeftPanel.EditChecklistTemplate. SUCCESS_SAVE_MSG)
def add_vfc(): vfcName = "VFC-" + Helper.rand_string("randomString") Click.id(Constants.Dashboard.DetailedView.VFC.Add.ID) Enter.text_by_name("name", vfcName) session.ice_driver.find_element_by_name("extRefID").click() Enter.text_by_name("extRefID", Helper.rand_string("randomNumber")) Select( session.ice_driver.find_element_by_id( Constants.Dashboard.DetailedView.VFC.Choose_Company.ID) ).select_by_visible_text(ServiceProvider.MainServiceProvider) Click.id(Constants.Dashboard.DetailedView.VFC.Save_button.ID) return vfcName