def test_create_2_new_users(self):
     '''
     Login and activate new user,
     than reopen browser and loging with new other user -
     check wizard appears for both Frontend.User.
     '''
     # First APIUser
     user_content = API.User.create_new_user()
     logger.debug(user_content['email'])
     activationUrl = DB.User.get_activation_url(user_content['email'])
     logger.debug(activationUrl)
     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()
     # Second APIUser
     user_content = API.User.create_new_user()
     logger.debug(user_content['email'])
     activationUrl2 = DB.User.get_activation_url(user_content['email'])
     logger.debug(activationUrl2)
     Frontend.General.re_open_not_clean_cache(activationUrl2)
     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()
     Click.id(Constants.Dashboard.Avatar.ID)
 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 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)
Exemplo n.º 4
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()
Exemplo n.º 5
0
 def invite_team_members_modal(email, wait_modal_to_disappear=True):
     try:
         Click.id(
             Constants.Dashboard.Overview.TeamMember.ID,
             wait_for_page=True)
         Wait.text_by_css(
             Constants.Dashboard.Wizard.Title.CSS,
             Constants.Dashboard.Wizard.InviteTeamMembers.Title.TEXT)
         Enter.text_by_name("email", email)
         Wait.text_by_css(
             Constants.SubmitButton.CSS,
             Constants.Dashboard.Wizard.InviteTeamMembers.Button.TEXT)
         Click.css(".inviteMembers-form button.btn.btn-primary", True)
         if wait_modal_to_disappear:
             Wait.modal_to_dissappear()
     # If failed - count the failure and add the error to list of errors.
     except Exception as e:
         errorMsg = "FAILED in PopUp Invite Team Members. Exception=" + \
             str(e)
         raise Exception(errorMsg)
