Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v1.20.28 #1609

Merged
merged 77 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
8ec9ad1
Bump opencv-python from 4.6.0.66 to 4.8.1.78
dependabot[bot] Aug 31, 2024
3810e99
Merge pull request #1568 from totvs/master
98llm Oct 28, 2024
54a9f10
Update version.py
98llm Oct 30, 2024
40a2280
Update install_package.cmd
98llm Oct 30, 2024
21075cd
refactor logging to added buffer memory handle.
renanllisboa Nov 1, 2024
e774de1
ConfigLoader class changed to load .json one time.
renanllisboa Nov 1, 2024
63858c1
Merge pull request #1573 from totvs/hotfix/config_class
renanllisboa Nov 1, 2024
bc6e0fa
Merge pull request #1574 from totvs/feature/user_logger_file_handler
renanllisboa Nov 1, 2024
46db927
Merge branch 'develop' into feature/logging
renanllisboa Nov 1, 2024
9231f3c
added check path from config_path Webapp
renanllisboa Nov 1, 2024
6be30f8
add error handling in create_file
renanllisboa Nov 1, 2024
92178cd
add log_folder key
renanllisboa Nov 4, 2024
cd75360
added new zindex check to click_tree right_click
renanllisboa Nov 6, 2024
0627f66
handling create folder errors
renanllisboa Nov 6, 2024
672a87a
Merge pull request #1575 from totvs/feature/logging
renanllisboa Nov 6, 2024
34eafda
Merge pull request #1577 from totvs/hotfix/clicktree_rightclick
renanllisboa Nov 6, 2024
9cf882b
Merge pull request #1578 from totvs/release/v1.20.28rc1
renanllisboa Nov 6, 2024
4fdadb3
change def names
98llm Nov 6, 2024
a6f4f33
Merge pull request #1580 from totvs/change_names
renanllisboa Nov 6, 2024
7ff0d66
Merge pull request #1581 from totvs/release/v1.20.28rc1
renanllisboa Nov 6, 2024
fac3f39
refactor the program_screen method to gain more stability
renanllisboa Nov 7, 2024
5bf01e5
branch release v1.20.28rc2
renanllisboa Nov 7, 2024
feb44bf
add server environment parameter
renanllisboa Nov 7, 2024
7efa138
fix log_error messages
renanllisboa Nov 7, 2024
19b8740
Merge pull request #1582 from totvs/hotfix/program_screen_module
renanllisboa Nov 8, 2024
d171e9e
Merge pull request #1583 from totvs/release/v1.20.28rc2
renanllisboa Nov 8, 2024
d403102
fix po-tabs search
98llm Nov 11, 2024
f0caa69
Update version.py
98llm Nov 11, 2024
983c59a
Update install_package.cmd
98llm Nov 11, 2024
0fc20ca
feature to checkListBox
98llm Nov 12, 2024
7a619c8
added set_button_character method
renanllisboa Nov 13, 2024
9f42ebd
Merge pull request #1585 from totvs/hotfix/poTabs
renanllisboa Nov 13, 2024
d6ced34
Merge pull request #1586 from totvs/feature/ClickListBox
renanllisboa Nov 13, 2024
376bed4
fix get_web_value in fill_select_element
renanllisboa Nov 13, 2024
64fe78d
Merge pull request #1587 from totvs/feature/click_quastionmark_button
renanllisboa Nov 13, 2024
e9fe30d
Merge pull request #1588 from totvs/hotfix/fill_select_element
renanllisboa Nov 13, 2024
ac92040
Merge pull request #1589 from totvs/release/v1.20.28rc3
renanllisboa Nov 14, 2024
4d61fea
add server environment in restart method and default value in program…
renanllisboa Nov 18, 2024
29ff9be
branch release v1.20.28rc4
renanllisboa Nov 18, 2024
6337a40
Merge pull request #1590 from totvs/hotfix/program_screen_environment
renanllisboa Nov 18, 2024
a432868
Merge pull request #1591 from totvs/release/v1.20.28rc4
renanllisboa Nov 18, 2024
9c0d061
Update version.py
98llm Nov 25, 2024
bfa608b
Update install_package.cmd
98llm Nov 25, 2024
eae536f
feature to click combo
98llm Nov 25, 2024
64a06a2
Merge pull request #1593 from totvs/hotfix/clickCombo
renanllisboa Nov 25, 2024
45002d3
Merge pull request #1594 from totvs/release/v1.20.28rc5
renanllisboa Nov 25, 2024
d7a801e
add configloader loading check and some changes to restructured resta…
renanllisboa Nov 25, 2024
373736d
Update version.py
98llm Nov 27, 2024
c88b9cf
Update install_package.cmd
98llm Nov 27, 2024
521ef93
fix combo input
98llm Nov 27, 2024
b632222
Merge pull request #1595 from totvs/hotfix/ClickCombo
renanllisboa Nov 27, 2024
809cdd3
Merge pull request #1596 from totvs/release/v1.20.28rc6
renanllisboa Nov 27, 2024
c8f216e
fix poSearch
98llm Nov 27, 2024
d0e79ec
refactor base_database log_error
renanllisboa Nov 27, 2024
5c5029f
Merge pull request #1597 from totvs/hotfix/poSearch
renanllisboa Nov 27, 2024
f0ce3e6
Merge pull request #1598 from totvs/hotfix/ConfigLoader
renanllisboa Nov 27, 2024
4c8fd19
Merge branch 'release/v1.20.28rc6' into hotfix/base_database
renanllisboa Nov 27, 2024
b3b1d68
Merge pull request #1599 from totvs/hotfix/base_database
renanllisboa Nov 27, 2024
183d34d
Merge pull request #1600 from totvs/release/v1.20.28rc6
renanllisboa Nov 27, 2024
bfcf665
fix POUI database call
98llm Nov 28, 2024
e3c87ab
Merge pull request #1601 from totvs/hotfix/dataBase
98llm Nov 28, 2024
fa84111
Merge pull request #1602 from totvs/release/v1.20.28rc6
98llm Nov 28, 2024
0692bee
fix a selector to icon input
98llm Nov 28, 2024
258e105
change coverage to check by layer instead of string
renanllisboa Nov 28, 2024
23475fd
fix posearch on active containers
98llm Nov 29, 2024
cdcf95e
adding get_coverage method and more time
renanllisboa Nov 29, 2024
6e77644
Merge pull request #1603 from totvs/hotfix/poSearch
renanllisboa Nov 29, 2024
92d1413
Merge pull request #1604 from totvs/hotfix/webapp_internal_coverage
renanllisboa Nov 29, 2024
012de7d
Merge pull request #1605 from totvs/release/v1.20.28rc6
renanllisboa Nov 29, 2024
a9e366f
update release
renanllisboa Nov 29, 2024
0b8989d
change post_exec ConfigLoader call
renanllisboa Dec 2, 2024
a14d12b
create branch release v1.20.28rc8
renanllisboa Dec 2, 2024
6696098
Merge pull request #1606 from totvs/hotfix/num_exec
renanllisboa Dec 2, 2024
63816b8
Merge pull request #1607 from totvs/release/v1.20.28rc8
renanllisboa Dec 2, 2024
f6e4aca
Merge pull request #1499 from totvs/dependabot/pip/opencv-python-4.8.…
renanllisboa Dec 2, 2024
2d65695
Update version.py
98llm Dec 5, 2024
cf32222
Update install_package.cmd
98llm Dec 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.28.tar.gz
pause >nul | set/p = Press any key to exit ...
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
'pyodbc==4.0.39',
'psutil==5.9.5',
'lxml==4.6.5',
'opencv-python==4.6.0.66',
'opencv-python==4.8.1.78',
'webdriver-manager'
],
packages=find_packages(),
Expand Down
6 changes: 2 additions & 4 deletions tir/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Webapp():
"""
def __init__(self, config_path="", autostart=True):
self.__webapp = WebappInternal(config_path, autostart)
self.__database = BaseDatabase(config_path, autostart=False)
self.config = ConfigLoader()
self.coverage = self.config.coverage

Expand Down Expand Up @@ -1279,7 +1278,7 @@ def QueryExecute(self, query, database_driver="", dbq_oracle_server="", database
>>> # Oracle Example:
>>> self.oHelper.QueryExecute("SELECT * FROM SA1T10", database_driver="Oracle in OraClient19Home1", dbq_oracle_server="Host:Port/oracle instance", database_server="SERVER_NAME", database_name="DATABASE_NAME", database_user="sa", database_password="123456")
"""
return self.__database.query_execute(query, database_driver, dbq_oracle_server, database_server, database_port, database_name, database_user, database_password)
return self.__webapp.query_execute(query, database_driver, dbq_oracle_server, database_server, database_port, database_name, database_user, database_password)

