def adhoc_error_search(self, Ticket_Uid, START_DATE, TPID):
     so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
     so.click_element_by_id(LocalElementLocator.ERROR_HOSPITAL_TAB_ID)
     so.send_text_by_id(LocalElementLocator.TICKET_UID_ID, Ticket_Uid)
     so.send_text_by_id(LocalElementLocator.TITLE_ID,
                        LocalElementLocator.ADHOC_ERROR_TITLE)
     so.send_text_by_id(
         LocalElementLocator.DESCRIPTION_ID,
         '%No entry in the web trading partnership table%' + TPID + '%')
     so.send_text_by_id(LocalElementLocator.START_DATE_ID, START_DATE)
     so.click_element_by_id(LocalElementLocator.SEARCH_BUTTON_ID)
 def document_rejected_error_search(self, v_ticket_uid, v_start_date,
                                    v_TPID, v_error_title, v_doc_type):
     selenium_operation_object = SeleniumOperations(self.v_task_type,
                                                    self.v_driver,
                                                    self.log_file_object)
     selenium_operation_object.click_element_by_id(
         LocalElementLocator.ERROR_HOSPITAL_TAB_ID1)
     selenium_operation_object.send_text_by_id(
         LocalElementLocator.TICKET_UID_ID, v_ticket_uid)
     selenium_operation_object.send_text_by_id(LocalElementLocator.TITLE_ID,
                                               v_error_title)
     selenium_operation_object.send_text_by_id(
         LocalElementLocator.DESCRIPTION_ID,
         '%No entry in the web trading partnership table%' + v_TPID + '%')
     selenium_operation_object.send_text_by_id(
         LocalElementLocator.START_DATE_ID, v_start_date)
     selenium_operation_object.send_text_by_id(
         LocalElementLocator.EH_DOC_TYPE_ID, v_doc_type)
     selenium_operation_object.click_element_by_id(
         LocalElementLocator.SEARCH_BUTTON_ID)
    def requeue(self, parcel_list):

        selenium_operation_object = SeleniumOperations(self.v_task_type,
                                                       self.v_driver,
                                                       self.log_file_object)
        selenium_operation_object.click_element_by_xpath(
            LocalElementLocator.REQUEUE_PARCEL_TAB_XPATH)
        flag = 0
        for v_index in range(0, len(parcel_list)):
            i = (v_index + 1) % 5
            if i == 0:
                i = 5
            parcel_path = '//*[@id="form1:inputText' + str(i) + '"]'
            flag = 0
            if selenium_operation_object.check_exists_by_xpath(parcel_path):
                selenium_operation_object.send_text_by_xpath(
                    parcel_path, parcel_list[v_index])
            if i == 5:
                selenium_operation_object.click_element_by_id(
                    LocalElementLocator.REQUEUE_PARCEL_BUTTON_ID)
                flag = 1
        if flag == 0:
            selenium_operation_object.click_element_by_id(
                LocalElementLocator.REQUEUE_PARCEL_BUTTON_ID)
        selenium_operation_object.click_element_by_id(
            LocalElementLocator.ERROR_HOSPITAL_TAB_ID1)