Exemplo n.º 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")
Exemplo n.º 7
0
    def test_invite_new_user(self):
        """
        Name:
            test_invite_new_user
        Steps:
            Create new APIUser via SignUp request-->Login with This One-->
             build "activationUrl"-->
            Validation of successful activate-->
            close Wizard --> Logout-->login-->Open Wizard-->
             fill all fields in all Tab's(4)-->
            build inviteURL from email--> reopen browser with inviteURL-->
            Validate fields filled's in SignUp form
        """
        user_content = API.User.create_new_user()
        # Fetch one user ID.
        uuid = DB.General.select_where_email(
            "uuid", "ice_user_profile", user_content['email'])
        Frontend.User.activate_and_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()
        vendor_contact = Frontend.Wizard.add_vendor_contact()
        inviteEmail = Helper.rand_invite_email()
        Frontend.Wizard.invite_team_members(inviteEmail)
        Frontend.Wizard.add_ssh_key()
        enguuid = DB.General.select_where("uuid", "ice_vf", "name", vfName, 1)
        inviterURL = Constants.Default.InviteURL.Signup.TEXT + \
            enguuid + "&inviter_uuid=" + uuid + "&email=" + inviteEmail
        Frontend.General.re_open(inviterURL)
        actualInvitedEmail = Get.value_by_name("email")
        Helper.internal_assert(inviteEmail, actualInvitedEmail)
        signUpURLforContact = DB.User.get_contact_signup_url(
            enguuid,
            uuid,
            vendor_contact["email"],
            vendor_contact["full_name"],
            vendor_contact["phone"],
            vendor_contact["company"])
        Frontend.General.re_open(signUpURLforContact)

        actualInvitedEmail = Get.value_by_name(Constants.Signup.Email.NAME)
        Helper.internal_assert(vendor_contact["email"], actualInvitedEmail)
        Helper.internal_assert(
            "+" + vendor_contact["phone"],
            Get.value_by_name(
                Constants.Signup.Phone.NAME))
        Helper.internal_assert(
            vendor_contact["full_name"],
            Get.value_by_name(
                Constants.Signup.FullName.NAME))
        Helper.internal_assert(
            vendor_contact["company"],
            Get.value_by_name(
                Constants.Signup.Company.NAME))
 def test_current_status(self):
     user_content = API.VirtualFunction.create_engagement(
         wait_for_gitlab=False)
     vfName = user_content['vfName']
     Frontend.User.login(user_content['email'],
                         Constants.Default.Password.TEXT)  # new
     Frontend.Overview.click_on_vf(user_content)
     Frontend.User.go_to_account()
     Wait.id(user_content['email'])
     actualFullName = Get.value_by_name("fullname")
     Helper.internal_assert(user_content['full_name'], actualFullName)
     Click.id(Constants.Dashboard.Statuses.ID)
     Frontend.Overview.click_on_vf(user_content)
     Helper.internal_assert(
         "Current Status",
         Get.by_css(Constants.Dashboard.Overview.Status.Header.ID))
     Wait.text_by_id(Constants.Dashboard.Overview.Status.Description.ID,
                     "No status update has been provided yet.")
     Click.id(Constants.Dashboard.Avatar.ID)
     Click.link_text("Logout")
     engLeadEmail = DB.User.select_el_email(vfName)
     Frontend.User.relogin(engLeadEmail, Constants.Default.Password.TEXT)
     Frontend.Overview.click_on_vf(user_content)
     Click.css(Constants.Dashboard.Overview.Status.Add.CSS)
     Helper.internal_assert("Add Status",
                            Get.by_css("h3.modal-title.ng-binding"))
     Helper.internal_assert(
         "Use the form below to add the current status of the engagement.",
         Get.by_css("span.ng-binding"))
     Click.css("textarea[name=\"description\"]")
     Enter.text_by_css("textarea[name=\"description\"]",
                       "Add new Status",
                       wait_for_page=True)
     Helper.internal_assert(
         "Add status",
         Get.by_id(Constants.Dashboard.DetailedView.VFC.Save_button.ID))
     Click.id(Constants.Dashboard.DetailedView.VFC.Save_button.ID,
              wait_for_page=True)
     Helper.assertTrue("Last updated" in Get.by_id("status-update-details"))
     Wait.text_by_id(Constants.Dashboard.Overview.Status.Description.ID,
                     "Add new Status")
     Wait.css(Constants.Dashboard.Overview.Status.Edit.CSS)
     Wait.modal_to_dissappear()
     Click.css(Constants.Dashboard.Overview.Status.Edit.CSS)
     Helper.internal_assert("Current Status",
                            Get.by_css("h3.modal-title.ng-binding"))
     Click.css("textarea[name=\"description\"]")
     Enter.text_by_css("textarea[name=\"description\"]", "Update Status")
     Click.id(Constants.Dashboard.DetailedView.VFC.Save_button.ID)
     Wait.modal_to_dissappear()
     Wait.text_by_id(Constants.Dashboard.Overview.Status.Description.ID,
                     "Update Status")
     Frontend.User.logout()
     Frontend.User.relogin(user_content['email'],
                           Constants.Default.Password.TEXT)
     Frontend.Overview.click_on_vf(user_content)
     Helper.internal_assert(
         "Current Status",
         Get.by_css(Constants.Dashboard.Overview.Status.Header.ID))
     Wait.text_by_id(Constants.Dashboard.Overview.Status.Description.ID,
                     "Update Status")
    def test_add_service_provider_internal(self):
        '''
        TC Name: test_add_service_provider_internal
        Steps:
        Invite is_service_provider_contact Sponsor and
        activate the invited user. Validate sponsor has the right VF.
        '''
        user_content = API.User.create_new_user(company="Amdocs")
        uuid = DB.General.select_where_email("uuid", "ice_user_profile",
                                             user_content['email'])
        activationUrl = DB.User.get_activation_url(user_content['email'])
        Frontend.General.re_open(activationUrl)
        Frontend.User.login(user_content['email'],
                            Constants.Default.Password.TEXT)  # new
        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)
        Wait.id(Constants.Dashboard.Statuses.Title.ID)
        logger.debug("click_on on + Dashboard")
        Click.id(Constants.Dashboard.LeftPanel.AddEngagement.ID)
        # Wizard
        vfName = Frontend.Wizard.add_vf()
        service_provider_internal = \
            Frontend.Wizard.add_service_provider_internal()
        inviteEmail = "automationqatt" + \
            Helper.rand_string("randomString") + "@gmail.com"
        Frontend.Wizard.invite_team_members(inviteEmail)
        Frontend.Wizard.add_ssh_key()
        enguuid = DB.General.select_where("uuid", "ice_vf", "name", vfName, 1)
        invitation_token = DB.User.select_invitation_token(
            "invitation_token", "ice_invitation", "engagement_uuid", enguuid,
            inviteEmail, 1)
        inviterURL = Constants.Default.InviteURL.Signup.TEXT + \
            invitation_token + "&email=" + inviteEmail
        Frontend.General.re_open(inviterURL)
        actualInvitedEmail = Get.value_by_name("email")
        Helper.internal_assert(inviteEmail, actualInvitedEmail)
        signUpURLforContact = DB.User.get_contact_signup_url(
            invitation_token, uuid, service_provider_internal["email"],
            service_provider_internal["full_name"],
            service_provider_internal["phone"],
            service_provider_internal["company"])
        Frontend.General.re_open(signUpURLforContact)
        actualInvitedEmail = Get.value_by_name(Constants.Signup.Email.NAME)
        Helper.internal_assert(str("+" + service_provider_internal["phone"]),
                               Get.value_by_name(Constants.Signup.Phone.NAME))
        Helper.internal_assert(
            service_provider_internal["full_name"],
            Get.value_by_name(Constants.Signup.FullName.NAME))
        Helper.internal_assert(
            service_provider_internal["company"],
            Get.value_by_name(Constants.Signup.Company.NAME))
        # Fetch one is_service_provider_contact user ID.
        engagement_id = DB.General.select_where("engagement_id", "ice_vf",
                                                "name", vfName, 1)
        # SignUp for MainServiceProviderSponsorContact
        engagement_manual_id = DB.General.select_where("engagement_manual_id",
                                                       "ice_engagement",
                                                       "uuid", engagement_id,
                                                       1)

        invitation_token = DB.User.select_invitation_token(
            "invitation_token", "ice_invitation", "engagement_uuid",
            engagement_id, service_provider_internal["email"], 1)
        engLeadEmail = DB.User.select_el_email(vfName)
        user_content['engagement_uuid'] = engagement_id
        user_content['engagement_manual_id'] = engagement_manual_id
        user_content['vfName'] = vfName
        user_content['el_email'] = engLeadEmail

        API.User.signup_invited_user(service_provider_internal["company"],
                                     service_provider_internal["email"],
                                     invitation_token, signUpURLforContact,
                                     user_content, True)
        activationUrl2 = DB.User.get_activation_url(
            service_provider_internal["email"])
        # Activate for VendorContact

        engagement_manual_id = DB.General.select_where("engagement_manual_id",
                                                       "ice_engagement",
                                                       "uuid", engagement_id,
                                                       1)
        # Validate opened right VF for VendorContact
        myVfName = engagement_manual_id + ": " + vfName
        actualVfNameid = "clickable-" + myVfName
        Frontend.General.re_open(activationUrl2)
        Frontend.User.login(service_provider_internal["email"],
                            Constants.Default.Password.TEXT, actualVfNameid)
        actualVfName = Get.by_id(actualVfNameid, wait_for_page=True)
        Helper.internal_assert(myVfName, actualVfName)
    def test_invite_new_user_of_service_provider_internal(self):
        '''
        TC Name: test_invite_new_user_aservice_provider_internal
        Steps:
        Create new NOT-MainServiceProvider APIUser via SignUp request-->
        Login with This One--> build "activationUrl"-->
        Validation of successful activate-->
        close Wizard --> Logout from Dashboard -->login-->Open Wizard-->
        fill all fields in all Tab's(4)-->
        validate second Tab is a "add_service_provider_internal"-->
        build inviteURL from email--> reopen browser with inviteURL-->
        Validate Login Form opened -->
        Login--> Validate Dashboard Form opened
        '''
        user_content = API.User.create_new_user(company="Amdocs")
        uuid = DB.General.select_where_email("uuid", "ice_user_profile",
                                             user_content['email'])
        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)
        Wait.id(Constants.Dashboard.Statuses.Title.ID)
        Click.id(Constants.Dashboard.LeftPanel.AddEngagement.ID)
        # Wizard
        vfName = Frontend.Wizard.add_vf()
        service_provider_internal = \
            Frontend.Wizard.add_service_provider_internal()
        inviteEmail = Helper.rand_invite_email()
        Frontend.Wizard.invite_team_members(inviteEmail)
        Frontend.Wizard.add_ssh_key()
        enguuid = DB.General.select_where("uuid", "ice_vf", "name", vfName, 1)
        invitation_token = DB.User.select_invitation_token(
            "invitation_token", "ice_invitation", "engagement_uuid", enguuid,
            inviteEmail, 1)
        inviterURL = Constants.Default.InviteURL.Signup.TEXT + \
            invitation_token + "&email=" + inviteEmail

        Frontend.General.re_open(inviterURL)
        actualInvitedEmail = Get.value_by_name(Constants.Signup.Email.NAME)
        Helper.internal_assert(inviteEmail, actualInvitedEmail)
        signUpURLforContact = DB.User.get_contact_signup_url(
            invitation_token, uuid, service_provider_internal["email"],
            service_provider_internal["full_name"],
            service_provider_internal["phone"],
            service_provider_internal["company"])
        Frontend.General.re_open(signUpURLforContact)
        actualInvitedEmail = Get.value_by_name(Constants.Signup.Email.NAME)
        Helper.internal_assert(service_provider_internal["email"],
                               actualInvitedEmail)
        Helper.internal_assert("+" + service_provider_internal["phone"],
                               Get.value_by_name(Constants.Signup.Phone.NAME))
        Helper.internal_assert(
            service_provider_internal["full_name"],
            Get.value_by_name(Constants.Signup.FullName.NAME))
        signupCompany = Get.value_by_name(Constants.Signup.Company.NAME, True)
        Helper.internal_assert(service_provider_internal["company"],
                               signupCompany)
Exemplo n.º 11
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
Exemplo n.º 12
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")