Skip to content

Commit

Permalink
Merge pull request #1578 from totvs/release/v1.20.28rc1
Browse files Browse the repository at this point in the history
Release/v1.20.28rc1
  • Loading branch information
renanllisboa authored Nov 6, 2024
2 parents 3810e99 + 34eafda commit 9cf882b
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 254 deletions.
2 changes: 1 addition & 1 deletion scripts/install_package.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ taskkill /f /im chromedriver.exe
echo -------------------------
echo Installing project...
echo -------------------------
pip install -U dist/tir_framework-1.20.27.tar.gz
pip install -U dist/tir_framework-1.20.28rc1.tar.gz
pause >nul | set/p = Press any key to exit ...
23 changes: 23 additions & 0 deletions tir/technologies/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,29 @@ def search_zindex(self,element):
zindex = int(element.attrs['style'].split("z-index:")[1].split(";")[0].strip())

return zindex

def collect_zindex(self, reverse=True):
"""
returns z-index list in decrescent order by default or in crescent order if reverse is False.
"""

soup = self.get_current_DOM()

style_elements = soup.find_all(style=True)

if style_elements:
zindex_list = list(filter(lambda x: 'z-index' in x['style'], style_elements))
if zindex_list:
zindex_list_filtered = list(map(lambda x: x.attrs['style'].split('z-index')[1].split(';')[0].split(':')[1].strip(), zindex_list))
return sorted(list(map(int, zindex_list_filtered)), reverse=reverse)

def return_last_zindex(self):
"""
returns the last z-index value in the page.
"""
zindex_list = self.collect_zindex(reverse=True)
if zindex_list:
return next(iter(zindex_list), None)