def GetConfigValue(self, json_key):
"""
Expand Down Expand Up @@ -1583,7 +1582,6 @@ class Poui():

def __init__(self, config_path="", autostart=True):
self.__poui = PouiInternal(config_path, autostart)
self.__database = BaseDatabase(config_path, autostart=False)
self.config = ConfigLoader()
self.coverage = self.config.coverage

Expand Down Expand Up @@ -1637,7 +1635,7 @@ def ClickCombo(self, field='', value='', position=1):
>>> oHelper.ClickCombo('Visão', 'Compras')
:return:
"""
self.__poui.click_poui_component(field, value, position, selector="div > po-combo", container=True)
self.__poui.click_combo(field, value, position)

def ClickSelect(self, field='', value='', position=1):
"""
Expand Down
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
50 changes: 12 additions & 38 deletions tir/technologies/core/base_database.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
from tir.technologies.core.base import Base
from tir.technologies.webapp_internal import WebappInternal
import pandas as pd
import pyodbc
import re
from tir.technologies.core.logging_config import logger
from tir.technologies.core.config import ConfigLoader

class BaseDatabase:

class BaseDatabase(Base):

def __init__(self, config_path="", autostart=True):
super().__init__(config_path, autostart=False)
self.webapp_internal = WebappInternal(config_path, autostart=False)
self.restart_counter = self.webapp_internal.restart_counter
def __init__(self):
self.config = ConfigLoader()

def odbc_connect(self, database_driver="", dbq_oracle_server="", database_server="", database_port=1521, database_name="", database_user="", database_password=""):
"""
Expand All @@ -27,16 +23,10 @@ def odbc_connect(self, database_driver="", dbq_oracle_server="", database_server
database_password = self.config.database_password if not database_password else database_password
dbq_oracle_server = self.config.dbq_oracle_server if not dbq_oracle_server else dbq_oracle_server

self.check_pyodbc_drivers(database_driver)

try:
if dbq_oracle_server:
connection = pyodbc.connect(f'DRIVER={database_driver};dbq={dbq_oracle_server};database={database_name};uid={database_user};pwd={database_password}')
else:
connection = pyodbc.connect(f'DRIVER={database_driver};server={database_server};port={database_port};database={database_name};uid={database_user};pwd={database_password}')
except Exception as error:
self.webapp_internal.restart_counter = 3
self.webapp_internal.log_error(str(error))
if dbq_oracle_server:
connection = pyodbc.connect(f'DRIVER={database_driver};dbq={dbq_oracle_server};database={database_name};uid={database_user};pwd={database_password}')
else:
connection = pyodbc.connect(f'DRIVER={database_driver};server={database_server};port={database_port};database={database_name};uid={database_user};pwd={database_password}')

return connection

Expand All @@ -45,10 +35,7 @@ def test_odbc_connection(self, connection):
:param connection:
:return: cursor attribute if connection ok else return False
"""
try:
return connection.cursor()
except:
return False
return connection.cursor()

def connect_database(self, query="", database_driver="", dbq_oracle_server="", database_server="", database_port=1521, database_name="", database_user="", database_password=""):

Expand All @@ -74,15 +61,7 @@ def disconnect_database(self, connection):
logger().info('DataBase connection stopped')
else:
logger().info('DataBase connection already stopped')

def check_pyodbc_drivers(self, driver_database):
if not next(iter(list(
filter(lambda x: x == driver_database.lower(), list(map(lambda x: x.lower(), pyodbc.drivers()))))),
None):
error_message = f"Driver: '{driver_database}' isn't a valid driver name!"
self.webapp_internal.restart_counter = 3
self.webapp_internal.log_error(error_message)


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 Expand Up @@ -133,16 +112,11 @@ def query_execute(self, query, database_driver, dbq_oracle_server, database_serv
if re.findall(r'^(SELECT)', query.upper()):
df = pd.read_sql(sql=query, con=connection)
return (df.to_dict())
elif re.findall(r'^(UPDATE|DELETE|INSERT)', query.upper()):
self.cursor_execute(query, connection)
else:
self.webapp_internal.log_error(f"Not a valid query in {query}")
self.cursor_execute(query, connection)

def cursor_execute(self, query, connection):
cursor = connection.cursor()
try:
rowcount = cursor.execute(query).rowcount
except Exception as error:
self.webapp_internal.log_error(str(error))
rowcount = cursor.execute(query).rowcount
logger().info(f'{rowcount} row(s) affected')
connection.commit()
Loading
Loading