def Capability_parameter_validator(self):
     self.log.log_to_file(
         self, "INFO",
         " Validating Capability Parameters in Supplier Side! ")
     time.sleep(4)
     self.seleniumOperation.click_element_by_xpath(Element.comms_plus)
     self.output_channel_list = []
     self.output_channels = self.driver.find_elements_by_xpath(
         Element.output_channel)
     for self.output_channel in self.output_channels:
         self.output_channel_list.append(self.output_channel.text)
     # print(self.output_channel_list)
     if (self.output_channel_list.__getitem__(0)
             == self.ERP_sheet['filename_macro'].iloc[0]
             and self.output_channel_list.__getitem__(2).split(
                 '/').__getitem__(6) == "out"
             and self.output_channel_list.__getitem__(3).split(
                 '/').__getitem__(5) == "out"):
         print(
             "filename_macro, archive_directory, and directory is Matched")
         ExcelOperations.set_value_to_cell(file.Output_File_Path, 4, 2,
                                           'MATCHED')
     else:
         self.Warning(
             'cancel',
             "filename_macro/ archive_directory/ directory is Not Matched")
         ExcelOperations.set_value_to_cell(file.Output_File_Path, 4, 2,
                                           'NOT MATCHED')
    def GetIDs(self):
        TestData = open(self.file_paths[0])
        test_data = TestData.readlines()
        self.delimeter = test_data[0][3]

        Retailer_Qual = str(test_data[0].split(self.delimeter)[5])
        Retailer_ISA_ID = str(test_data[0].split(self.delimeter)[6]).strip()
        Retailer_ISA_ID = str(Retailer_Qual) + ':' + str(Retailer_ISA_ID)
        ExcelOperations.set_value_to_cell(
            ElementLocator_For_PurchaseOrder_SetUp.INPUT_FILE_PATH, 2, 7,
            Retailer_ISA_ID)

        Retailer_Group_ID = str(test_data[1].split(self.delimeter)[2]).strip()
        ExcelOperations.set_value_to_cell(
            ElementLocator_For_PurchaseOrder_SetUp.INPUT_FILE_PATH, 2, 8,
            Retailer_Group_ID)

        Supplier_Qual = str(test_data[0].split(self.delimeter)[7])
        Supplier_ISA_ID = str(test_data[0].split(self.delimeter)[8]).strip()
        Supplier_ISA_ID = str(Supplier_Qual) + ':' + str(Supplier_ISA_ID)
        ExcelOperations.set_value_to_cell(
            ElementLocator_For_PurchaseOrder_SetUp.INPUT_FILE_PATH, 2, 5,
            Supplier_ISA_ID)

        Supplier_Group_ID = str(test_data[1].split(self.delimeter)[3]).strip()
        ExcelOperations.set_value_to_cell(
            ElementLocator_For_PurchaseOrder_SetUp.INPUT_FILE_PATH, 2, 6,
            Supplier_Group_ID)

        TPID = self.TPID
        print(TPID)
        print('Retailer ', Retailer_ISA_ID, Retailer_Group_ID)
        print('Supplier', Supplier_ISA_ID, Supplier_Group_ID)
        return self.file_paths
    def Execute_GenerateInputs(self):
        generatingInput = Generate_Inputs(self.driver, self.wait, self.erp,
                                          self.supplier_name,
                                          self.retailer_name, self.Start_Date,
                                          self.No_of_Parcels)
        generatingInput.Login()
        generatingInput.TTSearch()
        generatingInput.DownloadInput()
        generatingInput.DeleteDupliacteFiles()

        self.SDQ_present_Flag = generatingInput.EdiValidations()
        self.filepaths = generatingInput.GetIDs()
        print('SDQ present in file ?', self.SDQ_present_Flag)
        ExcelOperations.set_value_to_cell(Element.Output_File_Path, 5, 2,
                                          self.SDQ_present_Flag)
        print('In Main file', self.filepaths)
    def Setup_capability_validator(self):
        self.log.log_to_file(
            self, "INFO",
            " Starting Setup capability validation in Supplier Side! ")
        self.ERP_sheet = self.ERP_sheet.loc[(
            self.ERP_sheet['ERP'] == self.ERP_name)]
        datatype_name = self.ERP_sheet['DataTypeName'].iloc[0]
        service_name = self.ERP_sheet['Services'].iloc[0]
        doctype_name = self.ERP_sheet['Document'].iloc[0]
        # ExcelOperations.set_value_to_cell(file.Output_File_Path,1,2,doctype_name)
        # status = "ACTIVE"

        self.df_datatypes = self.df_datatypes.loc[
            (self.df_datatypes['Service'] == str(service_name))
            & (self.df_datatypes['Doctype'] == str(doctype_name))]
        print(self.df_datatypes)
        if self.df_datatypes.empty:
            print("Capability service and Doctype is not Matched")
            ExcelOperations.set_value_to_cell(file.Output_File_Path, 1, 2,
                                              'NOT MATCHED')
        else:
            print("Capability service and Doctype is Matched")
            ExcelOperations.set_value_to_cell(file.Output_File_Path, 1, 2,
                                              'MATCHED')
            pass

        self.df_datatypes_test = self.df_datatypes.loc[(
            self.df_datatypes['DataTypes'] == str(datatype_name))]
        # ExcelOperations.set_value_to_cell(file.Output_File_Path, 3, 2, self.df_datatypes['DataTypes'])
        if self.df_datatypes_test.empty:
            print(self.df_datatypes_test)
            print("Capability datatype is not Matched")
            ExcelOperations.set_value_to_cell(file.Output_File_Path, 3, 2,
                                              'NOT MATCHED')
            time.sleep(5)
            data_type = self.df_datatypes['DataTypes'].iloc[0]
            self.CapID = self.df_datatypes['CapId'].iloc[0]
            self.Warning(
                "cancel",
                str(f" This Datatype {data_type} is not MATCHED with input Datatype you want to "
                    f"continue with DOCUMENT type and SERVICE"))
            self.extreact_extension()
            self.seleniumOperation.click_element_by_xpath(
                f".//*[contains(text(),'{str(self.CapID)}')]")
            pass
        else:
            print(self.df_datatypes_test)
            print("Capability datatype is Matched")
            ExcelOperations.set_value_to_cell(file.Output_File_Path, 3, 2,
                                              'MATCHED')
            self.CapID = self.df_datatypes_test['CapId'].iloc[0]
            self.extreact_extension()
            self.seleniumOperation.click_element_by_xpath(
                f".//*[contains(text(),'{str(self.CapID)}')]")
            pass
 def get_parcel(self, rows):
     row = int(rows)
     selenium_operations_object = SeleniumOperations(self.driver, self.log)
     file_broker = selenium_operations_object.get_text_by_xpath(
         ElementLocator.file_broker_xpath)
     print(file_broker)
     ExcelOperations.set_value_to_cell(ElementLocator.Edi_Parcel_file, row,
                                       1, file_broker)
     selenium_operations_object.click_element_by_xpath(
         f'//*[@id="parcel-{str(file_broker)}"]/div/div/div[2]/div/a/div/div'
     )
     time.sleep(3)
     selenium_operations_object.click_element_by_xpath(
         ElementLocator.Download_xpath)
     selenium_operations_object.click_element_by_xpath(
         ElementLocator.BackToTransaction)
     selenium_operations_object.click_element_by_xpath(
         ElementLocator.BackToSearch)
    def map_extension_validation(self):
        self.log.log_to_file(self, "INFO", " Map Extension Validation in Receiver Side ! ")
        self.Map_sheet = pandas.read_excel(Element.INPUT_FILE_PATH, sheet_name='850 maps')
        self.Map_sheet = self.Map_sheet.loc[(self.Map_sheet['Supplier'] == float('7.6')) & (self.Map_sheet['Retailer'] == float('7'))]
        # print(self.Map_sheet['Map'].iloc[0])
        self.Map_sheet = (self.Map_sheet.set_index(self.Map_sheet.columns.drop('Map', 1).tolist()).Map.str.
                         split(',',expand=True).stack().reset_index().rename(columns={0: 'Map'}).loc[:, self.Map_sheet.columns])
        # print(Map_sheet)
        self.Map_sheet = self.Map_sheet['Map']
        self.df_Map = pandas.DataFrame(columns=['Extensions'])
        self.df_Map['Extensions'] = self.Map_sheet
        print(self.df_Map)

        if self.df_Map.equals(self.extension):
            print("Matched")
            ExcelOperations.set_value_to_cell(file.Output_File_Path, 10, 2, 'MATCHED')
            ExcelOperations.set_value_to_cell(file.Output_File_Path, 6, 2, 'PASS')
            setup_methods.Warning(self,'cancel','Map Extension is Matched')
        else:
            print("Not Matched.")
            ExcelOperations.set_value_to_cell(file.Output_File_Path, 10, 2, 'NOT MATCHED')
            ExcelOperations.set_value_to_cell(file.Output_File_Path, 6, 2, 'FAIL')
            setup_methods.Warning(self, 'cancel', 'Map Extension is Not Matched')
