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 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 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 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 search_by_manual_id(manual_id): Enter.text_by_id(Constants.Dashboard.LeftPanel.SearchBox.ID, manual_id, wait_for_page=True) Click.css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS, wait_for_page=True) Wait.id(Constants.Dashboard.Overview.Title.ID)
def clear(attr_id_value): try: Wait.id(attr_id_value) session.ice_driver.find_element_by_id(attr_id_value).clear() except Exception: errorMsg = "Failed to clear text box" raise Exception(errorMsg, attr_id_value)
def search_in_left_searchbox_by_param(manual_id, vf_name, param): myVfName = manual_id + ": " + vf_name Enter.text_by_xpath( Constants.Dashboard.LeftPanel.SearchBox.Results.XPATH, param) Wait.text_by_css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS, myVfName) Click.css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS)
def meta_order_by_id(attr_id_value): try: Wait.id(attr_id_value) return session.ice_driver.find_element_by_id( attr_id_value).get_attribute("meta-order") except Exception: errorMsg = "Failed to get meta order by id:" + attr_id_value raise Exception(errorMsg, attr_id_value)
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 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 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 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 go_to_notifications(): try: FEUser.click_on_avatar() FEUser.click_on_notifications() Wait.page_has_loaded() except Exception as e: errorMsg = "Failed to go to Notifications page." raise Exception(errorMsg, e)
def click_on_account(): try: Click.link_text(Constants.Dashboard.Avatar.Account.LINK_TEXT) Wait.text_by_css(Constants.Dashboard.Avatar.Account.Title.CSS, Constants.Dashboard.Avatar.Account.Title.TEXT) except Exception as e: errorMsg = "Failed to click_on on Admin." raise Exception(errorMsg, e)
def search_by_vfname_for_not_local(user_content): vfFullName = user_content[ 'engagement_manual_id'] + ": " + user_content['vfName'] if settings.DATABASE_TYPE != 'local': Enter.text_by_id(Constants.Dashboard.LeftPanel.SearchBox.ID, user_content['vfName']) Click.css(Constants.Dashboard.LeftPanel.SearchBox.Results.CSS) Wait.text_by_id(Constants.Dashboard.Overview.Title.ID, vfFullName)
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 refresh(): try: session.ice_driver.refresh() Wait.page_has_loaded() except Exception as e: errorMsg = "Could not refresh the page." logger.error(errorMsg) raise Exception(errorMsg, e)
def test_login_positive(self): ''' Create new user login. ''' user_content = API.User.create_new_user() Frontend.User.login(user_content['email'], Constants.Default.Password.TEXT, Constants.Toast.ID) logger.debug("Resend Activation Email Page Opened ") Wait.text_by_id(Constants.Toast.ID, Constants.ActivateAccount.Toast.TEXT)
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 test_entering_engagement_from_dashboard(self): Wait.text_by_id(self.left_panel_eng_id, self.eng_title) DB.VirtualFunction.remove_engagement_from_recent( self.user_content['vf_uuid']) Frontend.General.refresh() Frontend.Dashboard.statuses_search_vf( self.user_content['engagement_manual_id'], self.user_content['vfName']) Wait.text_by_id(self.left_panel_eng_id, self.eng_title)
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_login_negative_required_password(self): ''' Check that password is a required field on login page. ''' user_content = API.User.create_new_user() logger.debug("Verifying and Insert Login page elements:") Enter.text_by_name(Constants.Login.Email.NAME, user_content['email']) Enter.text_by_name(Constants.Login.Password.NAME, "1") Enter.text_by_name(Constants.Login.Password.NAME, "") Wait.text_by_css(Constants.Login.Password.Error.CSS, Constants.Login.Password.Error.TEXT)
def test_login_negative_email_valid(self): ''' Negative: Type wrong password in login page. ''' user_content = API.User.create_new_user(activate=True) Frontend.User.login(user_content['email'] + "s", Constants.Default.Password.TEXT, Constants.Toast.ID) Wait.text_by_id(Constants.Toast.ID, Constants.Login.Toast.TEXT) logger.debug( "Message Error(APIUser or Password does not match) Displayed")
def test_login_negative(self): ''' Negative: Type wrong password in login page. ''' user_content = API.User.create_new_user(activate=True) Frontend.User.login(user_content['email'], Helper.rand_string("randomString"), Constants.Toast.ID) Wait.text_by_id(Constants.Toast.ID, Constants.Login.Toast.TEXT) logger.debug( "Message Error(APIUser or Password does not match) Displayed")
def validate_grandchild_page(parent_title, child_title, grand_child_title, description): Click.id(Constants.Cms.Documentation) Click.id(parent_title) Click.id(child_title) Click.id(grand_child_title) Wait.text_by_id("center-" + grand_child_title, grand_child_title) page_id = DBCMS.get_last_inserted_page_id() Wait.text_by_id(page_id, description)