Esempio n. 1
0
 def add_vf():
     try:
         logger.debug("Tab Add Virtual Functions")
         Wait.text_by_css(
             Constants.Dashboard.Wizard.Title.CSS,
             Constants.Dashboard.Wizard.AddVF.Title.TEXT,
             wait_for_page=True)
         vfName = "newVF" + Helper.rand_string("randomString")
         vfVersion = "newVFVersion" + \
             Helper.rand_string(
                 "randomNumber") + Helper.rand_string("randomString")
         Enter.text_by_name("virtualFunction", vfName)
         Enter.text_by_name("VFversion", vfVersion, wait_for_page=True)
         FEWizard.date_picker_wizard()
         Select(session.ice_driver.find_element_by_id(
             Constants.Dashboard.Wizard.AddVF.AIC_Version.TEXT
         )).select_by_visible_text("AIC 3.5")
         Select(session.ice_driver.find_element_by_id(
             Constants.Dashboard.Wizard.AddVF.ECOMP_Release.TEXT
         )).select_by_visible_text("Unknown")
         session.E2Edate = FEWizard.get_lab_entry_date()
         Click.css(Constants.SubmitButton.CSS, wait_for_page=True)
         Wait.page_has_loaded()
         Wait.name_to_dissappear("Add Virtual Function")
         return vfName
     # If failed - count the failure and add the error to list of errors.
     except Exception as e:
         errorMsg = "Failed to add a Virtual Function via modal window. " +\
             "Exception " +\
             str(e)
         raise Exception(errorMsg)
Esempio n. 2
0
 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)
Esempio n. 3
0
 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)
Esempio n. 4
0
 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)
Esempio n. 5
0
 def value_by_name(attr_name_value, wait_for_page=False):
     try:
         if wait_for_page:
             Wait.page_has_loaded()
         Wait.name(attr_name_value)
         return session.ice_driver.find_element_by_name(
             attr_name_value).get_attribute("value")
     except Exception:
         errorMsg = "Failed to get value by name:" + attr_name_value
         raise Exception(errorMsg, attr_name_value)
Esempio n. 6
0
 def xpath(element_xpath, wait_for_page=False):
     try:
         if wait_for_page:
             Wait.page_has_loaded()
         Wait.xpath(element_xpath)
         session.ice_driver.find_element_by_xpath(element_xpath).click()
     # If failed - count the failure and add the error to list of errors.
     except Exception as e:
         errorMsg = "Failed to click_on on XPATH " + element_xpath
         raise Exception(errorMsg, e)
Esempio n. 7
0
 def name(element_name, wait_for_page=False):
     try:
         if wait_for_page:
             Wait.page_has_loaded()
         Wait.name(element_name)
         session.ice_driver.find_element_by_name(element_name).click()
     # If failed - count the failure and add the error to list of errors.
     except Exception as e:
         errorMsg = "Failed to click_on on ID " + element_name
         raise Exception(errorMsg, e)
Esempio n. 8
0
 def by_id(attr_id_value, wait_for_page=False):
     try:
         if wait_for_page:
             Wait.page_has_loaded()
         Wait.id(attr_id_value)
         return session.ice_driver.find_element_by_id(attr_id_value).text
     # If failed - count the failure and add the error to list of errors.
     except Exception:
         errorMsg = "Failed to get text of element " + attr_id_value
         raise Exception(errorMsg, attr_id_value)
Esempio n. 9
0
 def is_selected_by_id(attr_id_value, wait_for_page=False):
     try:
         if wait_for_page:
             Wait.page_has_loaded()
         Wait.id(attr_id_value)
         return session.ice_driver.find_element_by_id(
             attr_id_value).is_selected()
     except Exception:
         errorMsg = "Failed to get if it's selected by id:" + attr_id_value
         raise Exception(errorMsg, attr_id_value)
Esempio n. 10
0
 def css(element_css, wait_for_page=False):
     try:
         if wait_for_page:
             Wait.page_has_loaded()
         Wait.css(element_css)
         session.ice_driver.find_element_by_css_selector(
             element_css).click()
     # If failed - count the failure and add the error to list of errors.
     except Exception as e:
         errorMsg = "Failed to click_on on CSS Selector " + element_css
         raise Exception(errorMsg, e)
Esempio n. 11
0
 def link_text(link_inner_text, wait_for_page=False):
     try:
         if wait_for_page:
             Wait.page_has_loaded()
         Wait.link_text(link_inner_text)
         session.ice_driver.find_element_by_link_text(
             link_inner_text).click()
     # If failed - count the failure and add the error to list of errors.
     except Exception as e:
         errorMsg = "Failed to click_on on LINK TEXT " + link_inner_text
         raise Exception(errorMsg, e)
Esempio n. 12
0
 def is_checkbox_selected_by_id(attr_id_value, wait_for_page=False):
     try:
         if wait_for_page:
             Wait.page_has_loaded()
         Wait.id(attr_id_value)
         return Helper.internal_assert_boolean_true_false(
             session.ice_driver.find_element_by_id(
                 attr_id_value).get_attribute("value"), "on")
     except Exception:
         errorMsg = "Failed to get if it's selected by id:" + attr_id_value
         raise Exception(errorMsg, attr_id_value)
