Example #1
0
 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)
Example #2
0
 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)
Example #3
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)
Example #4
0
 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)
Example #5
0
 def activate_and_login(
         email,
         password,
         expected_element=Constants.Dashboard.Statuses.Title.ID,
         element_type="id"):
     activationUrl = DBUser.get_activation_url(email)
     FEGeneral.re_open(activationUrl)
     FEUser.login(email, password, expected_element, element_type)
 def validations_for_user2(user_content, inviteEmail, vflist):
     # Fetch one AT&T user ID.
     engagement_id = DBGeneral.select_where("engagement_id", "ice_vf",
                                            "name", vflist[0], 1)
     engagement_manual_id = DBGeneral.select_where("engagement_manual_id",
                                                   "ice_engagement", "uuid",
                                                   engagement_id, 1)
     engLeadEmail = DBUser.select_el_email(vflist[0])
     user_content['engagement_uuid'] = engagement_id
     user_content['el_email'] = engLeadEmail
     uuid = DBGeneral.select_where_email("uuid", "ice_user_profile",
                                         user_content['email'])
     sponsor = [
         ServiceProvider.MainServiceProvider, 'aaaaaa', inviteEmail,
         '3058000000'
     ]
     invitation_token = DBUser.select_invitation_token(
         "invitation_token", "ice_invitation", "engagement_uuid",
         engagement_id, inviteEmail, 1)
     signUpURLforContact = DBUser.get_contact_signup_url(
         invitation_token, uuid, sponsor[2], sponsor[1], sponsor[3],
         sponsor[0])
     APIUser.signup_invited_user(sponsor[0],
                                 inviteEmail,
                                 invitation_token,
                                 signUpURLforContact,
                                 user_content,
                                 True,
                                 wait_for_gitlab=False)
     activationUrl2 = DBUser.get_activation_url(sponsor[2])
     FEGeneral.re_open(activationUrl2)  # Login with 2nd user    #
     engName = engagement_manual_id + ": " + vflist[0]
     title_id = "clickable-" + engName
     FEUser.login(inviteEmail, Constants.Default.Password.TEXT, title_id)
     for vfName in vflist:
         # Fetch one AT&T user ID.
         engagement_id = DBGeneral.select_where("engagement_id", "ice_vf",
                                                "name", vfName, 1)
         engagement_manual_id = DBGeneral.select_where(
             "engagement_manual_id", "ice_engagement", "uuid",
             engagement_id, 1)
         engName = engagement_manual_id + ": " + vfName
         vf_left_nav_id = "clickable-" + engName
         Click.id(vf_left_nav_id, wait_for_page=True)
Example #7
0
    def get_or_create_rsa_key_for_admin():
        # Create pair of keys for the given user and return his public key.
        try:
            ssh_folder = Constants.Paths.SSH.PATH
            public_file = ssh_folder + "id_rsa.pub"
            privateFile = ssh_folder + "id_rsa"
            admin_ssh_exist_and_equal = False
            admin_ssh = None
            if not os.path.exists(ssh_folder):
                os.makedirs(ssh_folder)
            elif os.path.exists(public_file):
                admin_ssh = DBUser.retrieve_admin_ssh_from_db()
                admin_ssh_exist_and_equal = Helper.check_admin_ssh_existence(
                    public_file, admin_ssh)
            # TODO find pending gitlab bug causing old ssh key not be updated
            # in gitlab cache
            if False and admin_ssh_exist_and_equal:
                return admin_ssh
            else:
                logger.debug("Private key file: " + privateFile +
                             "\nPublice key file: " + public_file)
                key = rsa.generate_private_key(
                    backend=crypto_default_backend(),
                    public_exponent=65537,
                    key_size=2048)
                private_key = key.private_bytes(
                    crypto_serialization.Encoding.PEM,
                    crypto_serialization.PrivateFormat.PKCS8,
                    crypto_serialization.NoEncryption()).decode("utf-8")
                public_key = key.public_key().public_bytes(
                    crypto_serialization.Encoding.OpenSSH,
                    crypto_serialization.PublicFormat.OpenSSH).decode("utf-8")

                with open(privateFile, 'w') as content_file:
                    os.chmod(privateFile, 0o600)
                    # Save private key to file.
                    content_file.write(private_key)
                logger.debug("Private key created successfully for admin")
                user_pub_key = public_key
                with open(public_file, 'w') as content_file:
                    content_file.write(public_key)  # Save public key to file.
                logger.debug("Public key created successfully for admin")
                cmd = 'ssh-keyscan ' + \
                    settings.GITLAB_URL[7:-1] + ' >> ' + \
                    ssh_folder + 'known_hosts'
                # Create known_hosts file and add GitLab to it.
                subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE)
                logger.debug("Added GitLab to known_hosts")
                return user_pub_key
        except Exception as error:
            logger.error("_-_-_-_-_- Unexpected error in " +
                         "get_or_create_rsa_key_for_admin: %s" % error)
            raise Exception("Failed to create SSH keys for user admin", error)