Ejemplo n.º 4
0
 def company_search_by_TPID(self, TPID):
     so = SeleniumOperations(self.v_task_type, self.v_driver, self.lo)
     so.click_element_by_id(AppConstants.DC4_COMPANY_SEARCH_BY_TPID_TAB)
     so.send_text_by_id(AppConstants.DC4_COMPANY_SEARCH_BY_TPID_TEXT_FIELD, TPID)
     so.click_element_by_id(AppConstants.DC4_COMPANY_SEARCH_BY_TPID_SEARCH_TAB)
    def add_trading_partnership(self, v_error_tiltle, v_TPID, doc_type_list,
                                sender, receiver, v_status):
        selenium_operation_object = SeleniumOperations(self.v_task_type,
                                                       self.v_driver,
                                                       self.log_file_object)
        v_present = 0
        supplier_web_id = ''
        retailer_web_id = ''
        selenium_operation_object.click_element_by_id(
            LocalElementLocator.DC4_WEBFORM_TAB_ID)
        selenium_operation_object.click_element_by_xpath(
            LocalElementLocator.DC4_SEARCH_TRADING_PARTNERSHIP_LINK_XPATH)
        selenium_operation_object.send_text_by_id(
            LocalElementLocator.DC4_EVISION_KEY_ID, v_TPID)
        selenium_operation_object.click_element_by_id(
            LocalElementLocator.DC4_TRADING_PARTNERSHIP_SEARCH_BUTTON_ID)
        #Check for existing trading partnership
        if selenium_operation_object.check_exists_by_xpath(
                LocalElementLocator.DC4_FIRST_TRADING_PARTNERSHIP_XPATH):
            v_present = 1
            doc_type_list, supplier_web_id, retailer_web_id = self.validate_existing_trading_partnership(
                v_error_tiltle, doc_type_list)

        if len(doc_type_list) == 0:
            v_status = v_status + 'Trading Partnership is already v_present'
            selenium_operation_object.click_element_by_id(
                LocalElementLocator.ERROR_HOSPITAL_TAB_ID2)
            flag = 1
            return v_status, flag

        if LocalElementLocator.ADHOC_ERROR_TITLE == v_error_tiltle:
            #Determine supplier and retailer
            sender, receiver = self.check_supplier_retailer(
                sender, receiver, doc_type_list[0])
        #If Valid Trading Partnership is not present
        if len(doc_type_list) != 0:

            if supplier_web_id == '':
                if v_present == 1:
                    selenium_operation_object.click_element_by_xpath(
                        LocalElementLocator.
                        DC4_CREATE_TRADING_PARTNERSHIP_BUTTON1)
                else:
                    selenium_operation_object.click_element_by_xpath(
                        LocalElementLocator.
                        DC4_CREATE_TRADING_PARTNERSHIP_BUTTON2)

                selenium_operation_object.click_element_by_xpath(
                    LocalElementLocator.
                    DC4_ADD_TRADING_PARTNERSHIP_SENDER_TORCH)

                v_status, flag = self.add_web_company(sender, v_status)
                if flag == 0 or flag == 2:
                    selenium_operation_object.click_element_by_xpath(
                        LocalElementLocator.ERROR_HOSPITAL_TAB_XPATH)
                    return v_status, flag

                selenium_operation_object.click_element_by_xpath(
                    LocalElementLocator.
                    DC4_ADD_TRADING_PARTNERSHIP_RECEIVER_TORCH)
                v_status, flag = self.add_web_company(receiver, v_status)

                if flag == 0 or flag == 2:
                    selenium_operation_object.click_element_by_xpath(
                        LocalElementLocator.ERROR_HOSPITAL_TAB_XPATH)
                    return v_status, flag

                if flag == 1:
                    supp_web_id = self.v_driver.find_element_by_id(
                        LocalElementLocator.
                        DC4_ADD_TRADING_PARTNERSHIP_SENDER_TEXT_ID
                    ).get_attribute('value')
                    ret_web_id = self.v_driver.find_element_by_id(
                        LocalElementLocator.
                        DC4_ADD_TRADING_PARTNERSHIP_RECEIVER_TEXT_ID
                    ).get_attribute('value')
                    self.error_hospital_machine_learning_object.add_to_library(
                        sender, supp_web_id)
                    self.error_hospital_machine_learning_object.add_to_library(
                        receiver, ret_web_id)
                    selenium_operation_object.send_text_by_id(
                        LocalElementLocator.
                        DC4_ADD_TRADING_PARTNERSHIP_EVISION_KEY_ID, v_TPID)
                    selenium_operation_object.send_text_by_id(
                        LocalElementLocator.
                        DC4_ADD_TRADING_PARTNERSHIP_FORM_NUMBER_ID,
                        (', ').join(doc_type_list))
                    if LocalElementLocator.ADHOC_ERROR_TITLE == v_error_tiltle:
                        selenium_operation_object.click_element_by_xpath(
                            LocalElementLocator.
                            DC4_ADD_TRADING_PARTNERSHIP_BILLING_CODE_ZERO)
                    else:
                        selenium_operation_object.click_element_by_xpath(
                            LocalElementLocator.
                            DC4_ADD_TRADING_PARTNERSHIP_BILLING_CODE_ONE)
                    selenium_operation_object.click_element_by_xpath(
                        LocalElementLocator.
                        DC4_ADD_TRADING_PARTNERSHIP_CREATE_BUTTON)
                    selenium_operation_object.click_element_by_xpath(
                        LocalElementLocator.ERROR_HOSPITAL_TAB_XPATH)
                    v_status = v_status + '\nAdded web trading partnership'
                    return v_status, 1
            else:
                selenium_operation_object.click_element_by_xpath(
                    LocalElementLocator.DC4_CREATE_TRADING_PARTNERSHIP_BUTTON1)
                if v_error_tiltle == LocalElementLocator.ADHOC_ERROR_TITLE:
                    selenium_operation_object.send_text_by_id(
                        LocalElementLocator.
                        DC4_ADD_TRADING_PARTNERSHIP_SENDER_TEXT_ID,
                        retailer_web_id)
                    selenium_operation_object.send_text_by_id(
                        LocalElementLocator.
                        DC4_ADD_TRADING_PARTNERSHIP_RECEIVER_TEXT_ID,
                        supplier_web_id)
                else:
                    if doc_type_list[0] == '810' or doc_type_list[
                            0] == '846' or doc_type_list[
                                0] == '855' or doc_type_list[
                                    0] == '856' or doc_type_list[0] == '940':
                        selenium_operation_object.send_text_by_id(
                            LocalElementLocator.
                            DC4_ADD_TRADING_PARTNERSHIP_SENDER_TEXT_ID,
                            supplier_web_id)
                        selenium_operation_object.send_text_by_id(
                            LocalElementLocator.
                            DC4_ADD_TRADING_PARTNERSHIP_RECEIVER_TEXT_ID,
                            retailer_web_id)
                    else:
                        selenium_operation_object.send_text_by_id(
                            LocalElementLocator.
                            DC4_ADD_TRADING_PARTNERSHIP_SENDER_TEXT_ID,
                            retailer_web_id)
                        selenium_operation_object.send_text_by_id(
                            LocalElementLocator.
                            DC4_ADD_TRADING_PARTNERSHIP_RECEIVER_TEXT_ID,
                            supplier_web_id)
                selenium_operation_object.send_text_by_id(
                    LocalElementLocator.
                    DC4_ADD_TRADING_PARTNERSHIP_EVISION_KEY_ID, v_TPID)
                selenium_operation_object.send_text_by_id(
                    LocalElementLocator.
                    DC4_ADD_TRADING_PARTNERSHIP_FORM_NUMBER_ID,
                    (', ').join(doc_type_list))
                if LocalElementLocator.ADHOC_ERROR_TITLE == v_error_tiltle:
                    selenium_operation_object.click_element_by_xpath(
                        LocalElementLocator.
                        DC4_ADD_TRADING_PARTNERSHIP_BILLING_CODE_ZERO)
                else:
                    selenium_operation_object.click_element_by_xpath(
                        LocalElementLocator.
                        DC4_ADD_TRADING_PARTNERSHIP_BILLING_CODE_ONE)

                selenium_operation_object.click_element_by_xpath(
                    LocalElementLocator.
                    DC4_ADD_TRADING_PARTNERSHIP_CREATE_BUTTON)
                selenium_operation_object.click_element_by_xpath(
                    LocalElementLocator.ERROR_HOSPITAL_TAB_XPATH)
                v_status = v_status + '\nAdded web trading partnership'
                return v_status, 1