Example #1
0
 def by_xpath(attr_name_value):
     try:
         Wait.xpath(attr_name_value)
         return session.ice_driver.find_element_by_xpath(
             attr_name_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_name_value
         raise Exception(errorMsg, attr_name_value)
Example #2
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)
Example #3
0
 def text_by_xpath(attr_xpath_value, typed_text, wait_for_page=False):
     # Send keys to element in UI, by name locator (e.g. type something in
     # text box).
     try:
         if wait_for_page:
             Wait.page_has_loaded()
         Wait.xpath(attr_xpath_value)
         session.ice_driver.find_element_by_xpath(attr_xpath_value).clear()
         session.ice_driver.find_element_by_xpath(
             attr_xpath_value).send_keys(typed_text[:-1])
         time.sleep(session.wait_until_time_pause)
         session.ice_driver.find_element_by_xpath(
             attr_xpath_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_xpath_value)
Example #4
0
 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)
 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)
Example #6
0
    def create_checklist(engagement_id, vfName, actualVfName,
                         engagement_manual_id):
        try:
            checklistName = Helper.rand_string("randomString")
            Wait.id("checklist-plus-" + engagement_id, wait_for_page=True)

            Click.id("checklist-plus-" + engagement_id, wait_for_page=True)

            Helper.internal_assert("Create Checklist",
                                   Get.by_id("modal-header-checklist-15"))
            # vm.checkListName
            Enter.text_by_name("checkListName",
                               checklistName,
                               wait_for_page=True)
            Wait.xpath("//select")

            Select(
                session.ice_driver.find_element_by_id(
                    Constants.Template.Subtitle.SelectTemplateTitle.TEXT)
            ).select_by_visible_text(Constants.Template.Heat.TEXT)
            Click.id(Constants.Template.Heat.TEXT, wait_for_page=True)
            #             Click.css("option.ng-binding.ng-scope")
            Helper.internal_assert(
                "Associate Files",
                Get.by_id("associated-files-title", wait_for_page=True))
            Click.xpath("//multiselect/div/button", wait_for_page=True)
            Click.link_text("file0", wait_for_page=True)
            Click.link_text("file1")
            Wait.text_by_css(Constants.SubmitButton.CSS, "Create Checklist")
            Click.id(Constants.Dashboard.LeftPanel.CreateChecklist.ID)
            Wait.modal_to_dissappear()
            Wait.id(engagement_manual_id)
            return checklistName
        # 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_checklist")
Example #7
0
 def add_next_step_updated(checklistName, newFileName):
     Click.id(Constants.Dashboard.Checklist.AddNS.ID)
     Wait.id(Constants.Dashboard.Modal.CLOSE_BUTTON_ID)
     Wait.text_by_css("span.font_header.ng-binding", "Checklist:")
     Wait.text_by_css("h2.ng-binding", "Add Next Steps")
     # First NS
     Click.id("description")
     Enter.text_by_id("description", "description of NS")
     Click.css("div.modal-content")
     Click.xpath("(//button[@type='button'])[10]")
     Click.link_text(newFileName)
     Click.css("div.modal-content")
     Click.xpath("(//button[@type='button'])[11]")
     try:
         Click.xpath("//div[3]/multiselect/div/ul/li/a")
     except BaseException:
         Wait.link_text("Homer Simpson")
         Click.link_text("Homer Simpson")
     Wait.css("div.modal-content")
     Click.css("div.modal-content")
     Wait.xpath("(//button[@type='button'])[12]")
     count = 0
     FEWizard.date_picker_add_ns(count)
     count = +1
     Click.css("span.add-text")
     Click.xpath("(//div[@id='description'])[2]")
     Enter.text_by_xpath("(//div[@id='description'])[2]",
                         "description of NS2")
     Click.css("div.modal-content")
     Click.xpath("(//button[@type='button'])[14]")
     Click.xpath("(//button[@type='button'])[22]")
     Click.xpath("//div[3]/div/div[2]/multiselect/div/ul/li[2]/a")
     Click.css("div.modal-content")
     Click.xpath("(//button[@type='button'])[23]")
     Click.css("div.btn-group.open > ul.dropdown-menu > " +
               "li.ng-scope > a.ng-binding")
     Click.link_text("Add Another Next Step")
     Wait.xpath("(//button[@type='button'])[25]")
     Click.xpath("(//button[@type='button'])[25]")
     Wait.xpath("(//button[@type='button'])[24]")
     FEWizard.date_picker_add_ns(count)
     Wait.xpath("//div[4]/div/span")
     Click.xpath("//div[4]/div/span")
     Wait.id("btn-submit")
     Wait.text_by_id("btn-submit", "Submit Next Steps")
     Click.id("btn-submit")