Esempio n. 13
0
 def date_picker(selector, property_name, wait_for_page=False):
     try:
         if wait_for_page:
             Wait.page_has_loaded()
         session.ice_driver.execute_script(
             "var element = angular.element(document." +
             "querySelector('" + selector + "')); element.scope()." +
             property_name + " = new Date('" +
             str(datetime.today().isoformat()) + "')")
     except Exception as e:
         errorMsg = "Failed to select date with datePicker."
         raise Exception(errorMsg, str(e))
Esempio n. 14
0
 def validate_user_profile_settings_in_db(user_email, checked):
     Wait.page_has_loaded()
     regular_email_updates = DBUser.select_user_profile_property(
         user_email, 'regular_email_updates')
     DBBridge.helper_internal_assert(regular_email_updates, checked)
     email_updates_on_every_notification = \
         DBUser.select_user_profile_property(
             user_email, 'email_updates_on_every_notification')
     DBBridge.helper_internal_assert(
         email_updates_on_every_notification, checked)
     email_updates_daily_digest = DBUser.select_user_profile_property(
         user_email, 'email_updates_daily_digest')
     DBBridge.helper_internal_assert(
         email_updates_daily_digest, not checked)
Esempio n. 15
0
 def re_open(reopen_url):
     try:
         logger.debug("Reopen URL: " + reopen_url)
         session.ice_driver.get('javascript:localStorage.clear();')
         session.ice_driver.get('javascript:sessionStorage.clear();')
         session.ice_driver.delete_all_cookies()
         # Open FireFox with requested URL.
         session.ice_driver.get("about:blank")
         # Open FireFox with requested URL.
         session.ice_driver.get(reopen_url)
         session.ice_driver.maximize_window()
         Wait.page_has_loaded()
     except Exception:
         errorMsg = "Could not reopen requested page"
         raise Exception(errorMsg, reopen_url)
Esempio n. 16
0
 def smart_refresh():
     session.ice_driver.refresh()
     i = 0
     success = False
     while not success and i < 2:
         try:
             Wait.page_has_loaded()
             success = True
             break
         except Exception:
             i += 1
             time.sleep(1)
             pass
     if not success:
         raise Exception("Failed to wait for refresh")
Esempio n. 17
0
 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)
Esempio n. 18
0
 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)
Esempio n. 19
0
 def validate_user_profile_settings_checkboxes(checked):
     Wait.page_has_loaded()
     receive_emails = Get.is_selected_by_id(
         Constants.Dashboard.Avatar.Account.UserProfileSettings.
         ReceiveEmailsID, True)
     Helper.internal_assert(receive_emails, checked)
     Get.is_selected_by_id(
         Constants.Dashboard.Avatar.Account.UserProfileSettings.
         ReceiveNotificationsID, True)
     receive_email_every_time = Get.is_selected_by_id(
         Constants.Dashboard.Avatar.Account.UserProfileSettings.
         ReceiveEmailEveryTimeID, True)
     Helper.internal_assert(receive_email_every_time, checked)
     receive_digest_email = Get.is_selected_by_id(
         Constants.Dashboard.Avatar.Account.UserProfileSettings.
         ReceiveDigestEmailID, True)
     Helper.internal_assert(receive_digest_email, not checked)
Esempio n. 20
0
 def text_by_id(attr_id_value, typed_text, wait_for_page=False):
     # Send keys to element in UI, by ID locator (e.g. type something in
     # text box).
     try:
         if wait_for_page:
             Wait.page_has_loaded()
         Wait.id(attr_id_value)
         session.ice_driver.find_element_by_id(attr_id_value).clear()
         session.ice_driver.find_element_by_id(
             attr_id_value).send_keys(typed_text[:-1])
         time.sleep(session.wait_until_time_pause)
         session.ice_driver.find_element_by_id(
             attr_id_value).send_keys(typed_text[-1:])
     # If failed - count the failure and add the error to list of errors.
     except Exception:
         errorMsg = "Failed to type " + typed_text + " in text box"
         raise Exception(errorMsg, attr_id_value)
Esempio n. 21
0
 def test_next_step_with_associated_files(self):
     user_content = API.VirtualFunction.create_engagement()
     API.GitLab.git_clone_push(user_content)
     user_content['session_token'] = "token " + \
         API.User.login_user(user_content['el_email'])
     Wait.page_has_loaded()
     cl_content = API.Checklist.create_checklist(user_content)
     DB.Checklist.state_changed(
         "name", cl_content['name'], Constants.ChecklistStates.Review.TEXT)
     new_cl_uuid = DB.Checklist.get_recent_checklist_uuid(
         cl_content['name'])[0]
     API.Checklist.add_checklist_next_step(user_content, new_cl_uuid)
     Frontend.User.login(
         user_content['pr_email'], Constants.Default.Password.TEXT)
     Frontend.Overview.click_on_vf(user_content)
     Frontend.Overview.next_steps_filter_by_files()
     Frontend.Overview.validate_associated_files(
         Constants.Dashboard.Overview.NextSteps.
         FilterByFileDropDown.FILE0_LINK_TEXT)