Example #8
0
 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 test_validate_upload_download_image_with_bucket_user(self):
     bucket, user_content = self.create_bucket_and_validate_users()
     # connect to bucket with specific user
     bucket_id = user_content['engagement_manual_id'] + "_" + user_content[
         'vfName'].lower()
     access_key = DBUser.get_access_key(user_content['uuid'])
     secret_key = DBUser.get_access_secret(user_content['uuid'])
     secret = CryptographyText.decrypt(secret_key)
     bucket_for_specific_user = API.Rados.get_bucketfor_specific_user(
         bucket_id, access_key, secret)
     assertTrue(bucket_for_specific_user is not None)
     # create upload file with user
     str_content = Helper.rand_string("randomString") + Helper.rand_string(
         "randomNumber")
     fileName = Helper.rand_string("randomString")
     key = bucket_for_specific_user.new_key(fileName + '.dat')
     key.set_contents_from_string(str_content)
     pprint(key.generate_url(expires_in=3600))
     #         DOWNLOAD AN OBJECT (TO A FILE)
     key = bucket_for_specific_user.get_key(fileName + '.dat')
     key.get_contents_to_filename('/home/' + fileName + '.dat')
     key.delete()
Example #10
0
 def reject_checklist(newObj, checklistName):
     Click.xpath("//button[2]")
     vfName = newObj[0]
     engLeadFullName = DBUser.get_el_name(vfName)
     Enter.text_by_name(
         Constants.Dashboard.Checklist.Reject.Modal.Comment.NAME,
         "Reject state By :" + engLeadFullName)
     Helper.internal_assert("Checklist: " + checklistName,
                            Get.by_css("span.state-title.ng-binding"))
     Wait.text_by_id(Constants.Dashboard.Checklist.Reject.Modal.Button.ID,
                     Constants.Dashboard.Checklist.Reject.Modal.Button.TEXT)
     Click.id(Constants.Dashboard.Checklist.Reject.Modal.Button.ID)
     Wait.modal_to_dissappear()
Example #11
0
 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 invite_users(user_content):
     engName = user_content[0][
         'engagement_manual_id'] + ": " + user_content[0]['vfName']
     vf_left_nav_id = "clickable-" + engName
     Click.id(vf_left_nav_id)
     FEWizard.invite_team_members_modal(user_content[1]['email'])
     #         self.sleep(1)   # TODO need to wait until modal window is closed.
     invitation_token = DBUser.select_invitation_token(
         "invitation_token", "ice_invitation", "engagement_uuid",
         user_content[0]['engagement_uuid'], user_content[1]['email'], 1)
     inviterURL = Constants.Default.InviteURL.Login.TEXT + invitation_token
     FEGeneral.re_open(inviterURL)
     #    Login with 2nd user    #
     title_id = "title-id-" + engName
     FEUser.login(user_content[1]['email'], Constants.Default.Password.TEXT,
                  title_id)
     Click.id(vf_left_nav_id)
     actualVfName = Get.by_id(vf_left_nav_id)
     Helper.internal_assert(engName, actualVfName)
     Wait.text_by_id(Constants.Dashboard.Overview.Title.ID, engName)
     FEUser.logout()
     return vf_left_nav_id
 def select_personal_next_step(user_email):
     """select_personal_next_step: Originally """ +\
         """can be found under DBUser class."""
     from services.database.db_user import DBUser
     return DBUser.select_personal_next_step(user_email)
Example #14
0
class DB:
    Checklist = DBChecklist()
    Cms = DBCMS()
    General = DBGeneral()
    User = DBUser()
    VirtualFunction = DBVirtualFunction()