Example #8
0
    def review_state_actions_and_validations(checklistName, vfName, state):
        try:
            #    REWVIEW STEPS AND VALIDATIONS
            Wait.id("checklist-main-section")
            Wait.text_by_id(Constants.Dashboard.Checklist.Name.ID,
                            checklistName)
            try:
                if settings.DATABASE_TYPE == 'local':
                    Helper.internal_assert(
                        "Section 1: Parameter Specification",
                        Get.by_css("h2.ng-binding"))
                    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_name("Normal references"))
                    Helper.internal_assert("VF image",
                                           Get.by_name("Normal references"))
            except BaseException:
                try:
                    Helper.internal_assert("Section 1: External References",
                                           Get.by_css("h2.ng-binding"))
                except BaseException:
                    Helper.internal_assert("Section 1: Scaling Considerations",
                                           Get.by_css("h2.ng-binding"))
                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"))
                Click.name("VF image")
                Click.name("Normal references")
                try:
                    Helper.internal_assert("1.1 - Parameters",
                                           Get.by_xpath("//header/h2"))
                except BaseException:
                    text = Get.by_name("Normal references")
                    Helper.internal_assert("Normal references", text)
            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")
            #    Validate Local AuditLog
            engLeadFullName = DBUser.get_el_name(vfName)
            Helper.internal_assert(
                engLeadFullName,
                Get.by_xpath("//ul[@id='audit-log-list']/li/h4"))
            Helper.internal_assert(
                localLogText,
                Get.by_css(Constants.Dashboard.Checklist.AuditLog.
                           LastLocalAuditLog.CSS))
            if settings.DATABASE_TYPE == 'local':
                try:
                    Helper.internal_assert(
                        "Parameters", Get.by_xpath("//li[2]/ul/li/span[2]"))
                except BaseException:
                    Helper.internal_assert(
                        "Numeric parameters",
                        Get.by_xpath("//li[2]/ul/li/span[2]"))
                Click.name("Normal references")
                Wait.css(Constants.Dashboard.Checklist.LineItem.Deny.CSS)
                Wait.css(Constants.Dashboard.Checklist.LineItem.Approve.CSS)
                Click.css(Constants.Dashboard.Checklist.LineItem.Approve.CSS)
            # NOT LOCAL
            if settings.DATABASE_TYPE != 'local':
                checklistUuid = DBChecklist.get_recent_checklist_uuid(
                    checklistName)[0]
                DBChecklist.update_all_decisions_to_approve(checklistUuid)
            # NOT LOCAL

            Click.css(".line-item-row span.manual")
            print("click on V button approve of decision in state = " + state)
            try:
                Wait.css("li.not-relevant-btn")
            except BaseException:
                Wait.xpath("//aside/header/ul/li")
            if state == "review":
                Wait.id("edit-checklist")
            if state == "PEER":
                if settings.DATABASE_TYPE == 'local':
                    Helper.internal_assert(
                        "Audit Log (4)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
                else:
                    Helper.internal_assert(
                        "Audit Log (5)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
            if state == "review":
                if settings.DATABASE_TYPE == 'local':
                    Helper.internal_assert(
                        "Audit Log (2)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
                else:
                    Helper.internal_assert(
                        "Audit Log (3)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
            if state == "APPROVAL":
                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_for_page=True)
            Wait.text_by_xpath("//span[2]", checklistName)
            Enter.text_by_xpath("//textarea", "zdfgsdyh")
            Click.css(Constants.SubmitButton.CSS)
            Wait.modal_to_dissappear()
            if state == "review":
                if settings.DATABASE_TYPE == 'local':
                    Helper.internal_assert(
                        "Audit Log (3)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
                else:
                    Helper.internal_assert(
                        "Audit Log (4)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
            if state == "PEER":
                if settings.DATABASE_TYPE == 'local':
                    Helper.internal_assert(
                        "Audit Log (5)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
                else:
                    Helper.internal_assert(
                        "Audit Log (6)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
            if state == "APPROVAL":
                if settings.DATABASE_TYPE == 'local':
                    Helper.internal_assert(
                        "Audit Log (9)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
                else:
                    Helper.internal_assert(
                        "Audit Log (10)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
            #    Validate Buttons
            if settings.DATABASE_TYPE != 'local':
                FEGeneral.refresh()
                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
                Click.id(actualVfNameid)
                Click.id("checklist-" + checklistUuid)
            Helper.internal_assert("Add Next Steps",
                                   Get.by_xpath("//button[3]"))
            Wait.text_by_id(
                Constants.Dashboard.Checklist.Reject.ID,
                Constants.Dashboard.Checklist.Reject.Modal.Button.TEXT,
                wait_for_page=True)
            Helper.internal_assert(
                "Approve", Get.by_xpath("//div[@id='state-actions']/button"))
            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:
            errorMsg = "review_state_actions_and_validations " +\
                "FAILED because: " + str(e)
            raise Exception(errorMsg, "review_state_actions_and_validations")
            logger.error(
                state +
                " state FAILED CONNECT TO STAGING MANUAL AND VERIFY WHY!")
            raise