Skip to content

Commit

Permalink
Merge branch 'release/v1.20.28rc6' into hotfix/base_database
Browse files Browse the repository at this point in the history
  • Loading branch information
renanllisboa authored Nov 27, 2024
2 parents d0e79ec + f0ce3e6 commit 4c8fd19
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tir/technologies/core/base_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def disconnect_database(self, connection):
logger().info('DataBase connection stopped')
else:
logger().info('DataBase connection already stopped')

def query_execute(self, query, database_driver, dbq_oracle_server, database_server, database_port, database_name, database_user, database_password):
"""
Return a dictionary if the query statement is a SELECT otherwise print a number of row
Expand Down
26 changes: 18 additions & 8 deletions tir/technologies/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ class ConfigLoader:
This class is instantiated to contain all config information used throughout the execution of the methods.
"""

_instance = None
_json_data = None

def __init__(self, path="config.json"):
def __new__(cls, path="config.json"):
if cls._instance is None:
cls._instance = super(ConfigLoader, cls).__new__(cls)
cls._instance._initialize(path)
return cls._instance

def _initialize(self, path="config.json"):
if ConfigLoader._json_data is None:

if not path:
Expand All @@ -29,6 +36,8 @@ def __init__(self, path="config.json"):
raise Exception(f"JSON file issue: {e}. \n* Please check your config.json *")

if ConfigLoader._json_data:
for key, value in ConfigLoader._json_data.items():
setattr(self, key, value)

data = ConfigLoader._json_data

Expand Down Expand Up @@ -61,13 +70,6 @@ def __init__(self, path="config.json"):
self.skip_restart = ("SkipRestart" in data and bool(data["SkipRestart"]))
self.smart_test = ("SmartTest" in data and bool(data["SmartTest"]))
self.smart_erp = ("SmartERP" in data and bool(data["SmartERP"]))
self.valid_language = self.language != ""
self.initial_program = ""
self.routine = ""
self.date = ""
self.group = ""
self.branch = ""
self.module = ""
self.user_cfg = str(data["UserCfg"]) if "UserCfg" in data else ""
self.password_cfg = str(data["PasswordCfg"]) if "PasswordCfg" in data else ""
self.electron_binary_path = (str(data["BinPath"]) if "BinPath" in data else "")
Expand Down Expand Up @@ -104,6 +106,14 @@ def __init__(self, path="config.json"):
"SSLChromeInstallDisable" in data and bool(data["SSLChromeInstallDisable"]))
self.data_delimiter = str(data["DataDelimiter"]) if "DataDelimiter" in data else "/"
self.procedure_menu = str(data["ProcedureMenu"]) if "ProcedureMenu" in data else ""
self.valid_language = self.language != ""
self.initial_program = ""
self.routine = ""
self.date = ""
self.group = ""
self.branch = ""
self.module = ""
self.routine_type = ""

def check_keys(self, json_data):
valid_keys = [
Expand Down
7 changes: 3 additions & 4 deletions tir/technologies/poui_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def __init__(self, config_path="", autostart=True):
self.tmenu_screen = None
self.grid_memo_field = False
self.range_multiplier = None
self.routine = None

if not Base.driver:
Base.driver = self.driver
Expand Down Expand Up @@ -1289,9 +1288,9 @@ def restart(self):


if self.config.routine:
if self.routine == 'SetLateralMenu':
if self.config.routine_type.lower() == 'setlateralmenu':
self.SetLateralMenu(self.config.routine, save_input=False)
elif self.routine == 'Program':
elif self.config.routine_type.lower() == 'program':
self.set_program(self.config.routine)

def driver_refresh(self):
Expand Down Expand Up @@ -3440,7 +3439,7 @@ def POSearch(self, content, placeholder):
element().clear()
element().send_keys(content)

action = lambda: self.soup_to_selenium(next(iter(input.parent.select('span'))))
action = lambda: self.soup_to_selenium(next(iter(po_page.select('po-icon'))))
ActionChains(self.driver).move_to_element(action()).click().perform()

def ClickTable(self, first_column, second_column, first_content, second_content, table_number, itens, click_cell, checkbox):
Expand Down
9 changes: 4 additions & 5 deletions tir/technologies/webapp_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def __init__(self, config_path="", autostart=True):
self.tmenu_screen = None
self.grid_memo_field = False
self.range_multiplier = None
self.routine = None
self.test_suite = []
self.current_test_suite = self.log.get_file_name('testsuite')
self.restart_tss = False
Expand Down Expand Up @@ -1562,7 +1561,7 @@ def Program(self, program_name):
>>> # Calling the method:
>>> oHelper.Program("MATA020")
"""
self.routine = 'Program'
self.config.routine_type = 'Program'
self.config.routine = program_name

if self.config.log_info_config:
Expand Down Expand Up @@ -3275,9 +3274,9 @@ def restart(self):


if self.config.routine:
if self.routine == 'SetLateralMenu':
if self.config.routine_type == 'SetLateralMenu':
self.SetLateralMenu(self.config.routine, save_input=False)
elif self.routine == 'Program':
elif self.config.routine_type == 'Program':
self.set_program(self.config.routine)

def wait_user_screen(self):
Expand Down Expand Up @@ -3965,7 +3964,7 @@ def SetLateralMenu(self, menu_itens, save_input=True, click_menu_functional=Fals
self.log_error_newlog()

if save_input:
self.routine = 'SetLateralMenu'
self.config.routine_type = 'SetLateralMenu'
self.config.routine = menu_itens

if self.webapp_shadowroot():
Expand Down

0 comments on commit 4c8fd19

Please sign in to comment.