Example #15
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
Example #16
0
    def approval_state_actions_and_validations(checklistName, newObj, state):
        #     REWVIEW STEPS AND VALIDATIONS
        try:
            Wait.id("checklist-main-section")
            Wait.text_by_id(Constants.Dashboard.Checklist.Name.ID,
                            checklistName)
            try:
                if settings.DATABASE_TYPE == 'local':
                    Wait.text_by_css("h2.ng-binding",
                                     "Section 1: Parameter Specification")
                    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_xpath("//li[2]/ul/li/span[2]"))
                    Helper.internal_assert(
                        "VF image", Get.by_xpath("//li[2]/ul/li[2]/span[2]"))
            except BaseException:
                if settings.DATABASE_TYPE == 'local':
                    Wait.text_by_css("h2.ng-binding",
                                     "Section 1: External References")
                    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"))
            try:
                if settings.DATABASE_TYPE == 'local':
                    Helper.internal_assert("1.1 - Parameters",
                                           Get.by_xpath("//header/h2"))
            except BaseException:
                if settings.DATABASE_TYPE == 'local':
                    Helper.internal_assert("1.1 - Normal References",
                                           Get.by_xpath("//header/h2"))
            if settings.DATABASE_TYPE == 'local':
                elementTxt = Get.by_id("line-item-description")
                Helper.internal_assert(
                    "Numeric parameters should include " +
                    "range and/or allowed values.", elementTxt)
            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")
            vfName = newObj[0]
            DBUser.get_el_name(vfName)
            Helper.internal_assert(
                localLogText,
                Get.by_css(Constants.Dashboard.Checklist.AuditLog.
                           LastLocalAuditLog.CSS))
            try:
                if settings.DATABASE_TYPE == 'local':
                    Helper.internal_assert(
                        "Parameters", Get.by_xpath("//li[2]/ul/li/span[2]"))
            except BaseException:
                if settings.DATABASE_TYPE == 'local':
                    Helper.internal_assert(
                        "Numeric parameters",
                        Get.by_xpath("//li[2]/ul/li/span[2]"))

            session.run_negative(
                lambda: Wait.css(Constants.Dashboard.Checklist.LineItem.Deny.
                                 CSS) or Wait.css(Constants.Dashboard.Checklist
                                                  .LineItem.Approve.CSS),
                "Buttons displayed for Admin it's NOT work")
            if state == "APPROVAL":
                if settings.DATABASE_TYPE == 'local':
                    Helper.internal_assert(
                        "Audit Log (6)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
                else:
                    Helper.internal_assert(
                        "Audit Log (7)",
                        Get.by_id(Constants.Dashboard.Checklist.AuditLog.ID))
            if state == "HANDOFF":
                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.text_by_xpath("//span[2]", checklistName)
            DBUser.select_el_email(vfName)
            Enter.text_by_xpath("//textarea", "zdfgsdyh")
            Click.css(Constants.SubmitButton.CSS)
            Wait.modal_to_dissappear()
            if state == "APPROVAL":
                if settings.DATABASE_TYPE == 'local':
                    Wait.text_by_id(Constants.Dashboard.Checklist.AuditLog.ID,
                                    "Audit Log (7)")
                else:
                    Wait.text_by_id(Constants.Dashboard.Checklist.AuditLog.ID,
                                    "Audit Log (8)")
            if state == "HANDOFF":
                if settings.DATABASE_TYPE == 'local':
                    Wait.text_by_id(Constants.Dashboard.Checklist.AuditLog.ID,
                                    "Audit Log (9)")
                else:
                    Wait.text_by_id(Constants.Dashboard.Checklist.AuditLog.ID,
                                    "Audit Log (10)")
            if state == "APPROVAL":
                Wait.text_by_xpath("//button[3]", "Add Next Steps")
                Wait.text_by_id(
                    Constants.Dashboard.Checklist.Reject.ID,
                    Constants.Dashboard.Checklist.Reject.Modal.Button.TEXT)
                Wait.text_by_xpath("//div[@id='state-actions']/button",
                                   "Approve")
            if state == "HANDOFF":
                Wait.text_by_xpath("//div[@id='state-actions']/button",
                                   "Handoff complete?")
            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:
            logger.error(
                state +
                " state  FAILED CONNECT TO STAGING MANUAL AND VERIFY WHY! ")
            errorMsg = "approval_state_actions_and_validations " +\
                "FAILED  because : " + str(e)
            raise Exception(errorMsg, "approval_state_actions_and_validations")