def add_vf():
     try:
         logger.debug("Tab Add Virtual Functions")
         Wait.text_by_css(
             Constants.Dashboard.Wizard.Title.CSS,
             Constants.Dashboard.Wizard.AddVF.Title.TEXT,
             wait_for_page=True)
         vfName = "newVF" + Helper.rand_string("randomString")
         vfVersion = "newVFVersion" + \
             Helper.rand_string(
                 "randomNumber") + Helper.rand_string("randomString")
         Enter.text_by_name("virtualFunction", vfName)
         Enter.text_by_name("VFversion", vfVersion, wait_for_page=True)
         FEWizard.date_picker_wizard()
         Select(session.ice_driver.find_element_by_id(
             Constants.Dashboard.Wizard.AddVF.AIC_Version.TEXT
         )).select_by_visible_text("AIC 3.5")
         Select(session.ice_driver.find_element_by_id(
             Constants.Dashboard.Wizard.AddVF.ECOMP_Release.TEXT
         )).select_by_visible_text("Unknown")
         session.E2Edate = FEWizard.get_lab_entry_date()
         Click.css(Constants.SubmitButton.CSS, wait_for_page=True)
         Wait.page_has_loaded()
         Wait.name_to_dissappear("Add Virtual Function")
         return vfName
     # If failed - count the failure and add the error to list of errors.
     except Exception as e:
         errorMsg = "Failed to add a Virtual Function via modal window. " +\
             "Exception " +\
             str(e)
         raise Exception(errorMsg)
    def add_ssh_key(is_negative=False):
        logger.debug("About to add an SSH Key in modal window")
        try:  # Add SSH Key from modal window and return key value.
            Wait.text_by_name(Constants.Dashboard.Wizard.AddSSHKey.Title.NAME,
                              Constants.Dashboard.Wizard.AddSSHKey.Title.TEXT)
            # Generate an SSH Public Key.
            sshKey = Helper.generate_sshpub_key()
            if is_negative:
                sshKey = sshKey[8:]
            Enter.text_by_name("key", sshKey)

            # Check that the submit button exists.
            Wait.text_by_css(
                Constants.SubmitButton.CSS,
                Constants.Dashboard.Wizard.AddSSHKey.Title.TEXT)

            Click.css(Constants.SubmitButton.CSS)  # Click on submit button.
            if is_negative:
                Wait.text_by_id(
                    Constants.Toast.ID,
                    Constants.Dashboard.Avatar.Account
                    .SSHKey.UpdateFailed.TEXT)
            else:
                Wait.name_to_dissappear(
                    Constants.Dashboard.Wizard.AddSSHKey.Title.NAME)
                logger.debug("SSH Key added via modal window.")
            return sshKey
        # If failed - count the failure and add the error to list of errors.
        except Exception as e:
            errorMsg = "Failed to add an SSH Key in " +\
                "the modal window. Exception=" + \
                str(e)
            raise Exception(errorMsg)
 def invite_team_members(email):
     try:
         logger.debug("Tab Invite Team Members")
         Wait.text_by_name(
             Constants.Dashboard.Wizard.InviteTeamMembers.Title.NAME,
             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(Constants.SubmitButton.CSS)
         Wait.name_to_dissappear(
             Constants.Dashboard.Wizard.InviteTeamMembers.Title.NAME)
     # If failed - count the failure and add the error to list of errors.
     except Exception as e:
         errorMsg = "FAILED in Tab Invite Team Members. Exception = %s" % e
         raise Exception(errorMsg)
 def add_vendor_contact():
     logger.debug("Tab Add Vendor Contact")
     Wait.text_by_css(
         Constants.Dashboard.Wizard.Title.CSS,
         Constants.Dashboard.Wizard.AddVendorContact.Title.TEXT,
         wait_for_page=True)
     Select(session.ice_driver.find_element_by_name(
         "company")).select_by_visible_text("Ericsson")
     fullname = Helper.rand_string(
         "randomString") + Helper.rand_string("randomString")
     Enter.text_by_name("fullname", fullname)
     email = Helper.rand_string("randomString") + "@ericson.com"
     Enter.text_by_name("email", email)
     phone = "201" + Helper.rand_string("randomNumber", 6)
     Enter.text_by_name("phone", phone)
     Click.css(Constants.SubmitButton.CSS, wait_for_page=True)
     Wait.name_to_dissappear("Add Vendor Contact", wait_for_page=True)
     vendor = {"company": "Ericsson", "full_name": fullname,
               "email": email, "phone": phone}
     return vendor
 def add_service_provider_internal():
     logger.debug(
         "Tab Add " + ServiceProvider.MainServiceProvider + " Sponsor")
     Wait.text_by_css(
         Constants.Dashboard.Wizard.Title.CSS,
         "Add " +
         ServiceProvider.MainServiceProvider +
         " Sponsor")
     fullname = Helper.rand_string(
         "randomString") + Helper.rand_string("randomString")
     Enter.text_by_name("fullname", fullname)
     email = Helper.rand_string(
         "randomString") + "@" + ServiceProvider.email
     Enter.text_by_name("email", email)
     phone = "201" + Helper.rand_string("randomNumber", 6)
     logger.debug(phone)
     Enter.text_by_name("phone", phone)
     Click.css(Constants.SubmitButton.CSS)
     Wait.name_to_dissappear("Add AT&T Sponsor")
     sponsor = {"company": ServiceProvider.MainServiceProvider,
                "full_name": fullname, "email": email, "phone": phone}
     return sponsor