Exemplo n.º 7
0
 def __init__(self, driver, wait, erp, supplier_name, retailer_name,
              Start_Date):
     self.driver = driver
     self.driver.get(Element.TT_url)
     self.wait = wait
     self.erp = erp
     ExcelOperations.set_value_to_cell(
         ElementLocator_For_PurchaseOrder_SetUp.INPUT_FILE_PATH, 2, 4,
         self.erp)
     self.supplier_name = supplier_name
     ExcelOperations.set_value_to_cell(
         ElementLocator_For_PurchaseOrder_SetUp.INPUT_FILE_PATH, 2, 1,
         self.supplier_name)
     self.retailer_name = retailer_name
     ExcelOperations.set_value_to_cell(
         ElementLocator_For_PurchaseOrder_SetUp.INPUT_FILE_PATH, 2, 2,
         self.retailer_name)
     self.Start_Date = Start_Date
 def __init__(self, driver, wait, erp, supplier_name, retailer_name,
              Start_Date, No_of_Parcels):
     self.driver = driver
     self.wait = wait
     self.erp = erp
     ExcelOperations.set_value_to_cell(
         ElementLocator_For_PurchaseOrder_SetUp.INPUT_FILE_PATH, 2, 4,
         self.erp)
     self.supplier_name = supplier_name
     ExcelOperations.set_value_to_cell(
         ElementLocator_For_PurchaseOrder_SetUp.INPUT_FILE_PATH, 2, 1,
         self.supplier_name)
     self.retailer_name = retailer_name
     ExcelOperations.set_value_to_cell(
         ElementLocator_For_PurchaseOrder_SetUp.INPUT_FILE_PATH, 2, 2,
         self.retailer_name)
     self.Start_Date = Start_Date
     self.No_of_Parcels = No_of_Parcels
     self.root = tk.Tk()
     self.root.withdraw()
     self.root.attributes("-topmost", True)
    def Get_parameters(self):
        self.log.log_to_file(self, "INFO",
                             " Geting parameters in Supplier Side! ")
        time.sleep(3)
        self.parameters_list = []
        self.parameters = self.driver.find_elements_by_xpath(
            Element.parameters)
        for self.parameter in self.parameters:
            self.parameters_list.append(self.parameter.text)
        self.df_parameter = pandas.DataFrame(columns=['parameters'])
        self.df_parameter['parameters'] = self.parameters_list
        # print(self.df_parameter)
        self.df_parameter = self.df_parameter.iloc[1:, :]
        self.df_parameter['parameters'] = self.df_parameter[
            'parameters'].str.split('\n').str[0]
        self.df_parameter.rename(columns={'parameters': 'NAME'}, inplace=True)
        indexes_to_be_removed = self.df_parameter.loc[self.df_parameter['NAME']
                                                      == "ID"].index[0]
        self.df_parameter = self.df_parameter.iloc[:indexes_to_be_removed -
                                                   1, :]
        self.df_parameter = pandas.DataFrame(self.df_parameter.NAME.str.split(
            ' ', 1).tolist(),
                                             columns=['NAME', 'VALUE'])
        print(self.df_parameter)
        print(
            "_____________________________________________________________________________"
        )
        try:
            if numpy.isnan(self.ERP_sheet.WRAPDOCUMENT.iloc[0]):
                print('WRAPDOCUMENT not applicable')
        except:
            if self.ERP_sheet.WRAPDOCUMENT.iloc[0] == \
                    self.df_parameter.loc[self.df_parameter['NAME'] == 'WRAPDOCUMENT', 'VALUE'].iloc[0]:
                print('WRAPDOCUMENT value matched')
            else:
                self.Warning(
                    'cancel',
                    'Warning!! WRAPDOCUMENT value does not match, do you want to continue ?'
                )

        try:
            if numpy.isnan(self.ERP_sheet.WRAPTRAILER.iloc[0]):
                print('WRAPTRAILER not applicable')
        except:
            if self.ERP_sheet.WRAPTRAILER.iloc[0] == \
                    self.df_parameter.loc[self.df_parameter['NAME'] == 'WRAPTRAILER', 'VALUE'].iloc[0]:
                print('WRAPTRAILER value matched')
            else:
                self.Warning(
                    'cancel',
                    'Warning!! WRAPTRAILER value does not match, do you want to continue ?'
                )

        try:
            if numpy.isnan(self.ERP_sheet.WRAPHEADER.iloc[0]):
                print('WRAPHEADER not applicable')
        except:
            if self.ERP_sheet.WRAPHEADER.iloc[0] == \
                    self.df_parameter.loc[self.df_parameter['NAME'] == 'WRAPHEADER', 'VALUE'].iloc[0]:
                print('WRAPHEADER value matched')
            else:
                self.Warning(
                    'cancel',
                    'Warning!! WRAPHEADER value does not match, do you want to continue ?'
                )
        print(
            "_____________________________________________________________________________"
        )
        try:
            self.action_parameters_list = []
            self.action_parameters = self.driver.find_elements_by_xpath(
                Element.action_parameters)
            for self.action_parameter in self.action_parameters:
                self.action_parameters_list.append(self.action_parameter.text)

            try:
                if numpy.isnan(self.ERP_sheet['PearlScriptAction'].iloc[0]):
                    print("PearlScriptAction is not applicable")
                    ExcelOperations.set_value_to_cell(file.Output_File_Path, 8,
                                                      2, 'NOT MATCHED')
            except:
                if self.action_parameters_list[0] == self.ERP_sheet[
                        'PearlScriptAction'].iloc[0]:
                    print("PearlScriptAction is Matched")
                    ExcelOperations.set_value_to_cell(file.Output_File_Path, 8,
                                                      2, 'MATCHED')
                else:
                    self.Warning('cancel',
                                 "Warning!! PearlScriptAction is not Matched")

            try:
                if numpy.isnan(self.ERP_sheet['NamingScriptAction'].iloc[0]):
                    print("NamingScriptAction is not applicable")
                    ExcelOperations.set_value_to_cell(file.Output_File_Path, 9,
                                                      2, ' NOT MATCHED')
            except:
                if self.action_parameters_list[1] == self.ERP_sheet[
                        'NamingScriptAction'].iloc[0]:
                    print("NamingScriptAction is Matched")
                    ExcelOperations.set_value_to_cell(file.Output_File_Path, 9,
                                                      2, 'MATCHED')
                else:
                    self.Warning(
                        'cancel',
                        "Warning!! NamingScriptAction is not Matched")
        except:
            self.Warning(
                'cancel',
                "Warning!! PearlScriptAction and NamingScriptAction is not Present !! DO You want "
                "to Continue ?")
            pass