def select_combo(self, element, option, index=False, shadow_root=True, locator=False):
"""
Expand Down
301 changes: 156 additions & 145 deletions tir/technologies/core/config.py
Original file line number Diff line number Diff line change
@@ -1,163 +1,174 @@
import json
import os
from datetime import datetime
import sys

class ConfigLoader:
"""
This class is instantiated to contain all config information used throughout the execution of the methods.
"""

_json_data = None

def __init__(self, path="config.json"):
valid = os.path.isfile(path)
if ConfigLoader._json_data is None:

if not path:
path = os.path.join(sys.path[0], r"config.json")

valid = os.path.isfile(path)

if valid:
with open(path) as json_data_file:
try:
data = json.load(json_data_file)
if self.validar_chaves(data):
raise Exception(self.validar_chaves(data))
ConfigLoader._json_data = data
except Exception as e:
raise Exception(f"JSON file issue: {e}. \n* Please check your config.json *")

if valid:
with open(path) as json_data_file:
try:
data = json.load(json_data_file)
if self.validar_chaves(data):
raise Exception(self.validar_chaves(data))
except Exception as e:
raise Exception(f"JSON file issue: {e}. \n* Please check your config.json *")
else:
data = {}
if ConfigLoader._json_data:

today = datetime.today()
data = ConfigLoader._json_data

self.json_data = data
self.autostart = True
self.ipExec = str(data["ipExec"]) if "ipExec" in data else ""
self.url_set_start_exec = str(data["UrlSetStartExec"]) if "UrlSetStartExec" in data else ""
self.url_set_end_exec = str(data["UrlSetEndExec"]) if "UrlSetEndExec" in data else ""
self.screenshot = bool(data["ScreenShot"]) if "ScreenShot" in data else True
self.country = str(data["Country"]) if "Country" in data else "BRA"
self.execution_id = str(data["ExecId"]) if "ExecId" in data else today.strftime('%Y%m%d')
self.num_exec = str(data["NumExec"]) if "NumExec" in data else ""
self.issue = str(data["MotExec"]) if "MotExec" in data else ""
self.url = str(data["Url"]) if "Url" in data else ""
self.browser = str(data["Browser"]) if "Browser" in data else ""
self.environment = str(data["Environment"]) if "Environment" in data else ""
self.user = str(data["User"]) if "User" in data else ""
self.password = str(data["Password"]) if "Password" in data else ""
self.language = str(data["Language"]) if "Language" in data else ""
self.skip_environment = ("SkipEnvironment" in data and bool(data["SkipEnvironment"]))
self.headless = ("Headless" in data and bool(data["Headless"]))
self.log_folder = str(data["LogFolder"]) if "LogFolder" in data else ""
self.log_file = ("LogFile" in data and bool(data["LogFile"]))
self.debug_log = ("DebugLog" in data and bool(data["DebugLog"]))
self.time_out = int(data["TimeOut"]) if "TimeOut" in data else 90
self.parameter_menu = str(data["ParameterMenu"]) if "ParameterMenu" in data else ""
self.screenshot_folder = str(data["ScreenshotFolder"]) if "ScreenshotFolder" in data else ""
self.coverage = ("Coverage" in data and bool(data["Coverage"]))
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 "")
self.csv_path = (str(data["CSVPath"]) if "CSVPath" in data else "")
self.database_driver = str(data["DBDriver"]) if "DBDriver" in data else ""
self.database_server = str(data["DBServer"]) if "DBServer" in data else ""
self.database_port = str(data["DBPort"]) if "DBPort" in data else ""
self.database_name = str(data["DBName"]) if "DBName" in data else ""
self.database_user = str(data["DBUser"]) if "DBUser" in data else ""
self.database_password = str(data["DBPassword"]) if "DBPassword" in data else ""
self.dbq_oracle_server = str(data["DBQOracleServer"]) if "DBQOracleServer" in data else ""
self.url_tss = str(data["URL_TSS"]) if "URL_TSS" in data else ""
self.start_program = str(data["StartProgram"]) if "StartProgram" in data else ""
self.new_log = ("NewLog" in data and bool(data["NewLog"]))
self.logurl1 = str(data["LogUrl1"]) if "LogUrl1" in data else ""
self.logurl2 = str(data["LogUrl2"]) if "LogUrl2" in data else ""
self.parameter_url = bool(data["ParameterUrl"]) if "ParameterUrl" in data else False
self.log_http = str(data["LogHttp"]) if "LogHttp" in data else ""
self.baseline_spool = str(data["BaseLine_Spool"]) if "BaseLine_Spool" in data else ""
self.check_value = (bool(data["CheckValue"]) if "CheckValue" in data else None)
self.poui_login = bool(data["POUILogin"]) if "POUILogin" in data else False
self.poui = bool(data["POUI"]) if "POUI" in data else False
self.log_info_config = bool(data["LogInfoConfig"]) if "LogInfoConfig" in data else False
self.release = str(data["Release"]) if "Release" in data else "12.1.2210"
self.top_database = str(data["TopDataBase"]) if "TopDataBase" in data else "MSSQL"
self.lib_version = str(data["Lib"]) if "Lib" in data else "lib_version"
self.build_version = str(data["Build"]) if "Build" in data else "build_version"
self.appserver_folder = str(data["AppServerFolder"]) if "AppServerFolder" in data else ""
self.destination_folder = str(data["DestinationFolder"]) if "DestinationFolder" in data else ""
self.appserver_service = str(data["AppServerService"]) if "AppServerService" in data else ""
self.check_dump = ("CheckDump" in data and bool(data["CheckDump"]))
self.chromedriver_auto_install = ("ChromeDriverAutoInstall" in data and bool(data["ChromeDriverAutoInstall"]))
self.ssl_chrome_auto_install_disable = (
"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 ""
today = datetime.today()
self.json_data = data
self.autostart = True
self.ipExec = str(data["ipExec"]) if "ipExec" in data else ""
self.url_set_start_exec = str(data["UrlSetStartExec"]) if "UrlSetStartExec" in data else ""
self.url_set_end_exec = str(data["UrlSetEndExec"]) if "UrlSetEndExec" in data else ""
self.screenshot = bool(data["ScreenShot"]) if "ScreenShot" in data else True
self.country = str(data["Country"]) if "Country" in data else "BRA"
self.execution_id = str(data["ExecId"]) if "ExecId" in data else today.strftime('%Y%m%d')
self.num_exec = str(data["NumExec"]) if "NumExec" in data else ""
self.issue = str(data["MotExec"]) if "MotExec" in data else ""
self.url = str(data["Url"]) if "Url" in data else ""
self.browser = str(data["Browser"]) if "Browser" in data else ""
self.environment = str(data["Environment"]) if "Environment" in data else ""
self.user = str(data["User"]) if "User" in data else ""
self.password = str(data["Password"]) if "Password" in data else ""
self.language = str(data["Language"]) if "Language" in data else ""
self.skip_environment = ("SkipEnvironment" in data and bool(data["SkipEnvironment"]))
self.headless = ("Headless" in data and bool(data["Headless"]))
self.log_folder = str(data["LogFolder"]) if "LogFolder" in data else ""
self.log_file = ("LogFile" in data and bool(data["LogFile"]))
self.debug_log = ("DebugLog" in data and bool(data["DebugLog"]))
self.time_out = int(data["TimeOut"]) if "TimeOut" in data else 90
self.parameter_menu = str(data["ParameterMenu"]) if "ParameterMenu" in data else ""
self.screenshot_folder = str(data["ScreenshotFolder"]) if "ScreenshotFolder" in data else ""
self.coverage = ("Coverage" in data and bool(data["Coverage"]))
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 "")
self.csv_path = (str(data["CSVPath"]) if "CSVPath" in data else "")
self.database_driver = str(data["DBDriver"]) if "DBDriver" in data else ""
self.database_server = str(data["DBServer"]) if "DBServer" in data else ""
self.database_port = str(data["DBPort"]) if "DBPort" in data else ""
self.database_name = str(data["DBName"]) if "DBName" in data else ""
self.database_user = str(data["DBUser"]) if "DBUser" in data else ""
self.database_password = str(data["DBPassword"]) if "DBPassword" in data else ""
self.dbq_oracle_server = str(data["DBQOracleServer"]) if "DBQOracleServer" in data else ""
self.url_tss = str(data["URL_TSS"]) if "URL_TSS" in data else ""
self.start_program = str(data["StartProgram"]) if "StartProgram" in data else ""
self.new_log = ("NewLog" in data and bool(data["NewLog"]))
self.logurl1 = str(data["LogUrl1"]) if "LogUrl1" in data else ""
self.logurl2 = str(data["LogUrl2"]) if "LogUrl2" in data else ""
self.parameter_url = bool(data["ParameterUrl"]) if "ParameterUrl" in data else False
self.log_http = str(data["LogHttp"]) if "LogHttp" in data else ""
self.baseline_spool = str(data["BaseLine_Spool"]) if "BaseLine_Spool" in data else ""
self.check_value = (bool(data["CheckValue"]) if "CheckValue" in data else None)
self.poui_login = bool(data["POUILogin"]) if "POUILogin" in data else False
self.poui = bool(data["POUI"]) if "POUI" in data else False
self.log_info_config = bool(data["LogInfoConfig"]) if "LogInfoConfig" in data else False
self.release = str(data["Release"]) if "Release" in data else "12.1.2210"
self.top_database = str(data["TopDataBase"]) if "TopDataBase" in data else "MSSQL"
self.lib_version = str(data["Lib"]) if "Lib" in data else "lib_version"
self.build_version = str(data["Build"]) if "Build" in data else "build_version"
self.appserver_folder = str(data["AppServerFolder"]) if "AppServerFolder" in data else ""
self.destination_folder = str(data["DestinationFolder"]) if "DestinationFolder" in data else ""
self.appserver_service = str(data["AppServerService"]) if "AppServerService" in data else ""
self.check_dump = ("CheckDump" in data and bool(data["CheckDump"]))
self.chromedriver_auto_install = ("ChromeDriverAutoInstall" in data and bool(data["ChromeDriverAutoInstall"]))
self.ssl_chrome_auto_install_disable = (
"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 ""

def validar_chaves(self, json_data):
valid_keys = [
"ipExec",
"UrlSetStartExec",
"UrlSetEndExec",
"ScreenShot",
"Country",
"ExecId",
"NumExec",
"MotExec",
"Url",
"Browser",
"Environment",
"User",
"Password",
"Language",
"SkipEnvironment",
"Headless",
"LogFolder",
"LogFile",
"DebugLog",
"TimeOut",
"ParameterMenu",
"ScreenshotFolder",
"Coverage",
"SkipRestart",
"SmartTest",
"SmartERP",
"UserCfg",
"PasswordCfg",
"BinPath",
"CSVPath",
"DBDriver",
"DBServer",
"DBPort",
"DBName",
"DBUser",
"DBPassword",
"DBQOracleServer",
"URL_TSS",
"StartProgram",
"NewLog",
"LogUrl1",
"LogUrl2",
"ParameterUrl",
"LogHttp",
"BaseLine_Spool",
"CheckValue",
"POUILogin",
"POUI",
"LogInfoConfig",
"Release",
"TopDataBase",
"Lib",
"Build",
"AppServerFolder",
"DestinationFolder",
"AppServerService",
"CheckDump",
"ChromeDriverAutoInstall",
"SSLChromeInstallDisable",
"DataDelimiter",
"ProcedureMenu"
]
"ipExec",
"UrlSetStartExec",
"UrlSetEndExec",
"ScreenShot",
"Country",
"ExecId",
"NumExec",
"MotExec",
"Url",
"Browser",
"Environment",
"User",
"Password",
"Language",
"SkipEnvironment",
"Headless",
"LogFolder",
"LogFile",
"DebugLog",
"TimeOut",
"ParameterMenu",
"ScreenshotFolder",
"Coverage",
"SkipRestart",
"SmartTest",
"SmartERP",
"UserCfg",
"PasswordCfg",
"BinPath",
"CSVPath",
"DBDriver",
"DBServer",
"DBPort",
"DBName",
"DBUser",
"DBPassword",
"DBQOracleServer",
"URL_TSS",
"StartProgram",
"NewLog",
"LogUrl1",
"LogUrl2",
"ParameterUrl",
"LogHttp",
"BaseLine_Spool",
"CheckValue",
"POUILogin",
"POUI",
"LogInfoConfig",
"Release",
"TopDataBase",
"Lib",
"Build",
"AppServerFolder",
"DestinationFolder",
"AppServerService",
"CheckDump",
"ChromeDriverAutoInstall",
"SSLChromeInstallDisable",
"DataDelimiter",
"ProcedureMenu"
]
keys_json = set(json_data.keys())
wrong_keys = keys_json - set(valid_keys)

Expand Down
Loading

0 comments on commit 9cf882b

Please sign in to comment.